Commit graph

20208 commits

Author SHA1 Message Date
vercel-release-bot
fe87d8c6f9 v14.2.0-canary.38 2024-03-22 12:39:08 +00:00
Kiko Beats
0f6a6b232a
chore: upgrade @edge-runtime/cookies (#63602) 2024-03-22 10:58:49 +00:00
Tim Neutkens
66be631d8a
Remove lodash from external packages list (#63601)
## What?

Since the work that Shu did for optimizing large barrel dependencies
marking lodash as external is no longer required.

<!-- 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-2899
2024-03-22 10:56:38 +00:00
Tim Neutkens
0234afa5a0
Add failing test for SCSS mixin that uses parenthesis (#63562)
## What?

Adds a test for a reported problem where sass-loader fails with `Null
check operator used on a null value`.

<!-- 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-2889
2024-03-22 11:24:25 +01:00
Tobias Koppers
fe989a2360
the argument might be written with underscores (#63600)
### What?

You can pass `--max_old_space_size=` with underscores instead of dashes
which wasn't handled yet.

### Why?

### How?



Closes PACK-2817
2024-03-22 10:46:40 +01:00
vercel-release-bot
368e9aa9ae v14.2.0-canary.37 2024-03-21 23:51:55 +00:00
Will Binns-Smith
8500eca982
Update Turbopack to turbopack-240321.3 (#63585)
Includes vercel/turbo#7800
2024-03-21 23:46:36 +00:00
vercel-release-bot
d1248a7536 v14.2.0-canary.36 2024-03-21 23:23:03 +00:00
Jiachi Liu
053db6af8e
Remove the erroring on force-dynamic in static generation for app route (#63526)
### What
* Remove the erroring of force-dynamic is not able to use during static
generation
* Export the route segments properly in sitemap conventions

### Why

We discovered this error is showing up when users are using
force-dynamic with generating multi sitemaps.

When you have a dynamic `route /[id]/route.js` , and you have
generateSitemaps defined which is actually using `generateSitemaps`
under the hood , then you set the route to dynamic with `export dynamic
= 'force-dynamic'`.

We should keep the route still as dynamic. `generateStaticParams` is
only for generating the paths, which is static in build time. And the
`force-dynamic` is going to be applied to each generated path.

Closes NEXT-2881
2024-03-22 00:15:20 +01:00
Andrew Gadzik
4c467a2638
Improve experimental test proxy (#63567)
Followup on https://github.com/vercel/next.js/pull/52520 and
https://github.com/vercel/next.js/pull/54014

**Enhancements**
- Removes `--experimental-test-proxy` CLI argument from `next dev` and
`next start`
- Adds a new experimental config option `testProxy?: boolean`
- Instead of throwing an error, return the `originalFetch` response if
the current request context does not contain the `Next-Test-*` HTTP
headers

**Why?**
These changes allow us to write mixed Integration + E2E tests within the
same Playwright process.

```ts
// some-page.spec.ts

test.describe('/some-page', () => {
	test('some integration test', async ({ page, next }) => {
	  // by using the `next` fixture, playwright will send the `Next-Test-*` HTTP headers for 
	  // every request in this test's context.
	  next.onFetch(...);
	  
	  await page.goto(...);
	  await expect(...).toBe('some-mocked-value');
	});

	test('some e2e test', async ({ page }) => {
	  // by NOT using the `next` fixture, playwright does not send the `Next-Test-*` HTTP headers
	  await page.goto(...);
	  await expect(...).toBe('some-real-value');
	});
})
```

Now I can run `next dev` and locally develop my App Router pages AND run
my Playwright tests against instead of having to,
- run `next dev` to locally develop my change
- ctrl+c to kill server
- run `next dev --experimental-test-proxy` to locally run my integration
tests

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-21 21:31:29 +00:00
Maël Nison
7de7cbf283
Upgrades enhanced-resolve (#63499)
This PR upgrades `enhanced-resolve` to `5.16.0` so as to benefit from
https://github.com/webpack/enhanced-resolve/pull/301, recently merged.

Without this diff, importing dependencies from files from external PnP
projects would fail. It's a little niche, but I'm working on a
documentation website that leverages that to allow deploying multiple
websites from the same template.

Co-authored-by: Sam Ko <sam@vercel.com>
Co-authored-by: Steven <steven@ceriously.com>
2024-03-21 15:27:15 -04:00
FoSuCloud
77b21001cc
Fix(example) : Image missing width property in with-redux example (#63546)
- Fixes https://github.com/vercel/next.js/issues/63542

Co-authored-by: yelipei <yelipei@qianxin.com>
Co-authored-by: Steven <steven@ceriously.com>
2024-03-21 18:24:21 +00:00
vercel-release-bot
04f5781c1b v14.2.0-canary.35 2024-03-21 17:49:30 +00:00
Tobias Koppers
7d95336779
Revert "feat(next-core): support unsupported module runtime error (#63491)" (#63575)
### What?

It's causing `__import_unsupported` is not defined in `instrumentation`
context
2024-03-21 18:43:58 +01:00
Steven
abe74a5211
fix: call instrumentationHook earlier for prod server (#63536)
This ensures that the instrumentation hook for Node.js will run
immediately during `next start` instead of waiting for the first request
like does it `next dev`.

However, if there is a separate instrumentation hook for Edge, that will
still be lazy evaluated and wait until the first request.

Fixes #59999 
Fixes NEXT-2738
2024-03-21 13:11:03 +00:00
Tim Neutkens
39340ab424
Fix edge-can-use-wasm-files test for Turbopack (#63552)
## What?

Test fix for Turbopack, the paths are slightly different. Fixes 1 test.

<!-- 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-2888
2024-03-21 11:05:02 +01:00
OJ Kwon
976dd526ae
feat(custom-transform): middleware dynamic assert transform (#63538)
### What

This PR implements runtime warning for dynamic codes (`eval`,
`Function`...) in edge runtime. Webpack uses middleware plugin to
replace / wrap codes, in case of Turbopack we don't have equivalent, so
creating a new transform visitor and run it if the context is edge.
Since sandbox augments global fn (__next_*), transform simply wraps the
expr if it matches to the condition.

Closes PACK-2804
2024-03-21 06:12:28 +01:00
Will Binns-Smith
aeafed9405
Turbopack: Fail when module type is unhandled (#63535)
This causes Turbopack to fail and communicate when a file with an
unhandled or unregistered extension is built.

Test Plan: `TURBOPACK=1 pnpm test-dev
test/development/basic/hmr.test.ts`


Closes PACK-2803
2024-03-21 00:36:01 +00:00
Balázs Orbán
8ab62613fe
chore(test): fix false-positive tests (#63242)
<!-- 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-2798
2024-03-21 01:24:33 +01:00
vercel-release-bot
c0f9d246d1 v14.2.0-canary.34 2024-03-20 23:22:37 +00:00
JJ Kasper
00bcd55163
Update middleware matcher docs to mention has matching (#63533)
Looks like we were only documenting the `missing` matcher use case
although `has` is also supported and we weren't mentioning they can
combined as well.

x-ref: [slack
thread](https://vercel.slack.com/archives/C06LDQYNPV0/p1710704436247789)

Closes NEXT-2883

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2024-03-20 20:53:39 +00:00
Cody Olsen
f25ae9a0f9
Update Sanity example deps (#63514)
Most notably it updates `typescript` to `5.4.2` now that Sanity Studio
is updated to support the [more aggressive reduction of intersections
between type variables and primitive
types](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/#more-aggressive-reduction-of-intersections-between-type-variables-and-primitive-types)
2024-03-20 15:14:16 -04:00
Balázs Orbán
a2556196ea
refactor(test): switch tests to use pnpm in more places (#63196) 2024-03-20 15:00:58 -04:00
OJ Kwon
d95bc960c7
test(fixture): update test fixture (#63498)
### What
Followup for https://github.com/vercel/next.js/pull/63491, adjust
fixture setup to work with turbopack.

Closes PACK-2790
2024-03-20 11:03:01 -07:00
Balázs Orbán
3234b50f8f
refactor(test): don't use global as any in test utils (#63241) 2024-03-20 18:02:34 +00:00
Tobias Koppers
ad1dc3f8f1
retry pnpm pack (#63519)
### What?

Make CI more stable


Closes PACK-2799
2024-03-20 18:38:42 +01:00
Juan Settecase
e4cd547a50
feat: add support for localizations in sitemap generator (#53765)
### What?

Following up with [this
suggestion](https://github.com/vercel/next.js/discussions/53540) I went
ahead and implemented the proposal for the Next.js team to merge it if
they agree.

Things to keep in mind:
- Google has [three different
ways](https://developers.google.com/search/docs/specialty/international/localized-versions#methods-for-indicating-your-alternate-pages)
to do this. The three of them are equivalent
- Google seems to be the only search engine supporting this approach.
The rest of them should ignore it

### Why?

This is supported by
[Google](https://developers.google.com/search/docs/specialty/international/localized-versions#example_2)
to better understand the site when the same page is available in
multiple languages.

### How?

- I added a new key to the `MetadataRoute.Sitemap` type called
`alternates` which accepts just one sub key `languages` similar to the
current one in the
[Metadata](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#alternates)
object
- I updated the `resolveSitemap` method to process the new key and
generate the expected sitemap
- I updated the related tests and documentation to reflect the new
syntax

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-03-20 17:00:20 +00:00
Balázs Orbán
491f6d85e4
chore: fix stale issue closing GH Action (#63523) 2024-03-20 14:38:55 +00:00
Tim Neutkens
859605a52c
Add reporting of turbopack-dev-examples-manifest.json (#63521)
## What?

Adds a manifest to track which examples have been checked with `next dev
--turbo` and reports it to areweturboyet.com

<!-- 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-2878
2024-03-20 14:58:01 +01:00
Tobias Koppers
1c998d86da
route/middleware/instrumentation use server assets instead of client assets (#62134)
### What?

route/middleware/instrumentation use server assets
server assets use full url rewrite

### Why?

### How?

https://github.com/vercel/turbo/pull/7750

Fixes PACK-2522

fixes PACK-2645
2024-03-20 12:06:29 +01:00
Tim Neutkens
da1010bc08
Split dev and build test run for Turbopack (#63511)
## What?

Because of the way the test artifacts are collected we can't have a
single actions run that holds 2 separate test run reports. This PR
splits up the test runs to run separately. The daily upload step is
already running based on the canary branch anyway so they don't have to
be combined.

<!-- 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-2876
2024-03-20 10:05:16 +01:00
Balázs Orbán
33f8428f70
refactor(test): expose test mode as re-exported variables (#63240) 2024-03-20 01:03:49 +00:00
vercel-release-bot
833df606b2 v14.2.0-canary.33 2024-03-19 23:22:30 +00:00
Zack Tanner
3ed46abcda
Fix interception/detail routes being triggered by router refreshes (#63263)
### What
Actions that revalidate the router state by kicking off a refetch (such
as `router.refresh()` or dev fast refresh) would incorrectly trigger an
interception route if one matched the current URL, or in the case of
already being on an intercepted route, would trigger the full detail
page instead.

### Why
Interception rewrites use the `nextUrl` header to determine if the
requested path should be rewritten to a different path. We currently
forward that header indiscriminately, which means that if you were on a
non-intercepted route and called `router.refresh()`, the UI would change
to the intercepted content instead (since it would treat it the same as
a soft-navigation).

### How
This updates various reducers to only forward the `nextUrl` header if
there's an interception route present in the tree. If there is, we want
to refresh its data, rather than the data for the underlying page. The
reverse is also true: if we were on the "full" page, and triggered a
`router.refresh()`, we won't forward `nextUrl` meaning it won't fetch
the interception data.

In order to determine if an interception route is present in the tree, I
had to add a new segment type for dynamic interception routes, as by the
time they reach the client they are stripped of their interception
marker.

**Note: There are a series of bugs related to `router.refresh` with
parallel/interception routes, such as the previous page/slot content
disappearing when triggering a refresh. This does not address all of
those cases, but I'm working through them!**

Fixes #60844
Fixes #62470
Closes NEXT-2737
2024-03-19 15:42:41 -07:00
vercel-release-bot
ad4a7bf403 v14.2.0-canary.32 2024-03-19 22:10:11 +00:00
Rafael Fernandes
14a653bfab
Update opentelemetry docs #63443 (#63444)
Fix #63443 

- Change deprecated semanticResourceAttributes.SERVICE_NAME for
SEMRESATTRS_SERVICE_NAME

<!-- 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-03-19 21:54:54 +00:00
Ethan Arrowood
d2838ce31e
Simplify createRootLayoutValidatorStream (#63484)
This PR is a follow up to #63427 and simplifies the
`createRootLayoutValidatorStream` function to check each chunk
individually instead of combining all of them into one. This should
improve performance

Closes NEXT-2868
2024-03-19 14:46:39 -07:00
JJ Kasper
d4f5368f2c
Update RSC etag generation handling (#63336)
Currently when we generate payloads in app router, the order of RSC
chunks aren't deterministic even if the content stays the same. This
means that any caches that rely on etags for detecting changes in
content aren't able to reliably cache/and avoid invalidating properly.
To avoid this we can manually sort the content before generating the
etag. Eventually this can be fixed upstream in react although that is a
bigger lift so we are doing this for now to alleviate the issue.

x-ref: [slack
thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1709937748240119?thread_ts=1709856182.174879&cid=C042LHPJ1NX)

Closes NEXT-2825
2024-03-19 21:45:21 +00:00
LuiGeeDev
2bb65cabdb
Update a third-parties docs, GoogleTagManager example (#63448)
### What?
If I follow the example in docs then use GTM, it doesn't work when I
send an event in page when mounted using useEffect. It logs a warning:
`@next/third-parties: GTM dataLayer dataLayer does not exist`

### Why?
`window.dataLayer` does not exist when children is rendered, because
children runs faster than GoogleTagManager component. It works in dev
mode, but doesn't work when built, so it can be easily missed.

### How?
It works fine when the order is changed. As you see in example,
GoogleTagManager should come first, higher than children.
2024-03-19 21:43:49 +00:00
Valentin Hervieu
203f6a8691
Update react-hydration-error.mdx (#63455)
Adding a very common cause for hydration errors

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-19 21:41:28 +00:00
Koji Onishi
430e71a38d
update Docker examples to specify HOSTNAME properly (#59756)
### What?

Update docker examples to correctly set HOSTNAME env variable for
standalone output

Related to PR:
https://github.com/vercel/next.js/pull/52804

### Why?
### TL;DR

The dockerfiile examples need to modified as that contains HOSTNAME
setting that apparently is not working as expected.

Related to Issue:
https://github.com/vercel/next.js/issues/58657

Affected examples:
https://github.com/vercel/next.js/tree/canary/examples/with-docker

https://github.com/vercel/next.js/tree/canary/examples/with-docker-multi-env

### Longer explanations

Based on [Docker
document](https://docs.docker.com/engine/reference/builder/#environment-replacement):
> You can also use environment variables with RUN, CMD, and ENTRYPOINT
instructions, but in those cases the variable substitution is handled by
the command shell, not the builder.

It means that when executing the last CMD ( `node server.js` ) in
Dockerfile samples, the HOSTNAME defined by prior `ENV` instruction is
simply ignored.

This causes problems typically when the host process sets HOSTNAME -
e.g. for instance when using AWS Fargate for deployment [we can't have
control over HOSTNAME](https://stackoverflow.com/a/52871552) set by the
host process. (also refer to the issue #58657 above)

### How?

Updated Dockerfilie samples, by setting HOSTNAME directly in CMD
instruction that launches nextjs server, not in the builder process.

Used this setting at my end (with AWS Fargate) to confirm that it fixes
the network problem.

Closes NEXT-
Fixes #58657

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-19 21:26:44 +00:00
Chris Stott
198e2d79d2
Update generate-viewport.mdx (#63493)
Updates inaccurate wording that says the following example contains the
default configuration. I did this rather than update the example because
the [default
configuration](https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/default-metadata.tsx#L9)
does not set all values, so it seems useful that the example documents
all of them.

(By the way, the configuration in the example violates accessibility
standards by setting `userScalable: false` and `maximumScale: 1`, which
is what caught my eye in the first place. Glad to find out that it
wasn't the actual default)
2024-03-19 20:54:57 +00:00
OJ Kwon
3689c03d60
feat(next-core): support unsupported module runtime error (#63491)
### What

Implement webpack's middleware plugin equivalent for webpack, to raise
unsupported error in runtime.

PR utilizes import map alias for the edge context, to resolve into
modulereplacer internally provides a virtualsource to call runtime error
logic. Since we already have globally augmented, the virtualsource only
need to take export those into module.

Closes PACK-2789
2024-03-19 13:52:06 -07:00
JJ Kasper
b2b5ab4aff
Update tags limit handling for max items (#63486)
Continuation of https://github.com/vercel/next.js/pull/55083 this
ensures we also properly warn when the max number of tags is hit and we
must filter them out so that users are aware of this. Related
documentation is also updated to reflect this limit.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04V3E1UYNQ/p1710792129356939)

Closes NEXT-2870

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-19 12:02:35 -07:00
Zack Tanner
7d20ba17b8
Fix instant loading states after invalidating prefetch cache (#63256)
In #61573, I updated the navigation reducer to request a new prefetch
entry if it's stale. But this has the unintended consequence of making
instant loading states effectively useless after 30s (when the prefetch
would have expired). Blocking navigation and then rendering the loading
state isn't ideal - if we have some loading data in a cache node, we
should re-use it.

Now that #62346 stores loading data in the `CacheNode`, we can copy over
`loading` during a navigation.

This PR repurposes `fillCacheWithDataProperty` which wasn't being used
anywhere, to instead be a utility we can use to programmatically trigger
a lazy fetch on a particular segment path by nulling out it's data while
copying over other properties. We could have used the existing util
as-is, but ideally we only have a single spot where lazy fetching can
happen, which currently is in `LayoutRouter`.

When a stale prefetch entry is detected, rather than applying the data
to the tree, this PR will copy over the `loading` nodes and will
"delete" the data so it can be refetched.

<!-- 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-2806
2024-03-19 12:02:12 -07:00
Tim Neutkens
2160f0ca2f
Don't download latest test result when reporting manifest (#63488)
## What?

We don't want to generate based on the latest run but instead based on
the run that is comitted to the repository.

<!-- 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-2872
2024-03-19 19:48:07 +01:00
piotrekwitkowski
05c0be3f49
docs: add AWS CloudFront loader for next/image (#63262)
### What?
Adds Amazon CloudFront custom loader docs.

### Why?
Help people find Amazon CloudFront as an option for Image loaders.

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-19 18:15:27 +00:00
Jiachi Liu
dd3a7df14d
test: switch order of tests to avoid flakniess (#63482)
x-ref:
https://github.com/vercel/next.js/actions/runs/8344655954/job/22838765632?pr=63476

We saw the playwright execution was broken while accessing url in
turbopack tests. Switching the order to check the content first solve
the problem

Closes NEXT-2867
2024-03-19 17:36:05 +00:00
Tim Neutkens
d2c28ee9bb
Skip test/integration in Turbopack build runs (#63480)
## What?

We need to go through all `test/integration` tests to make sure they're
only running the production piece.

<!-- 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-2866
2024-03-19 17:02:02 +01:00
Tobias Koppers
14f16c7050
update turbopack (#63475)
* https://github.com/vercel/turbo/pull/7762 <!-- Tobias Koppers - avoid
panic -->
* https://github.com/vercel/turbo/pull/7750 <!-- Tobias Koppers - fix
ASSET_PREFIX -->
* https://github.com/vercel/turbo/pull/7761 <!-- Tobias Koppers -
process source maps from webpack loaders -->
2024-03-19 15:58:19 +01:00