Commit graph

19019 commits

Author SHA1 Message Date
Jiachi Liu
817a2402b2
refactor: simplify the call in lib.picocolors (#60386)
Simplify the conditional formatter call in `lib/picocolors`

Closes NEXT-2018

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-01-08 18:15:18 +00:00
Sukka
94b8af2258
chore(precompile): remove obsolete precompiled assets (#60316)
Per @styfle suggestion, #58038 has been split into multiple PRs for
easier review.

- Remove `find-cache-dir`
- The usage of `find-cache-dir` was removed **4 years ago**
(https://github.com/vercel/next.js/pull/7013) but the dist and the build
script were never removed.
- Remove `@segment/ajv-human-errors`
- The usage of `@segment/ajv-human-errors` was removed in
https://github.com/vercel/next.js/pull/56383 by me. Though the build
script was also removed in that PR, the dist never got removed.
2024-01-08 13:00:49 -05:00
Steven
543ca11571
docs: update docs for remotePatterns to mention what happens when prop is omitted (#60387)
- Fixes #44660
2024-01-08 12:57:23 -05:00
Tim Neutkens
dcb00f676a
Add replay.io test suite dependencies (#60381)
## What?

Adds the missing dependencies for recording the Next.js test suite in
Replay that @jaril added.

### Steps to use it

1. Clear all local replays using `pnpm replay rm-all`
1. Run the test locally using the `RECORD_REPLAY=1` environment
variables. I.e. `RECORD_REPLAY=1 pnpm test-dev
test/e2e/app-dir/app/index.test.ts`
1. Upload all the replays to your workspace using your the API key:
`RECORD_REPLAY_API_KEY=keyhere pnpm replay upload-all`
1. Check the uploaded replays in your workspace, while uploading it
provides the URLs.


You can check if the replay was recorded correctly using `pnpm replay
ls`

<!-- 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-2014
2024-01-08 17:05:05 +01:00
vercel-release-bot
864b4f71d1 v14.0.5-canary.44 2024-01-08 15:46:50 +00:00
Sukka
2a2a9c70d5
chore(font): enable minification (#60319)
Per @styfle suggestion, #58038 has been split into multiple PRs for
easier review.

- Enable minification of `@next/font`
- Currently, the `@next/font` is built separately (without minification)
and then copied to the `dist` folder of the Next.js.
2024-01-08 09:55:01 -05:00
Donny/강동윤
1e7e6e1c93
Update swc_core to v0.87.16 (#60192)
### What?

Update swc crates

### Why?

To fix bugs

### How?

Closes PACK-1682
Closes PACK-2154
Fixes #56144

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-01-08 14:38:21 +01:00
Jiachi Liu
3db878629e
Fix dynamic sitemap detection (#60356)
### What

Fix bad detection of dynamic route of sitemap metadata route, the swc
AST check should process when the text are detected. But prevuious if
there's text with `generateSitemap` such as comment but not the actual
export it will fail.

### How
Add both checks on metadata loader side and detection helper side

* Only call `generateSitemaps` helper when the export existed
* Fix the helper detection logic (major part of this PR)

Fixes #59698
Closes #60344
Closes NEXT-2007
2024-01-08 14:11:00 +01:00
Manuel Transfeld
75e138198d
add missing types (#60346)
ts version has been identical to the js version

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Delba de Oliveira <delbabrown@gmail.com>
2024-01-08 11:28:56 +00:00
Tim Neutkens
7dbb66f390
Simplify if condition (#60250)
## What?

Makes it easier to reason about this condition.

<!-- 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-1992
2024-01-08 11:31:17 +01:00
Vercel Release Bot
20a2a92400
Update Turbopack test manifest (#60371)
This auto-generated PR updates the integration test manifest used when
testing Turbopack.
2024-01-08 10:23:29 +01:00
Shogun Sea
605eea316c
[doc] Update 03-linking-and-navigating.mdx (#60345)
I think this meant to be `client` instead of `server` ?

<!-- 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-01-08 06:17:36 +00:00
Andrew Clark
5e7106141f
Update React from 0cdfef19b to f1039be4a (#60368)
### React upstream changes

- https://github.com/facebook/react/pull/27888
- https://github.com/facebook/react/pull/27870
- https://github.com/facebook/react/pull/27871
- https://github.com/facebook/react/pull/27850
- https://github.com/facebook/react/pull/27839
- https://github.com/facebook/react/pull/27842
- https://github.com/facebook/react/pull/27841
- https://github.com/facebook/react/pull/27840
- https://github.com/facebook/react/pull/27761
- https://github.com/facebook/react/pull/27831
- https://github.com/facebook/react/pull/27801

Closes NEXT-2012
2024-01-07 21:13:41 -08:00
vercel-release-bot
cfb75b77ea v14.0.5-canary.43 2024-01-07 23:22:24 +00:00
Lee Robinson
a5ae1a6653
docs: Add docs for next dev --experimental-https (#60357) 2024-01-07 11:32:27 -06:00
Christopher Krogh
f6c5e2f879
Bump webpack-bundle-analyzer (#58442)
https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/624 was
merged and released in 4.10.0 and I'd like to leverage this change in
`@next/bundle-analyzer`
2024-01-07 13:29:35 +01:00
Vercel Release Bot
2d0ad0a7a8
Update Turbopack test manifest (#60306)
This auto-generated PR updates the integration test manifest used when
testing Turbopack.
2024-01-07 09:51:32 +01:00
rmathew8-gh
af24c45398
fixed import path in with-jest template. (#60332)
<!-- 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: Roy Mathew <rmathew8@gmail.com>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-06 23:26:59 +00:00
vercel-release-bot
9d8015ded3 v14.0.5-canary.42 2024-01-06 23:21:58 +00:00
Sam Ko
6568502dcf
docs: update broken link in UPGRADING.md (#60342)
This link →
[/docs/02-app/01-building-your-application/09-upgrading/index.mdx](21452921c0/docs/02-app/01-building-your-application/09-upgrading/index.mdx)
doesn't exist.

Fixing it to link to the correct directory.

Closes NEXT-2006
2024-01-06 14:46:07 -08:00
David Thorand
977df12917
Fix bundle analyzer NPM package name in documentation (#60339)
This fixes a typo in the Next.js documentation.
2024-01-06 22:10:56 +00:00
Tobias
a95a7d684f
docs: Document error cases with head/body-tags (#56412)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-06 11:16:21 -06:00
Luke Schlangen
0ea127c642
examples: add allow-unauthenticated option to cloud run deploy (#58792)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-06 11:08:27 -06:00
Niklas Ziermann
781fa7745d
examples: improve zustand example (#58696)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-06 11:07:54 -06:00
Lee Robinson
779a373460
docs: address a few open issues (#60329)
Closes https://github.com/vercel/next.js/issues/42095.
Closes https://github.com/vercel/next.js/issues/59215.
2024-01-06 11:04:17 -06:00
Steven
bb7af2a0d4
chore(examples): migrate image-component example to App Router (#60289)
This PR migrates the `image-component` example from Pages Router to App
Router.

It also upgrades a couple dependencies and regenerates tsconfig.json
2024-01-06 11:03:01 -06:00
Dongho Kim
0191ef85e1
docs: update TS example for useSearchParams (#55357) 2024-01-06 10:08:26 -06:00
Sjoerd van Bommel
9817442e22
docs: add optional catch-all segments typescript example (#60237)
Closes https://github.com/vercel/next.js/issues/60235
2024-01-06 10:04:43 -06:00
Lee Robinson
e566f3297f
docs: add example of webhooks with App Router (#60276)
Full example of one with GitHub:
https://raw.githubusercontent.com/leerob/on-demand-isr/main/app/api/webhook/route.ts
2024-01-06 10:02:56 -06:00
Jyan
caf282ba8a
docs: typo fix in compression page (#60318) 2024-01-06 10:02:05 -06:00
Zack Tanner
efebba80a7
parallel routes: fix @children slots (#60288)
### What?
Our
[docs](https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#convention)
point out that `app/page.js` is equivalent to `app/@children/page.js`,
however in practice this is not the case, and causes type errors when
using `@children` slots as well as incorrect behavior when matching
catch-all routes.

### Why?
- When typechecking, `@children` slots would be added to the typeguard
file for the associated layout, resulting in duplicate identifiers for
the `children` prop
- When determining where to insert catchall slots, the `hasMatchedSlots`
check wasn't considering that the `@children` slot corresponds with the
page component, so matching another page would clobber the previous one.

### How?
- Filters out the `@children` slot when collecting slots for
typechecking
- Filters out the `@children` slot when running the `hasMatchedSlots`
function in the catch-all normalizer

Closes NEXT-1984
2024-01-06 07:24:44 -08:00
Sam Ko
43410c9926
chore: update pnpm to the latest (v8.14.0) (#60295)
Update <picture data-single-emoji=":pnpm:" title=":pnpm:"><img
class="emoji" width="20" height="auto"
src="https://emoji.slack-edge.com/T0CAQ00TU/pnpm/49b40aec15de9c17.png"
alt=":pnpm:" align="absmiddle"></picture> to the latest (v8.14.0).

Closes NEXT-2003
2024-01-05 22:12:04 -05:00
Alexander Savelyev
826955b3c3
micro fix of the cache limit check (#60249)
### Fixing a bug

I'm sorry, I have no idea how I managed to delete this, as I just copied
the code.

However, I had to figure out why the tests passed. When I test the
running application locally, it works as expected.

So, when a route is first used in a running production application in a
test, `ctx.fetchCache` is `undefined`. Therefore, the error rule does
not trigger on the first request, and the cache is successfully written.
This may result in artifacts in FetchCache in Vercel and possibly in
other parts of the code.

```ts
if (
  ctx.fetchCache && // <- Undefined on first request
  // we don't show this error/warning when a custom cache handler is being used
  // as it might not have this limit
  !this.hasCustomCacheHandler &&
  JSON.stringify(data).length > 2 * 1024 * 1024
) {
  if (this.dev) {
    throw new Error(`fetch for over 2MB of data can not be cached`)
  }
  return
}
```

I'm 95% sure that this is a bug and it shouldn't work like this. I'll
look into this later and if there is an error, I'll put it into a task
and try to figure it out later.

Unfortunately, the
[test](7e028fb6d8/test/e2e/app-dir/app-static/app-static.test.ts (L3080))
from [previous PR](https://github.com/vercel/next.js/pull/59976) is not
working yet, although it is correct from my point of view. I think it
should be kept and the problem above should be fixed.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-06 01:46:49 +00:00
JJ Kasper
21452921c0
Update flakey test from port re-use (#60291)
x-ref:
https://github.com/vercel/next.js/actions/runs/7427293982/job/20213797689

Closes NEXT-2002
2024-01-05 23:44:43 +00:00
vercel-release-bot
a2288cb273 v14.0.5-canary.41 2024-01-05 23:22:10 +00:00
Zack Tanner
90f95399dd
fix catch-all route normalization for default parallel routes (#60240)
### What?
When relying on a `default` route as a fallback, greedier catch-all
segments in the application hierarchy would take precedence, causing
unexpected errors/matching behavior.

### Why?
When performing parallel route catch-all normalization, we push
potential catch-all matches to paths without considering that a path
might instead be matched by a `default` page. Because of this, the
catch-all take precedence and the app will not try and load the default.

For example, given this structure:

```
{
  "/": ["/page"],
  "/[[...catchAll]]": ["/[[...catchAll]]/page"],
  "/nested/[foo]/[bar]": ["/nested/[foo]/[bar]/@slot/page"],
  "/nested/[foo]/[bar]/[baz]": ["/nested/[foo]/[bar]/@slot/[baz]/page"],
}
```

(Where there's a `/nested/[foo]/[bar]/default.tsx`)

The route normalization logic would produce:

```
{
  "/": ["/page"],
  "/[[...catchAll]]": ["/[[...catchAll]]/page"],
  "/nested/[foo]/[bar]": [
    "/nested/[foo]/[bar]/@slot/page",
    "/[[...catchAll]]/page",
  ],
  "/nested/[foo]/[bar]/[baz]": [
    "/nested/[foo]/[bar]/@slot/[baz]/page",
    "/[[...catchAll]]/page",
  ],
}
```
This means that when building the `LoaderTree`, it won't ever try to
find the default for that segment. **This solution operates under the
assumption that if you defined a `default` at a particular layout
segment, you intend for that to render in place of a greedier
catch-all.** (Let me know if this is an incorrect assumption)

### How?
We can't safely normalize catch-all parallel routes without having
context about where the `default` segments are, so this updates
`appPaths` to be inclusive of default segments and then filters them
when doing anything relating to build/export to maintain existing
behavior. We use this information to check if an existing default exists
at the same segment level that we'd push the catch-all to. If one
exists, we don't push the catch-all. Otherwise we proceed as normal.

Closes NEXT-1987
2024-01-05 14:20:45 -08:00
Ahmed Abdelbaset
b9cd76eda2
docs: small corrections to bundle analyzer docs (#60285)
Some corrections to #59304
2024-01-05 16:14:26 -05:00
Steven
d946c669d5
chore(docs): add section for Custom Type Declarations (#60282)
We used to have docs but it was lost in the rewrite (as seen in this
comment
https://github.com/vercel/next.js/pull/30060#discussion_r732243330)

This PR adds back the documentation for Custom Type Declarations.

Closes NEXT-1999
2024-01-05 14:55:36 -05:00
Jordan Newland
f76ed005f0
docs(testing): add bun command to running your tests section (#60281)
Add missing bun command from Vitest page.

Co-authored-by: Steven <steven@ceriously.com>
2024-01-05 14:27:38 -05:00
Gaspar Garcia Jr
b110b13169
Clarify searchParams is not passed to Layouts (#60277)
Clarify searchParams is not passed to Layouts

Followup to
https://github.com/vercel/next.js/pull/60257/files#r1443175387

<!-- 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-01-05 11:04:34 -08:00
Tim Neutkens
66e565d1ea
Move buildId logic to getBuildId (#60132)
## What?

Small refactor to allow moving this logic in the future.

<!-- 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-1949
2024-01-05 16:58:39 +01:00
vercel-release-bot
00f36befb4 v14.0.5-canary.40 2024-01-05 15:17:35 +00:00
OJ Kwon
f641d9ccfc
feat(next-core): apply rsc transform in turbopack (#59629)
### What?

Turbopack does not apply same transform for the react server components,
which makes missing lot of compilation error validation and custom
comments. PR refactors transform to be used in next-swc / turbopack
both, then apply it into turbopack.

There are still some of test cases are not passing, might need further
digging for the transform condition.


Closes PACK-2155

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-01-05 16:14:06 +01:00
Hamir Mahal
f60c609bdb
style: enforce prop immutability in new next app (#58845)
- fixes #58844

Co-authored-by: Steven <steven@ceriously.com>
2024-01-05 09:55:27 -05:00
Delba de Oliveira
ff058d64a5
Docs: Add more clarification about compress (#60268)
- Add note on how to disable Next.js compression, to use a different
algorithm.

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-05 14:54:02 +00:00
Delba de Oliveira
052006b4d7
docs: Clarify useSearchParams behavior (#60257)
- `useSearchParams` opts the client component subtree out of static
rendering (pre-rendering), not dynamic rendering. We recommend wrapping
the component that uses `useSearchParams` in a Suspense boundary to
allow client components above it to be statically rendered (part of the
initial HTML).

Closes: https://vercel.slack.com/archives/C03S9JCH2Q5/p1704398859737719
2024-01-05 07:58:55 -06:00
Delba de Oliveira
7faf4bd56e
docs: Update compression docs (#60264) 2024-01-05 07:47:30 -06:00
Stephanie Dietz
694bd3e21d
docs: Add "Going to production" page for App Router (#59304)
- Add **Going to Prod** docs for `app`
- Add bundle-analyzer page
- Merge `app` and `pages` docs

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
Co-authored-by: Delba de Oliveira <delbabrown@gmail.com>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-05 07:46:00 -06:00
Tim Neutkens
ae09d7e6c3
Add writeImagesManifest (#60209)
## What?

Moves images-manifest.json related code to a separate function `writeImagesManifest`

<!-- 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-1979
2024-01-05 09:51:49 +01:00
Andrew Clark
8ae1167c53
[PPR Nav] Fix: Page data should always be applied (#60242)
This fixes a case in the PPR navigations implementation where page data
was not being applied.

During a navigation, we compare the route trees of the old and new pages
to determine which layouts are shared. If the segment keys of two
layouts are the same, they are reused.

However, the server doesn't bother to assign segment keys to the leaf
segments (which we refer to as "page" segments) because they are never
part of a shared layout. It assigns all of them a special constant
(`__PAGE__`).

In the PPR implementation, I overlooked this and compared the segment
keys of all segments, including pages, not just shared layouts. So if
the only thing that changed during a navigation was the page data, and
not any parent layout, the client would fail to apply the navigation.

The fix is to add a special case for page segments before comparing
nested layouts. I also moved an existing special case for default pages,
since those are also leaf segments and are conceptually similar.
2024-01-04 18:33:43 -05:00