Commit graph

19000 commits

Author SHA1 Message Date
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
vercel-release-bot
da2e56ae97 v14.0.5-canary.39 2024-01-04 23:22:34 +00:00
Alexander Savelyev
269020a028
Disable 2mb limit for custom incrementalCacheHandler (#59976)
### Fixing a bug

### What?

Disable 2MB limit for custom incrementalCacheHandler

### Why?

The limit is necessary because `FetchCache` has a 2MB limit, but it
seems there was a miscommunication regarding the key coincidence, where
`fetchCache` is a flag indicating that the method is called from fetch,
rather than indicating that the `FetchCache` Provider is currently being
used.

We do not use Vercel, and as I understand it, we do not have the
opportunity to use this functionality.

In any case, it is more important for us to increase the limits, and in
some cases, using a file storage is even preferable.

### How?

I have created a flag that determines whether the use of `FetchCache` is
possible at least in theory - if no custom provider is passed, and
additionally configured it so that it is not an implementation of
`FetchCache` as a protection against special individuals (*like me :)*).

If everything is fine, I will write proper tests.

Also, I would like to recommend making `FileSystemCache` public (_i.e.
support it as public functionality_) so that it can be imported and
extended or simply used to fix only it.

Fixes #48324 (partially)

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-04 15:12:43 -08:00
Steven
fbd5e9184e
fix(docs): add missing docs on external packages (#60244)
In the future, we should make this automatically fetch the json
2024-01-04 14:45:04 -08:00
Steven
a7be8eac47
fix: add node-web-audio-api to server-external-packages.json (#60243)
This package contains native `.node` files that cannot be bundled

Closes NEXT-1974
2024-01-04 22:36:59 +00:00
Tim Neutkens
335ff1cea9
Remove NEXT_TURBO_FILTER_PAGES internal variable (#60217)
## What?

This is currently unused and we'll want to cover it in a different way
when we start working on Turbopack builds.

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

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-04 21:08:09 +00:00
Shumak Manohar
b09cda608c
docs: better TS friendly example for useFormState (#60222) 2024-01-04 14:25:03 -06:00
Steven
d0af6b4c29
chore: test against latest sharp (#60226)
This test was changed in https://github.com/vercel/next.js/pull/59074
because the latest sharp stopped working with yarn. However, we can
update these tests to use npm instead and continue testing the latest
sharp.
 
Closes NEXT-1986

Closes #57007
2024-01-04 14:45:52 -05:00
Aleksandr Kondrashov
6456eb9b6a
Docs: Fix revalidate type annotation (#60230)
<!-- 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 #

-->
Fixes #60224

This fix addresses the linked issue by removing mentions of incompatible
values for the `revalidate` option from the documentation.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-04 19:29:19 +00:00
Thomas Knickman
9e2935b05c
fix(generators): update errors gen (#60233)
### What?

Errors were updated to MDX as part of
https://github.com/vercel/next.js/pull/52038, and as a part of this, the
`errors/manifest.json` file was removed.

This PR did not update the generators used to create new errors, causing
the error gen to...error 😄

This fixes the generator.
2024-01-04 20:22:21 +01:00
Tim Neutkens
406a861c3d
Ensure appPathsManifest variable is inside if block (#60210)
## What?

I noticed that this variable is only used to write the manifest to disk so it doesn't have to be kept around in the function scope.

<!-- 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-1980
2024-01-04 19:02:57 +01:00
Hugh Do
51d6c64c39
docs: fix typos and broken links in the image.mdx (#60221)
### Overview

- Fixed some typos and broken MDN links
- Executed `pnpm prettier-fix`

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-01-04 17:33:58 +00:00
k-taro56
91dba7d125
Fix: Throw an error for empty array return in generateStaticParams with output:export (#57053)
Fixes #57038

# What?
Added an error message when `generateStaticParams` returns an empty
array with `output:export`.

# Why?
To provide developers with clear feedback when `generateStaticParams` is
not used correctly.

# How?
Modified the condition checks around the use of `generateStaticParams`
to include a check for an empty array and added a corresponding error
message.

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-01-04 11:45:02 -05:00
Zack Tanner
aa48b65f9a
log a dev warning when a missing parallel slot results in a 404 (#60186)
### What & Why?
When visiting a route that attempts to render a slot with no page & no default, the fallback behavior is to trigger a 404. However this can lead to a confusing development experience for complex parallel routing cases as you might not realize a default is missing, or which slot is causing the error.

Previous issues where this caused confusion:
- https://github.com/vercel/next.js/issues/51805
- https://github.com/vercel/next.js/issues/49569


### How?
This is a dev-only modification to track parallel slots that are using the default fallback (aka missing). When the `NotFoundBoundary` is triggered in development mode, this will log a warning about why it 404ed, along with a list of slot(s) that were determined to be missing.

![CleanShot 2024-01-03 at 14 34 30@2x](https://github.com/vercel/next.js/assets/1939140/1a00ea49-24b6-4ba0-9bac-8773c7e10a75)

### Future
We should eventually lift this into some sort of dev-only UI to help catch it when not monitoring the browser console (similar to the error overlay). However, this will require some design thought and isn't necessary for the first iteration.

Closes NEXT-1798
2024-01-04 07:56:20 -08:00
Donny/강동윤
1216422454
fix: Mark file as ESM if it has an export from auto-cjs pass (#60216)
### What?

Improve `auto-cjs` pass to consider `export` statements.

### Why?

The previous code caused some problems.

### How?

Fixes #60197


Closes PACK-2195

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-01-04 16:24:27 +01:00
Seth Bertalotto
b03381c432
docs(trailingSlashes): add note for SSG generation (#57628)
When trying to generate my SSG docs site I couldn't figure out why the
navigation links (`href="/about`) were not mapping to the generated
files (e.g. `/out/about.html)`.

`trailingSlash` was key to converting the files to
`/out/about/index.html` to make the SSG links work properly.

I've updated the trailingSlash docs to be clear how they affect SSG
mode.

It might also make sense to add this to the SSG guide as well.

Co-authored-by: Steven <steven@ceriously.com>
2024-01-04 15:01:55 +00:00
Tim Neutkens
3fd3d5d4b5
Add writeFullyStaticExport (#60200)
## What?

Moves the code for `output: 'export'` to a separate function.

<!-- 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-1976
2024-01-04 15:53:37 +01:00
Michał Dudak
6f9df4a0ac
Allow undefined environment variables in config (#58247)
<!-- 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 #

-->

This PR loosens the config schema to allow undefined environment
variables (for cases where they are defined only on certain
environments). Both the Zod schema and TS interface were updated.

Fixes #57755

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-01-04 15:52:49 +01:00
Hichem Fantar
5fde19b6d9
fix responsiveness in starter templates (#60140)
Fixes #60139
2024-01-04 14:28:10 +00:00
Tim Neutkens
2916042fca
Change server actions cache default to no-store (#60170)
## What?


Currently there is a bug in Server Actions when you `fetch` as it uses
the same defaults (caching when not specified) as rendering, this causes
some issues as you want to read your writes in Server Actions.

This change adds the `no-store` default for Server Actions, you can
still override it by specifying `cache: 'force-cache'` for example, but
it defaults to `cache: 'no-store'`.

Fixes NEXT-1926

<!-- 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: Zack Tanner <zacktanner@gmail.com>
2024-01-04 14:01:50 +01:00