Commit graph

2224 commits

Author SHA1 Message Date
Delba de Oliveira
2d4dbcdfcb
Docs: Add note about calling redirect after try/catch (#61138)
Closes: https://github.com/vercel/next.js/issues/60448
2024-01-25 13:39:39 -06:00
Lee Robinson
d7ff67de67
docs: Combine Pages/App authentication docs (#60848)
Co-authored-by: StephDietz <steph.dietz@vercel.com>
Co-authored-by: Stephanie Dietz <49788645+StephDietz@users.noreply.github.com>
2024-01-25 13:32:02 -06:00
Junior Yono
32212d60fa
Fixed typo in docs (#61118)
Co-authored-by: Steven <steven@ceriously.com>
2024-01-25 09:35:53 -05:00
Delba de Oliveira
9a808e602e
Docs: Update wording on opting out of the Router Cache (#61123) 2024-01-25 00:40:43 -06:00
sogoagain
0cdc927e0f
Docs: Correct JavaScript React Component File Extension to .jsx in '01-vitest.mdx' (#61087)
Hello,

This PR resolves a file extension inconsistency in the 'Setting up
Vitest with Next.js' section of the Next.js documentation
(`01-vitest.mdx`).

When using next.js with JavaScript, following the
documentation(`01-vitest.mdx`) leads to issues during testing because of
the jsx extension.

This PR corrects an example code that wrongly uses a '.js' extension for
a React component, which is against Vitest's requirement for '.jsx'
extensions.
  - https://github.com/vitest-dev/vitest/issues/1564

Thank you.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-24 16:10:54 -08:00
Ian Jones
52ba486253
Fix <AppOnly> typo in docs (#61103) 2024-01-24 13:34:57 -06:00
Delba de Oliveira
2eaaad2d16
Docs: Share Redirecting docs with /pages (#61083)
- Share new **Redirecting** docs with /pages
- Add equivalent example for API routes in /pages
2024-01-24 08:23:38 -06:00
Josh Story
b5772b859a
Dynamic APIs (#60645)
formalizes the concept of dynamic APIs inside Next to allow for varying
semantics beyond just staticGenerationBailout.

### Dynamic APIs

#### `markCurrentScopeAsDynamic`
useful to bail out of default caching semantics but does not imply a
Request specific data source was read. critically, this semantic is
ignored if you are inside a cache scope

#### `trackDynamicDataAccessed`
Must be called before reading any data source that is derived from
Request specific data. Currently this is `cookies()`, `headers()`, and
`searchParams`. This kind of data access inside a cache scope is
forbidden (it always should have been, but now it will error).

#### `trackDynamicFetch`
This one is unideal but the complexity of patch-fetch's current
implementation necessitates it for now. Essentially it will postpone if
we are prerendering. Long term this should be eliminated with a refactor
of patch fetch.


### Other Improvements
Also removes the `staticGenerationBailout` implementation as it has been
replaced with more specific logic in the places it was previously being
used.

One area that has also been enhanced is the proxy for app-route modules.
Previously we proxied the Request every time however when we are doing
non-static generation executions we generally don't want the overhead of
wrapping the request. In the refactor here I also improved the runtime
performance by using static proxy handlers and I believe I also fixed a
few bugs related to `clone` and `url`

In general there has been a bit of refactoring to clarify how we should
handle various render/execution states and a reduction in implicit side
effects for proper execution.

Another callout to notice is that app-route modules do not attempt a
static generation if they are force-dynamic regardless of the PPR
setting. Previously the PPR setting would opt them into this code path
which is not necessary because PPR itself does not work for routes, only
pages.

Closes NEXT-2099
2024-01-23 16:06:12 -08:00
Delba de Oliveira
142584cb59
docs: Address community feedback (#60960)
Closes: 

- https://github.com/vercel/next.js/issues/60953
- https://github.com/vercel/next.js/issues/60755

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-22 19:19:34 -06:00
Lee Robinson
524f4c8178
docs: clarify nginx buffering disable (#61010)
https://github.com/vercel/next.js/pull/60943#issuecomment-1904413114
2024-01-22 19:09:30 -06:00
Mike Timmerman
6b88dc55ae
Update code example on 01-pages-and-layouts.mdx (#60963)
Use nullish coalescing operator in all getLayout examples on
documentation page

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-22 20:00:46 +00:00
Delba de Oliveira
7181d46f7f
docs: Add link to bloom filter example (#60987) 2024-01-22 13:56:11 -06:00
Mike Dyer
c754d9fb6e
update edge and nodejs runtime doc (#60801)
<!-- 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?
Update the edge-and-nodejs-runtime doc with a Good to Know about a
common build error involving using packages that rely on the filesystem
in an edge runtime environment.

### Why?
The docs don't mention the issue. Most github issues, articles, and SO
answers revolve around updating the next.config with a webpack key to
ignore 'fs' imports in api routes and getServerSideProps functions. This
is incorrect when the issue is using packages that rely on 'fs',
'stream', or 'path' in an edge runtime environment. Silly mistake, but
it costs people time.

### How?
Update the docs. 

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-22 13:24:16 +00:00
Prachi Sharma
9cce76ac64
docs: updated the getStaticProps function name (#60949)
Fix: function name getStaticPaths is written in getStaticProps function,
issue exist in get-static-props.mdx under pages/api-reference/functions
folder. This issue was pushed as part of -
Pull Request: 55205
Commit Id: 80fba152f2add326a1520ffd2b530d00c75983f6


![image](https://github.com/vercel/next.js/assets/55828197/90923d4e-9d7b-4bc3-aaf9-7f5ce377410e)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-21 21:11:20 +00:00
Jason
6f39461f8a
docs: Update userScalable property in viewport object and user-scalable in meta tag (#60946) 2024-01-21 14:00:00 -06:00
Lee Robinson
5e80715040
docs: streaming while self-hosting must disable buffering (#60943)
Closes https://github.com/vercel/next.js/issues/54667
2024-01-21 10:52:03 -06:00
Jason
39589ff350
docs: Improves generateViewport documentation (#60396) 2024-01-20 21:11:05 -06:00
Ahmed Abdelbaset
e4172ea373
docs: mention missing optimized by default packages in optimizePackageImports (#60058)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-20 20:54:20 -06:00
Ziya Fenn
499fd9302a
docs: clarify redirects behavior with pages router (#60610)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-20 20:47:14 -06:00
Lee Robinson
40e2c4623e
docs: small tweak to videos (#60904) 2024-01-19 16:01:50 -06:00
Lee Robinson
ae46eb8835
docs: small tweaks on video docs (#60902)
https://nextjs.org/docs/app/building-your-application/optimizing/videos
2024-01-19 15:28:30 -06:00
Stephanie Dietz
4a74492196
Add documentation page on video optimization (#60574)
I've added a new page to the Next.js docs about optimizing videos. It
covers:

- the native video and iframe tag
- displaying externally hosted videos (i.e. from youtube) 
- self hosting strategies and best practices 
- Video optimization techniques

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Josh Lubawy <jlubawy@gmail.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2024-01-19 13:09:48 -06:00
Liam Laverty
adae5f2cdf
Adds a link to CSP where it's first referenced in the headers docs (#60871)
### What?
Adds a link to CSP documentation the first time it's mentioned in the
headers page here:
https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy

### Why?
Convenience for users, as it's unclear at that point in the document
that `CSP` is discussing `Content-Security-Policy`, and the first
reference to its docs are at the end of the page.

### How?
Added a link to the CSP doc here
https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy
2024-01-19 18:38:33 +00:00
Victor Eke
2de7f953b1
correct description of skipMiddlewareUrlNormalize in advanced middleware flags (#60841)
I think there's some form of typographical error in the
`skipMiddlewareUrlNormalize` line under the advanced middleware flags
section of the docs.

This is the line from the docs [Source
link](https://nextjs.org/docs/app/building-your-application/routing/middleware#advanced-middleware-flags):

> `skipMiddlewareUrlNormalize` allows disabling the URL normalizing
Next.js does to make handling direct visits and client-transitions the
same. There are some advanced cases where you need full control using
the original URL which this unlocks.

Corrected to:

> `skipMiddlewareUrlNormalize` allows disabling URL normalizing in
Next.js to make handling direct visits and client-transitions the same.
There are some advanced cases where you need full control using the
original URL which this unlocks.


<!-- 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-01-19 06:06:42 +00:00
Delba de Oliveira
cb42417985
Docs: Update parallel routes docs, add default.js pt 1. (#60806) 2024-01-18 17:57:54 -06:00
Lee Robinson
ecbc36cdd2
Fix error from the auth docs. (#60829) 2024-01-18 10:24:39 -06:00
Delba de Oliveira
54f73a218e
Docs: Use JS comment for MDX (#60825)
Co-authored-by: Stephanie Dietz <49788645+StephDietz@users.noreply.github.com>
2024-01-18 09:56:53 -06:00
Steven
afcafcdd29
chore(docs): fix example documentation for Art Direction (#60823)
This PR fixes a few typos in the docs from
https://github.com/vercel/next.js/pull/60739
2024-01-18 09:31:00 -06:00
Stephanie Dietz
65fce8aa6b
add authentication docs page (#60388)
I've updated the Next.js documentation to include a new page covering
the best practices for implementing authentication. This doc covers the
essential concepts of authentication in Next.js, focusing on practical
strategies, effective session management, and robust authorization
techniques.

Key aspects of the update:

- Core Authentication Concepts: Introduced foundational concepts of
authentication, detailing their relevance and application in Next.js
projects.
- Diverse Authentication Strategies: Expanded on various authentication
strategies, providing insights on when and how to use them effectively
in different scenarios.
- Implementing Authentication in Next.js: Guided through the
implementation process, illustrating the use of middleware, server
actions, and route handlers to create a secure and user-friendly
authentication system.
- Session Management Techniques: Discussed different approaches to
session management, highlighting their pros and cons to aid in choosing
the most suitable method for specific project needs.
- Securing Application Access: Detailed how to protect routes and manage
user permissions, ensuring that access is granted appropriately based on
user roles and authentication status.
- Next.js Compatible Solutions: Included references to several
compatible authentication solutions for Next.js, facilitating easy
integration and setup.

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-18 15:21:56 +01:00
Steven
4b50313fd9
feat: stabilize unstable_getImgProps() => getImageProps() (#60739)
This PR renames `unstable_getImgProps` to `getImageProps()` (originally
introduced in PR #51205).

Most feedback [after
announcing](https://twitter.com/leeerob/status/1674250190432116736)
looks positive so it seems like we can safely stabilize this API now.
Its unlikely to change.

I also added documentation with example usage.

Closes NEXT-2120
Fixes https://github.com/vercel/next.js/issues/56009
2024-01-17 18:28:49 -05:00
Lee Robinson
16dcebe792
Stabilize custom cache handlers and changing memory size. (#57953)
This PR stabilizes the previously introduced experimental config options
for providing a custom cache handler (for both ISR as well as the Data
Cache) and for disabling or configuring the in-memory cache size. The
example usage would be as follows:

```js
// next.config.js
module.exports = {
  cacheHandler: require.resolve('./cache-handler.js'),
  cacheMaxMemorySize: 0 // disable default in-memory caching
}
```

This PR also updates the documentation to better reflect how to use the
custom cache handler when self-hosting. Further information will be
added in a following PR that also includes a full example of a custom
cache handler that implements `revalidateTag` as well as passing in
custom cache tags. The API reference docs have been updated here, as
well as a version history added.

I also noticed that we currently have two duplicated versions of the ISR
docs in the Pages Router docs: both for rendering and for data fetching.
Data Fetching is the correct location for this page. There were no other
references to the rendering version in the docs, so that must have been
an accident. I'll need to a get a redirect going for that regardless.

Tests have been updated for `cacheHandler` and I added a new test for
`cacheMaxMemorySize`.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-01-17 23:42:52 +01:00
Dima Voytenko
0c1741c456
Telemetry code load (#60594)
The following spans are either added or displayed by default:

* `NextNodeServer.findPageComponents` - page components
resolution/require
* `NextNodeServer.getLayoutOrPageModule` - load modules (webpack or
turbopack)
2024-01-16 17:08:35 -08:00
Dima Voytenko
f604df1ca1
Telemetry: allow disabling of fetch tracing (#60588)
This would allow different apps to setup fetch instrumentation similar
to `@opentelemetry/instrumentation-http` and
`@opentelemetry/instrumentation-fetch` without duplicating fetch spans
and avoiding confusion with context propagation.
2024-01-16 16:14:22 -08:00
Steven
1886478789
chore(docs): add docs for .svg unoptimized behavior (#60735)
- Fixes https://github.com/vercel/next.js/discussions/53041

Closes NEXT-2119

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-16 15:06:42 -05:00
Bang, Jaehun
12713f8aa3
chore: remove duplicate package name (#60652)
Co-authored-by: Steven <steven@ceriously.com>
2024-01-15 14:26:31 -05:00
Brandon Norsworthy
f85d3af12d
Fix Typo in Testing Documentation Description (#60601)
just a small typo I caught, lists 4 testing tools but says three in the
description

first contribution :)
<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-01-15 01:33:12 +00:00
Lee Robinson
126c7f2429
docs: remove Next 13 mention for App Router (#60632) 2024-01-14 11:33:37 -06:00
JJ Kasper
57526b23d0
Add documentation for client router filter (#60585)
This adds documentation around the client router filter we leverage in
`pages` to allow incremental migration from `pages` to `app`. Also adds
mention of two experimental configs that can be useful for managing the
client router filter.

x-ref:
https://github.com/vercel/next.js/issues/47486#issuecomment-1889623898

Closes NEXT-2090

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-12 13:37:57 -08:00
Willem-Jaap
756027bf10
fix(mdx): update word order, fix typo (#60466)
Reverse directory order to indicate that `src/` or the parent of `app/`
should be used.
At first I thought the correct place was the parent folder of `src/`,
this eliminates that confusion
2024-01-12 21:16:45 +00:00
Ahmed Abdelbaset
d16ff74a3b
docs: small fix in Redirecting page (#60583)
ref: #60435
2024-01-12 15:08:41 -06:00
Delba de Oliveira
4640ed0604
docs: Add redirecting page in the Routing section (#60435)
New page outlining all options for handling redirects in Next.js, from
the simplest use cases (e.g. `redirect()` in a Server Action), to more
advanced cases (e.g. bloom filters and middleware).

- [x] `redirect`
- [x] `permanentRedirect`
- [x] `useRouter`
- [x] `next.config.js`
- [x] Middleware
- [x] Handling redirects at scale
  - [x] Edge config
  - [x] Bloom filter

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-12 08:50:30 -06:00
Tim Neutkens
10e8f4d437
Enable windowHistorySupport by default (#60557)
## What?

Enables `experimental.windowHistorySupport` by default. It has been in
experimental for quite a while now and has been successfully dogfooded
in vercel.com as well.

<!-- 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-2076
Closes NEXT-1773
2024-01-12 14:18:43 +01:00
Jacob Smith
e07161a563
chore(docs): correct subject-verb conjugation in Client Components doc (#60538) 2024-01-11 22:03:52 +00:00
Ahmed Abdelbaset
f61a305761
docs: correct windowHistorySupport title (#60503)
ref: #60374
2024-01-10 22:47:14 -06:00
Delba de Oliveira
496e38c844
Docs: Document windowHistorySupport flag, and add pushState/replaceState examples (#60374) 2024-01-10 20:59:09 -06:00
808vita
d08e891ea6
for #59178 - addition to robots.mdx - Customize user-agent rules (#60361)
Addition to docs (robots.mdx) - Customize user-agent rules 

For issue #59178
Docs: Guidance on allowing multiple user agent rules with varying
allow/disallow.

<!-- 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: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Sam Ko <sam@vercel.com>
Co-authored-by: Delba de Oliveira <delbabrown@gmail.com>
2024-01-10 18:50:28 +00:00
Delba de Oliveira
8f7637c8d6
Docs: Address Community Feedback (#60476)
Closes: 

- https://github.com/vercel/feedback/issues/51569
- https://github.com/vercel/feedback/issues/51578
2024-01-10 12:05:14 -06:00
Clarence
60c07208dd
chore(docs/errors): Improve documentation grammar (#60452)
This PR fixes a couple of typos found in the docs/errors section

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-01-10 16:48:29 +00:00
Steven
3aed59c2b9
chore(docs): fix 14 upgrade guide mentioning export (#60429)
This was actually deprecated in a previous version 13.x and removed in
Next.js 14.0.0

- See original PR: https://github.com/vercel/next.js/pull/57085
2024-01-09 11:10:35 -08:00
Delba de Oliveira
0a34e047ea
Docs: Update note on @next/third-parties being experimental (#60372)
At the moment, `@next/third-parties` is only working on canary. This can
be a blocker for those trying it out on `latest`. This updates the
experimental note to recommend installing canary.

The note should be removed once the package is stable.  

Closes: https://github.com/vercel/feedback/issues/51035
2024-01-08 11:22:31 -08: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
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
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
Lee Robinson
a5ae1a6653
docs: Add docs for next dev --experimental-https (#60357) 2024-01-07 11:32:27 -06: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
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
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
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
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
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
Shumak Manohar
b09cda608c
docs: better TS friendly example for useFormState (#60222) 2024-01-04 14:25:03 -06: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
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
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
Aditya K
28fdc367b1
[Docs] small correction in 11-middleware.mdx (#60189)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

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

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?
A tiny correction could be made in an example in the Middleware usage
example.

### Why?
N/A

### How?
1. Verified that the actual cookie returned in the response headers
matches this.
2. Fixed the example
3. Ran `pnpm prettier-fix`

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-03 23:43:55 +00:00
Caleb Barnes
4865acc257
docs: Fix typo on generate-sitemaps.mdx (#60188)
### Improving Documentation
Fix typo for the function `generateSitemaps`. 

It had incorrect casing: `generateSiteMaps` in the docs page.
2024-01-03 22:30:41 +00:00
Alexander Fradiani
6d0eef601f
Update route-segment-config.mdx (#60179)
Fixing copy in the description of the route segment config

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-03 21:34:42 +00:00
Houssein Djirdeh
0f8b079a82
[Docs] Adds a section to Optimizing: Third Party Libraries on tracking pageviews for Google Analytics (#60176)
Adds a small section to the `Optimizing: Third Party Libraries`
documentation page on tracking client-side pageviews for Google
Analytics

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-01-03 13:37:50 -05:00
siddtheone
930f82028d
Updating example with required content type in header (#59990)
<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-01-03 09:20:55 -08:00
Alex Olshansky
7bb7f53514
Fix config code in the CSS-in-JS chapter (#60164)
Just a minor typo in the example config.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-03 09:10:59 -08:00
Lee Robinson
e9fb28c6fd
docs: improve grammar (#60149) 2024-01-02 18:40:33 -06:00
akfm
5b65491dde
Docs: If revalidatePath's path has dynamic segment path, type must be page. (#59149)
fix: #59148

<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-01-02 16:30:28 -08:00
Nick Molchanov
09bde5a053
docs: small wording fix for 03-linking-and-navigating.mdx (#60089)
Probably there could be a better wording, but the current one looks
somewhat confusing.

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-02 16:18:59 -08:00
Jordane Quincy
76fa80000a
Update 03-css-in-js.mdx : fix typo (#60114)
Fix a small typo of a missing space

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-02 15:04:47 -05:00
Houssein Djirdeh
0df6fc90e8
[Docs] Clarify measurement ID in Optimizing: Third Party Libraries (#60136)
Minor changes to `Optimizing: Third Party Libraries` doc page to clarify
which type of ID for Google Analytics (and GTM)
2024-01-02 14:46:10 -05:00
Lee Robinson
ab7142a68b
docs: ⌘+Enter for forms (#60090) 2024-01-01 20:32:26 -06:00
Lee Robinson
8e3e4adfb9
docs: update maxDuration info (#60086) 2024-01-01 14:21:57 -06:00
Lee Robinson
5071fcad81
docs: clarify generateStaticParams and dynamicParams (#60083) 2024-01-01 13:00:06 -06:00
ArianHamdi
a5d87eb30a
docs: fix version history order in sitemap.mdx (#60054)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-01 12:35:16 -06:00
Lee Robinson
80f4a979d1
docs: update install count (#60072) 2023-12-31 17:18:45 -06:00
Lee Robinson
64e905132a
docs: Add section for CSP without nonces (#60067) 2023-12-31 09:28:19 -06:00
justin hook
ff45e1fc90
docs: 'userScalable' field in 'viewport' (#60033)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-31 09:28:03 -06:00
Lee Robinson
fa32e32df4
docs: clarify using redirect with client components (#60056)
Based on feedback from https://github.com/vercel/next.js/issues/54676.
2023-12-30 21:18:10 -06:00
Lee Robinson
df14fdfa25
docs: fix typo for useFormState (#60010) 2023-12-28 18:22:11 -06:00
Lee Robinson
548a07ff6b
docs: opengraph / twitter image needs absolute URL (#59985) 2023-12-27 22:48:56 -06:00
Lee Robinson
9e37c327a4
docs: small changes to linking docs (#59982) 2023-12-27 22:48:21 -06:00
Shreyans Jain
5f2d7b691f
docs: add note that contentlayer is unmaintained (#59927)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-27 11:09:38 -06:00
Jordy van den Aardweg
f8ba588ce4
docs: Update Middleware docs on ignoring prefetches (#56799)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-27 11:02:01 -06:00
Shahriar
332bf6d4f8
docs: remove incorrect async components in parallel routes docs (#59966)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-27 10:45:14 -06:00
Manu
02d390740b
docs: fix link to formEntries (#59935) 2023-12-27 10:42:17 -06:00
ash2048
6a23987282
docs: Fix typo in generate-sitemaps.mdx docs (#59964) 2023-12-27 10:40:51 -06:00
Michael H
eebad9c939
docs: Add media example for icon metadata (#56141)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-25 09:19:33 -06:00
Jiachi Liu
365a0492d0
docs: fix prettier lint (#59918)
x-ref:
https://github.com/vercel/next.js/actions/runs/7315608759/job/19929482613

Closes NEXT-1928
2023-12-24 22:06:28 +01:00
Igor Varyvoda
d4b7c86ecf
docs: add Sirv loader for next/image (#57102)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-24 10:03:50 -06:00
Lee Robinson
142e7080a5
docs: clarify setting and reading cookies from Route Handlers (#59915)
Replaces https://github.com/vercel/next.js/pull/57052
2023-12-24 10:02:50 -06:00
vinay
3b64a53e59
docs: remove old links for examples (#57891)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-24 09:47:16 -06:00
Harits Syah
768d2174eb
docs: add type to import statement (#57701) 2023-12-24 09:42:43 -06:00
vinay
ee4ff03828
docs: Add sensible name for cookie deleting functions (#57893) 2023-12-24 09:40:59 -06:00
Ahmed Abdelbaset
500a3f8f00
docs: fix typo (#59897) 2023-12-24 09:11:46 -06:00
Nate Moore
2336274a2e
docs: Add cwd to VSCode debugging setup steps (#58689) 2023-12-22 16:26:04 -06:00
Ryo Matsukawa
7a18e6da37
docs: Rename React Query to TanStack Query (#59004) 2023-12-22 16:25:14 -06:00
Remco Haszing
34a5ef2189
docs: Mention remark-mdx-frontmatter in frontmatter docs (#59238) 2023-12-22 16:23:28 -06:00
Lisa Ferguson
b57a2c809d
docs: fix TS code snippet for MDX example (#57988) 2023-12-22 16:22:46 -06:00
Michael Novotny
f999d639b0
docs: Updates references for styled-components configuration in next.config.js (#59495) 2023-12-22 16:21:41 -06:00
Steven Kamwaza
19dac217b6
docs: fix not-found file paths (#59478) 2023-12-22 16:18:27 -06:00
Yeseul, Kim
c7b2422046
docs: Add Chakra UI setup guide (#59275) 2023-12-22 16:16:27 -06:00
Loris Sigrist
19eea58d69
docs: Remove typesafe-i18n from third-party i18n options (#59624) 2023-12-22 16:14:25 -06:00
James Burgess
1529b50af6
docs: correct type in sitemap.mdx (#59787) 2023-12-22 16:09:59 -06:00
Rajdeep singh
3e26253c31
docs: add version history for unstable_cache (#59799) 2023-12-22 16:09:32 -06:00
minaelee
a3fb38a475
docs: Minor grammar edits (#59887)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-22 16:08:33 -06:00
minaelee
2d50879f0f
docs: fix run-on and definition of trailing slash redirect (#59889) 2023-12-22 16:05:23 -06:00
James Burgess
ead2a7eb70
docs: add missing comma to sitemap.mdx (#59788)
<!-- 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 #

-->
The example is not valid TS because of this missing comma.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-12-20 09:43:40 +00:00
Sakib Hossain
3b72c52176
docs: change 'themeColor' to 'viewport' in the viewport section (#59764) 2023-12-19 22:12:40 -06:00
Lee Robinson
29fcd57ed1
docs: clarify data fetching pattern (#59602)
You don't fetch data with Server Actions, but mutate.
2023-12-19 20:24:21 -06:00
Usman S. (Max Programming)
2caf1882d9
Change file extension to .tsx (#59763)
Changes the file extension from `.ts` to `.tsx` in these 2 places


![image](https://github.com/vercel/next.js/assets/51731966/b91654cf-290c-4aa8-bf90-41e266bf0bc4)

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
2023-12-19 19:10:15 +00:00
Houssein Djirdeh
25e0988e7c
[Docs] Includes section to @next/third-parties documentation for Google Analytics (#59671) 2023-12-19 16:05:02 +01:00
Jordan Newland
10a4ffcc10
docs: fix grammar issue in 03-get-server-side-props.mdx (#59670)
Hey Next.js Maintainers, 👋🏻

Quick PR to address a minor grammar error in the Pages docs.

Closes #59669

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:44:52 -08:00
Ahmed Abdelbaset
3e6edbf850
docs: fix vitest example link in testing with vitest (#59659)
This PR fixes a wrong link introduced in #59268

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:42:10 -08:00
David Agbenyega
1c3e305876
Docs: Review and Typo Fix - getServerSideProps (#59616)
<!-- 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: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:30:18 -08:00
Lee Robinson
1c65c55750
docs: improve docs around geolocation and IP headers (#59719)
Based on feedback from https://github.com/vercel/next.js/issues/47793, I
made some improvements around the geolocation docs. Specifically around
`request.ip`, `request.geo`, and how to access these values. I noticed
there was a bit of a divergence, as some of the `NextRequest` and
`NextResponse` docs were split out for the App Router section, but not
all.

This PR finishes that swing by removing the previous catch-all for
`next/server` in the Pages Router docs and splits them into individual
docs pages.

Wrote a lil' thread about this:
https://twitter.com/leeerob/status/1736543599339172121

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-12-18 07:55:48 -06:00
Delba de Oliveira
e3c2552514
Docs: Polish testing section (#59618) 2023-12-18 07:29:47 -06:00
Delba de Oliveira
ee425d4cb2
Docs: Document generateSitemaps (#59626) 2023-12-18 13:40:56 +01:00
Lee Robinson
64d539fc50
docs: fix broken backtick for link (#59717)
<img width="764" alt="CleanShot 2023-12-17 at 11 25 10@2x"
src="https://github.com/vercel/next.js/assets/9113740/437a8a0d-0f56-4199-9629-b767569349de">
2023-12-17 09:53:59 -08:00
Lee Robinson
565c5b20b0
docs: small tweaks (#59638)
Just some random cleanup I wanted to do.
2023-12-16 14:13:17 -06:00
Kenji
7faaeeb9b0
docs: updates WCAG version to 2.2 (#59646) 2023-12-15 07:02:34 -06:00
Shohei Maeda
6b3d145e7e
docs: add note for environment variables on Vercel deployment (#59237)
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-12-14 15:33:41 +01:00
Delba de Oliveira
d2fd8f77ea
Docs: Review and update getServerSideProps page (#59545)
- Remove recommendation for client-side rendering
- Cut repetition 
- Improve tone
2023-12-13 20:42:28 -06:00
Delba de Oliveira
7234502406
Docs: Add missing closing tag (#59581) 2023-12-13 07:10:14 -08:00
Delba de Oliveira
f518fd81b3
Docs: Fix formatting in testing docs and update examples dependencies (#59572)
Follow-up from: https://github.com/vercel/next.js/pull/59268
2023-12-13 07:02:53 -08:00
Tim Neutkens
55645ffc8a
Fix closing tags for jest docs (#59579) 2023-12-13 15:51:17 +01:00
Jiachi Liu
f1143bc4f4
docs: fix bad closed tag (#59575)
Found this from build error trace while testing the change in #59569 

```
docs/02-app/01-building-your-application/08-testing/02-jest.mdx": UnexpectedMDXError: Error: Build failed with 1 error:
--
  _mdx_bundler_entry_point-776983b1-6900-47c0-98cc-0c35882e9532.mdx:297:0: ERROR: [plugin: @mdx-js/esbuild] Unexpected closing tag `</PageOnly>`, expected corresponding closing tag for `<PagesOnly>
```



Closes NEXT-1863
2023-12-13 15:30:24 +01:00
Delba de Oliveira
0ddc7e8fad
Docs: Add App Router Testing Guides and update /examples (#59268)
This PR updates the testing guides to use App Router and TypeScript,
also updates `/examples` to show `app` and `pages` examples.

## Overview

- [x] Create a new "Testing" section that is shared between `app` and
`pages`.
- [x] Explain the differences between E2E, unit testing, component
testing, etc.
- [x] Recommend E2E for `async` components as currently none of the
tools support it.
- [x] Update setup guides for **Cypress**, **Playwright**, and **Jest**
with latest config options, and examples for `app` and `pages`.
- [x] Add new guide for **Vitest**
- [x] Clean up `/examples`: use TS, show `app` and `pages` examples,
match docs config

## Cypress

- [x] E2E Tests
- [x] Component Testing
  - [x] Client Components
  - [x] Server Components
  - [ ] `async` components

**Blockers:** 
- TS: `Option 'bundler' can only be used when 'module' is set to
'es2015' or later`. In **tsconfig.json** compilerOptions, Next.js uses
"moduleResolution": "bundler", changing it to "node" fixes the issue but
it can have repercussions.
  - https://github.com/cypress-io/cypress/issues/27731 
- Version 14 is currently not supported for component testing
  - https://github.com/cypress-io/cypress/issues/28185

## Playwright

- [x] E2E Tests

## Jest

- [x] Unit Testing
   - [x] Client Components
   - [x] Server Components
- [ ] `async` components:
https://github.com/testing-library/react-testing-library/issues/1209
   - [x]  'server-only': https://github.com/vercel/next.js/pull/54891
- [x] Snapshot Testing

**Blockers:**
- TS: https://github.com/testing-library/jest-dom/issues/546
- None of the solutions in the issue work with Next.js v14.0.4 and TS v5

## Vitest 

- [x] Unit Testing
  - [x] Client Components
  - [x] Server Components
  - [ ] `async` components
  - [x] 'server-only'
 - [x] Update vitest example
- [x] Handles CSS, and CSS modules imports
- [x] Handles next/image

## Other

- https://github.com/vercel/next.js/issues/47448
- https://github.com/vercel/next.js/issues/47299
2023-12-12 22:30:23 -06:00
akawalsky
6fbff29a2e
allow passing wildcard domains in serverActions.allowedDomains (#59428)
Implementation of feature request opened here -
https://github.com/vercel/next.js/discussions/59427

Approach:

~~We are using micromatch in the csrf protection step of actionHandler
to allow for wildcard domains passed in allowedDomains. This is the same
library used for matching domains for remote images.~~

If any of the allowed domains match the origin of the request, we skip
the downstream error thrown for csrf protection.

Edit:

Micromatch is not available in this context as it is only compatible
with Node. This codepath can be run from the edge, so we need to rely on
vanilla js compatible code only.

Instead of falling back to allowing the user to pass in a regex, which
can be somewhat insecure, we opt into continuing to use a wildcard
pattern from a configuration standpoint and instead use a simple
function that matches on wildcards using string comparison and
iteration.

Ideally, Micromatch can be retrofitted to work in non-Node settings and
this piece of code can be replaced in the future, without deprecating or
changing the next.config interface.

---------

Co-authored-by: Josh Story <story@hey.com>
2023-12-12 11:08:36 -08:00
Lee Robinson
c542a761d2
docs: remove broken link in webpack section (#59487) 2023-12-11 08:59:58 -06:00
Eric Bidelman
6e6533c97c
Update 10-route-handlers.mdx (#59443)
According to
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic,
the default for dynamic is "auto".

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

-->
2023-12-09 18:52:37 +00:00
Delba de Oliveira
6d82b0698b
Docs: Polish Server Actions Page 💅🏼 (#59400) 2023-12-08 14:41:16 -06:00
Delba de Oliveira
d5836a3038
Docs: Update Server Actions Docs (#59080)
- [x] Rename page from `forms-and-mutations` to
`server-actions-and-mutations` to account for examples that don't use
forms.
   - [x] Split `/pages` and `/app` content to make easier to edit 
- [x] Add Security Section
  - [x] Recommend tainting
  - [x] Closures and encryption
  - [x] Overwriting encryption keys
  - [x] CSRF protection | Allowed Origins
- [x] Add examples for Server Actions being called outside forms
  - [x] `useEffect`
  - [x] Event handlers
  - [ ] ~3rd party libraries~
- [x] More form examples
   - [x] Add note on calling actions in `<button>` and `<input> `
   - [x] Add `.bind` example | Recommend bind over hidden input field
 - [x] Recommend `try/catch` for error handling
- [x] Create `serverActions` next.config.js page 
   - [x] Document `allowedOrigins`
   - [x] Document `bodySizeLimit`
   - [x] Add note on Server Actions flag for < v14
- [x] Update error message links
- [x] Remove Server Actions from API reference as it's a React feature.
E.g. We don't have API references for Server Components.
- [ ] Set up redirects:

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: Michael Novotny <manovotny@gmail.com>
2023-12-07 15:12:25 -06:00
Zack Tanner
f431600ce4
Revert "added comma to the props list" (#59314)
Reverts vercel/next.js#58596

This is failing lint checks


[x-ref](https://github.com/vercel/next.js/actions/runs/7109843046/job/19355454595)
2023-12-05 20:39:45 -08:00
Justin Pfifer
3f20b46b59
docs: Add note about middleware and runtimes (#58873)
Co-authored-by: Justin Pfifer <justin.pfifer@carvana.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-05 21:34:37 -06:00
Peter Kellner
4a52268907
docs: Update route handles TS code snippets (#59021) 2023-12-05 21:34:19 -06:00
Thoushif Aazam Shaik
3caa2891c7
docs: added missing comma to the props list (#58596) 2023-12-05 21:33:47 -06:00
Jackie
d0159160dc
docs: update Firebase link to with-firebase example (#58621) 2023-12-05 21:33:14 -06:00
Willem-Jaap
75975dd5e4
docs: Fix incorrect prop name in client component (#58591)
`updateItem` is the name of the action, not the passed prop. The correct
property name is `myAction`.
2023-12-05 21:31:58 -06:00
Jiwon Choi
caa05b4753
docs: Remove invalid URL (#58823)
This PR removes guidance to invalid URL
2023-12-05 21:30:27 -06:00
Mustafa Çor
873bd82ff9
docs: Server Action example (#59159) 2023-12-05 21:21:56 -06:00
Lee Robinson
bb3f0a21a0
docs: fix broken link to learn course (#59288)
Addresses https://github.com/vercel/feedback/issues/47802.
2023-12-05 08:39:54 -06:00
Delba de Oliveira
63a578f1c3
Docs: Fix upgrade guide files (#59249)
- Add v14 update guide to /app router docs
- Fix duplicate /upgrading folders
2023-12-04 08:55:46 -06:00
汪磊
ba23d98611
Correcting the webpack function introduction (#58663) 2023-12-02 08:36:53 +00:00
Jiachi Liu
778fb87131
Support generating multi-meta tahs for metadata api other prop (#59106) 2023-11-30 16:44:49 +01:00
Delba de Oliveira
c1f94cfc73
Docs: Delete fast refresh example (#59003)
Closing: https://github.com/vercel/feedback/issues/47083

This example no longer exists in the Next.js repo.
2023-11-29 15:29:47 -06:00
Zack Tanner
eafaba39cb
update status codes for redirect and permanentRedirect in action handlers (#58885)
### What?
Calling `redirect` or `permanentRedirect` with a route handler used by a server action will result in that POST request following the redirect. This could result in unexpected behavior, such as re-submitting an action (in the case where the redirected URL makes use of the same server action).

### Why?
By spec, 307 and 308 status codes will attempt to reuse the original request method & body on the redirected URL.

### How?
In all cases when calling a `redirect` handler inside of an action, we'll return a `303 See Other` response which is a typical status code when redirecting to a success / confirmation page as a result of a POST/PUT.

The other option would be to use 301 / 302 status codes, but since we're already doing a 303 status code [here](https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/action-handler.ts#L603), this aligns the behavior for the route handler case. 

Closes NEXT-1733
See also: https://github.com/vercel/next.js/issues/51592#issuecomment-1810212676
[Slack x-ref](https://vercel.slack.com/archives/C03S8ED1DKM/p1700060786749079)
2023-11-29 08:35:50 +00:00
Lee Robinson
9656f15a48
docs: patch upgrade guide to pin install version (#58993)
Closes https://github.com/vercel/feedback/issues/47076.
2023-11-29 08:26:03 +00:00
Delba de Oliveira
c5acef6150
Docs: Update revalidate example (#59002)
Closing: https://github.com/vercel/feedback/issues/47084

- The example previously showed `export const revalidate` being called
from a `utils` file, whereas we want to call it from a route segment
(layout or page)
2023-11-28 11:20:05 -06:00
Delba de Oliveira
38e9bc9770
Docs: Add missing diagram (#59008)
Slack feedback. Add missing diagram, and polish wording for `layout.tsx`
explanation.
2023-11-28 11:19:05 -06:00
Jiachi Liu
31809e42f5
Polish unsupported metadata warning with doc link (#58750)
* Add docs link to the warning, add codemod link to viewport docs section
* Only log the warning once after the metadata resolving process, this will avoid multiple duplicated logs showing for one page.

Closes NEXT-1723
2023-11-23 05:42:20 +00:00
Zack Tanner
d9531c13c4
Revert "fix: fetch() behavior when "dynamic" is "force-dynamic" (#58735)
Reverts vercel/next.js#58484

The correct way to address this is to use the `fetchCache` segment: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#fetchcache

There are valid use-cases to want to force a dynamic response but still need fetch caching.

Additionally, this PR updates the docs, since they're incorrect about behavior.

[slack x-ref](https://vercel.slack.com/archives/C042LHPJ1NX/p1691623048477119?thread_ts=1691613915.257239&cid=C042LHPJ1NX)
2023-11-22 18:49:20 +00:00
Michael Novotny
493f69ffcd
[Next.js Docs] Adds useOptimistic link (#58706) 2023-11-20 21:58:49 -06:00
Lee Robinson
9d14be06d3
docs: clarify route handler caching (#58541)
We've heard confusion around Route Handlers being cached by default for
`GET`s. While we do have a section on this in the docs, I've made this
more explicit by making the examples default to dynamic, while
mentioning the defaults.
2023-11-16 21:43:41 -06:00
empflow
49e391cd2b
docs: fix naming of Route Handlers to Route Handler (#58539) 2023-11-16 21:41:40 -06:00
vivianyentran
fd0c3c63ec
docs: update installation section (#58555) 2023-11-16 21:39:18 -06:00
kentobento
7d2be4be15
docs: Fix grammar in Caching section (#58070)
This PR fixes several grammar issues in
https://nextjs.org/docs/app/building-your-application/caching.

Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-16 21:37:41 -06:00
Gonzalo Pozzo
637ead09e2
Update 04-metadata.mdx (#58535)
Update wrong link
2023-11-16 17:56:02 +00:00
Kom ॐ
d58008279f
docs: Add Jenkins build caching information (#58001) 2023-11-15 23:01:54 -06:00
Antonis Angelis
7226746051
docs: fix filename when it should be dynamic route (#58032) 2023-11-15 22:56:39 -06:00
Mojtaba
8d9282ce9d
docs: fix grammar issue in "Data Fetching Patterns" (#58056) 2023-11-15 22:55:19 -06:00
kentobento
f8343e80dd
docs: Fix grammar in Dynamic Rendering section (#58062) 2023-11-15 22:54:42 -06:00
kentobento
bdbc30f14a
docs: Fix grammar in Client Components section (#58065) 2023-11-15 22:54:21 -06:00
kentobento
1d5c78b925
docs: Fix grammar in Styling section (#58071) 2023-11-15 22:53:10 -06:00
Andreas
05374d3a0c
docs: make example of passing down a Server Action more clear (#57972) 2023-11-15 22:52:48 -06:00
Asad Khan
ee99c9f6e5
docs: fix grammar in revalidateTag docs (#58210) 2023-11-15 22:51:10 -06:00
Marcos Martini
dd4593b937
docs: Added Kinde auth provider (#58231) 2023-11-15 22:50:20 -06:00
Bryn Dyment
123f753042
docs: add missing apostrophe (#58236) 2023-11-15 22:49:43 -06:00
Robbert Stevens
6c422514f6
docs: update MDX metadata docs (#58396) 2023-11-15 22:49:16 -06:00
Asad Khan
8cc406e090
docs: simplify rendering docs (#58185) 2023-11-15 22:46:17 -06:00
Arham Khawar
e5bdc42621
docs: fix unnecessary capitalization (#58141) 2023-11-15 22:45:25 -06:00
Delba de Oliveira
4e5702c1d3
Docs: Update middleware example snippet (#58488)
Sync with example updates made here: https://github.com/vercel/next.js/issues/57410
2023-11-15 15:30:11 +00:00
Asad Khan
1eee93cc94
Update 08-parallel-routes.mdx (#58393)
Fixed Typo

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

-->
2023-11-13 17:55:28 +01:00
Lee Robinson
a01beafddd
docs: Update runtime table (#58361)
Adds a bit more clarity that while the edge runtime certainly enables
faster startups than the Node.js runtime (by being in general lighter),
it does not mean the additional user code added will not affect the boot
time. Hello world might be instant but I believe "low" better reflects
that it _will_ grow with user code added.
2023-11-12 19:28:15 -06:00
Joram van den Boezem
44ec398d4b
chore(docs): fix typo (#58344)
Fix typo in markdown link in "Environment variables" docs article

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

-->
2023-11-12 12:15:21 -06:00
YOSHIDA Junki
d1fe4d01c4
[Docs] remove example for router.events as it does not exist (#58286)
Removed router.events example from the document because it does not
exist.

URL:
https://nextjs.org/docs/pages/api-reference/functions/use-router#routerevents

<!-- 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: Lee Robinson <me@leerob.io>
2023-11-10 09:21:26 -06:00
Tim Neutkens
af2c3f71bf
Update 15-content-security-policy.mdx
Ensures the CSP header is still set on the response.
2023-11-10 14:28:43 +01:00
Tim Neutkens
20ad9ac270
Update 15-content-security-policy.mdx
Removes the passing of headers for the response.
2023-11-10 14:20:33 +01:00
Dennis Wilm
fd534fb696
Update 02-app-router-migration.mdx (#58253)
Corrected a link that linked to the wrong page. 

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

-->
2023-11-09 09:09:31 -08:00
Arseny
e2f3059b48
Add a self-hosted shared cache example (#58000)
### What?

This pull request integrates the exemplary setup for a self-hosted Next.js application utilizing Redis as a shared cache storage. The solution supports caching at both the App and Pages routers in default and standalone modes, as well as partial pre-rendering, facilitated by the [`@neshca/cache-handler`](https://github.com/caching-tools/next-shared-cache/tree/canary/packages/cache-handler) package. The package enables customizing cache handlers and replacing the default cache provided by Next.js seamlessly.

### Why?

The motivation behind this pull request is to provide an example demonstrating how Redis can be used as a shared cache in a self-hosted environment, thereby improving the scalability of hosting multiple instances of a Next.js application.
2023-11-09 14:29:11 +00:00
Lee Robinson
0cdddd419f
docs: update analytics docs for useReportWebVitals (#58196)
[This
page](https://nextjs.org/docs/app/building-your-application/optimizing/analytics)
was not yet mentioning `useReportWebVitals`.

Closes https://github.com/vercel/next.js/issues/57715.
2023-11-09 13:36:33 +01:00
Michael Novotny
5fe14c42d3
[Docs] Add PPR option to next.config.js docs (#58161)
### Description

Adds config for experimental PPR support

### Related Issue(s)/Incident

Prior art: #57444

### Best Way to Test

Visit → docs/app/api-reference/next-config-js/partial-prerendering

Co-authored-by: Amy Burns <5012825+timeyoutakeit@users.noreply.github.com>
Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-11-08 16:57:49 +00:00
Zack Tanner
d05b817e3d
fix docs link for ISR (#58207)
x-ref: https://github.com/vercel/next.js/pull/58206#issuecomment-1802174076
2023-11-08 16:31:55 +00:00
Asad Khan
b4ee33e3ec
docs: fix typo in composition patterns section (#58197) 2023-11-08 09:30:25 -06:00
Lee Robinson
cf8a733f6a
docs: mention Middleware on src directory page. (#58193)
Closes https://github.com/vercel/next.js/issues/57923.
2023-11-08 08:18:46 -06:00
Lee Robinson
36490fe27d
docs: remove note about generateMetdata (#58192)
Closes https://github.com/vercel/next.js/issues/57816.
2023-11-08 08:18:00 -06:00
Lee Robinson
24baf8fe46
docs: remove duplicate ISR page. (#58164)
https://nextjs.org/docs/pages/building-your-application/rendering/incremental-static-regeneration already correctly redirects.
2023-11-08 04:23:16 +00:00
Lee Robinson
7e368c2e1f
docs: small follow up on deployment docs. (#58158)
Small visual things and one busted link.
2023-11-07 20:13:51 -06:00
Lee Robinson
958dcbc7e3
docs: Improve deployment docs on self-hosting. (#58027)
This PR is a combination of many months of feedback from the community
on how to self-host with Next.js. It's became clear talking to many of
y'all that there is confusion about if all features are supported when
self-hosting, and what implications this has when using third-party
providers.

The deployment docs now clarify that all features are supported when
self-hosting. However, this comes with important notes. First, we're
building a standard deployment output, not adapters. We want these docs
to ensure that if you follow what's described on this page, you're going
to have a good experience with Next.js and will be able to take
advantage of all features. Previously, we had to add caveats in here
about different providers and their level of support. We are not doing
that anymore.

Instead, we're providing further details on different features and how
they can be configured when self-hosting. These docs have existed in
other locations (e.g. the specific API pages in our docs), but I've
combined and simplified them here so there's one page you need to read
to learn about all of the options. If you self-host Next.js anywhere
with a Node.js server, Docker container, or static HTML export, all of
the following features will work as expected. Further, we've added other
specifics around self-hosting ISR / Data Cache and configuring your
caching location, which is important when self-hosting with Kubernetes.

Finally, there has been a common feature request to allow runtime
environment variables, rather than statically inlining the values during
the build. While this was possible with `getServerSideProps` in the
Pages Router, if the value needed to be used on the component body, this
option didn't work, as it needed to be serialized and forwarded to the
component. With the App Router, this problem is solved, since Server
Components can render entirely on the server. Thus, when dynamically
rendering, you can just use `process.env.MY_VALUE` and it works.

I also toned down the Vercel section, because, it was a bit much TBH.

Related: https://github.com/vercel/next.js/pull/57953

---------

Co-authored-by: Ahmed Abdelbaset <A7med3bdulBaset@gmail.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-11-07 13:53:09 -06:00
gooby
9b4b0847ed
typo: changed from next/server to next/og (#58143)
### Change the `next/server` to `next/og` to support the upgrade to Next
14

- Next 14 users will experience a deprecation warning when trying to
import from `next/server`
- Not the biggest change, but it caused some confusion while reading

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

-->
2023-11-07 18:38:57 +01:00
Bryan Nguyen
67acc5ac4d
Correct prop name in server-actions.mdx (#58108)
Code snippet below line changed uses `myAction`
2023-11-06 21:54:45 +00:00
Md Rashidul Islam
7feede955f
docs: useFormState and useOptimistic are now documented (#58064)
Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-11-05 22:09:12 +00:00
Lee Robinson
100eea486a
docs: Revert part of sitemap docs change (#58010)
Revert part of https://github.com/vercel/next.js/pull/57998.
2023-11-03 18:10:16 -05:00
Yusril A
b8b1ec24a2
docs: improve non-encrypted HTTP conn to a secure (#57998) 2023-11-03 14:51:01 -05:00
Lee Robinson
53b684a795
docs: Update MDX docs title. (#57963)
To better match both keywords.
2023-11-02 19:54:49 -05:00
Chenguang Li
067ff4e978
Update 05-mdx.mdx (#57866)
One more `
2023-11-03 00:54:21 +00:00
OJ Kwon
6f8c580386
feat(turbopack): Experimental wasm build (#57906)
### What?

continuation of https://github.com/vercel/next.js/pull/57851, since it is from a remote branch that I don't have access to write.

Co-authored-by: Maia Teegarden <2865858+padmaia@users.noreply.github.com>
Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2023-11-02 21:00:54 +00:00
Lee Robinson
9658cf7aad
Move link examples to only Pages Router docs. (#57758) 2023-11-01 14:39:28 +00:00
Gal Schlezinger
f832c56a03
[docs] fix next.config.mjs using commonjs in the example (#57874)
make sure `next.config.mjs` uses `export` instead of `module.exports`
2023-11-01 14:05:38 +00:00
Alexandre Spehler
a07e0de64f
Fix Google Tag Manager URL in Third Party Libraries documentation (#57731)
## Description

Updating the URL for the Google Tag Manager in the Next.js documentation for [Third Party Libraries](https://nextjs.org/docs/pages/building-your-application/optimizing/third-party-libraries).

We were using https://developers.google.com/maps/documentation/embed/embedding-map, which redirected to the documentation for embedding Google Maps.

## Implementation

- Replacing https://developers.google.com/maps/documentation/embed/embedding-map by https://developers.google.com/tag-platform/tag-manager
2023-10-30 16:11:48 +00:00
Tarik
d88d8aed36
Typo fix, version "13" to "14" (#57723)
Typo fix
2023-10-30 00:48:12 +00:00
Joel Hooks
6a8010dbb6
examples: Add inngest next.js example (#56049)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-28 11:57:27 -05:00
Kunal Agrawal
ee9a13aaa0
docs: fix incorrect heading structure in codemods (#57605)
Fixes #57593
2023-10-27 20:54:49 -05:00
Anthony Zheng
86d3043d22
docs: Add missing apostrophe (#57626) 2023-10-27 20:53:20 -05:00
Hugo Maestá
26b71fcf9f
docs: Fix typos in third parties section (#57592) 2023-10-27 20:52:44 -05:00
Fatih Kalifa
27106a481b
Fix incorrect link in GTM docs (#57547)
Previously options and link for tag manager refers to maps embed documentation
2023-10-27 01:11:31 +00:00
Hirotomo Yamada
0bb6b56c82
docs: fix 02-dynamic-routes.mdx (#57029)
params from `{}` to `{ slug: [] }`.

Fixes #57027
2023-10-27 01:09:05 +00:00
Gonzalo Pozzo
fa100e29b1
Update docs with a Good to know box about using redirect in client components (#56966)
This adds a new `Good to know` box to explain how to programmatically
redirect in Client Components to avoid people using `redirect` inside
handlers.


![image](https://github.com/vercel/next.js/assets/6494462/20858591-3d21-4a48-bbc9-8a1e0de29ca8)

Co-authored-by: Lee Robinson <me@leerob.io>
2023-10-26 19:57:22 -05:00
Jack Howard
423e945e15
doc: Clarify built-in support for sass after installation (#57279) 2023-10-26 19:52:57 -05:00
Zoe-Bot
f538232fda
docs(fix): example text unescaped entities (#57255)
Fix bug in example code. Loading with `'` can not be built with the default ESLint rules: 
```ssh
./src/app/reviews/loading.tsx
4:15  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
4:26  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
```
2023-10-27 00:20:13 +00:00
Igor Kowalczyk
ab831182bf
Add missing dot in codemod command (#57536)
Add missing dot in `next-og-import` codemod command

```
npx @next/codemod@latest next-og-import .
```
2023-10-26 22:37:47 +00:00
Lee Robinson
92b4d6737c
docs: Next.js 14 (#57342)
- Fetch logging configuration is no longer experimental
- Add `unstable_noStore` reference
- Add `unstable_cache` reference
- Add codemod docs for `next/og` import changes
- Update docs around stable Server Actions
- Add example of revalidating the entire data cache
- Update static export docs for `next export` command removal
- Update minimum required Node.js version
- Add `viewport` and `generateViewport` reference

Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-10-26 15:30:43 +00:00
Michael Novotny
fd0a96ffe7
Another lint fix for front (#57511) 2023-10-26 09:57:06 -05:00
Michael Novotny
cbfa126e4b
Fixes lint error on front (#57509) 2023-10-26 14:33:53 +00:00
Jiachi Liu
07483d4b4c
Move serverActionsBodySizeLimit to serverActions.bodySizeLimit (#57433)
Scope all `serverActions` config in one group "serverActions" to make it
more semantics

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-26 08:51:32 +02:00
Houssein Djirdeh
7bee486f7c
Docs: Add documentation for next/third-parties (#57345)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-25 23:07:18 -07:00
Maia Teegarden
f412c8a991
Remove wasm target (#57437)
This PR removes the wasm target for the next-swc build for the next major version.  The main motivation is that Turbopack does not support targeting wasm yet, and it would be a significant amount of work to add. We plan to make Turbopack the default zero-config experience in a minor version, possibly before we are able to support a wasm target, so we need to make this breaking change now. We also plan to make more improvements to the webpack experience with shared Rust code, which we have so far been blocked from implementing because of the current wasm restrictions. We would like to support a wasm target again in the future, but cannot say at this time when that would be.


Closes WEB-1865
2023-10-26 02:29:07 +00:00
Jiachi Liu
164e43912d
codemods: migrate viewport related metadata export to viewport export (#57436)
This PR adds the codemods transforming certain fields from `metadata`
export to `viewport` export, will still preserve rest metadata export
properties. We don't cover `generateMetadata` to `generateViewport` as
there might be more complex logic inside the function which is hard to
apply the codemods rules.

TLDR: Codemods for #57302
2023-10-25 16:02:14 -07:00
Jiachi Liu
23f32465d7
types: mark ImageResponse from next/server deprecated (#57372)
* Should show `ImageResponse` is deprecated if you still import from `"next/server"`

<img width="708" alt="image" src="https://github.com/vercel/next.js/assets/4800338/38f9b9db-2cfb-48ec-99cc-08e7d1477155">


* If you build it will fail to compile, this might not be super ideal but at least it's not working. For pure js it will throw errors.

```ts
./app/icon.tsx:7:10
Type error: Only a void function can be called with the 'new' keyword.

   5 |
   6 | export default function icon() {
>  7 |   return new ImageResponse(
     |          ^
   8 |     (
   9 |       <div
  10 |         style={{
 ELIFECYCLE  Command failed with exit code 1.
 ```
2023-10-25 20:48:33 +00:00
Josh Story
5528cc6d4e
Remove the experimental serverActions flag (#57145)
Remove the experimental `serverActions` flag

Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-20 20:45:25 +00:00
Steven
a3aa6590ff
chore(next/image)!: mark domains as deprecated in favor remotePatterns (#57062)
We already had `domains` as "not recommended" but this PR marks it as "deprecated" and prints a warning if its detected.

I also updated all examples to switch from `domains` to `remotePatterns`.
2023-10-19 20:24:48 +00:00
Jiachi Liu
a3e56c9c1e
Move ImageResponse to next/og (#56662)
### Story

Since we introduced `ImageResponse` into `next/server` export, there're a few libraries relying on `next/server` that accidentally ended up with bundling og image into the bundle. As og package is quite large that could easily raise the size concern for middleware, edge runtime routes.

### Struggles
 We've done optimizations. The tree-shaking strategies are tricky, we tried modularize imports and also optimize cjs require/exports to make sure you're not including og package into bundle if it's not being used. However, it's still not 100% can handle all the bundle optimization cases, such as `import {..} from "next/server.js"` could also ended up with the cjs bundle that failed the tree-shaking.

### Move on
So we decide to move og `ImageResponse` into a separate export `next/og`

Closes NEXT-1660
2023-10-19 14:26:48 +00:00
Steven
27b89e4aaf
chore(docs): fix missing fallback on next/image sizes example (#56718)
This example use of `sizes` was missing the fallback.

Its best to review with [`?w=1`](https://github.com/vercel/next.js/pull/56718/files?w=1)
2023-10-18 17:55:46 +00:00
Steven
3a459ca986
chore(next/image)!: mark onLoadingComplete as deprecated in favor of onLoad (#56944)
## History

We used to pass `onLoad` through directly to the underlying img so `onLoadingComplete` was introduced in order to handle the case when `placeholder="blur"` was used and `onLoad` would trigger before the placeholder was removed.

We have since changed the behavior of `onLoad` so that it acts the same as `onLoadingComplete` and therefore `onLoadingComplete` is no longer needed.

## What is this PR doing?

This PR marks `onLoadingComplete` as deprecated in favor of `onLoad`. In the future, we may remove `onLoadingComplete`.
2023-10-17 21:12:22 +00:00
Juan Martín Seery
308a327923
feat(env): upgrade dotenv (#38481)
Upgraded dotenv to v16. Breaking changes are:

- Multiline parsing support
- Support inline comments
- Backtick support

[See their changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`


Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-10-17 00:57:51 +00:00
Josh Story
0a80017d03
Update React from d900fadbf to 09fbee89d. Removes server context and experimental prefix for server action APIs (#56809)
The latest React canary builds have a few changes that need to be
adopted for compatability.

1. the `useFormState` and `useFormStatus` hooks in `react-dom` and the
`formData` opiont in `react-dom/server` are no longer prefixed with
`experimental_`
2. server content (an undocumented React feature) has been removed. Next
only had trivial intenral use of this API and did not expose a coherent
feature to Next users (no ability to seed context on refetches). It is
still possible that some users used the React server context APIs which
is why this should go into Next 14.

### React upstream changes

- https://github.com/facebook/react/pull/27513
- https://github.com/facebook/react/pull/27514
- https://github.com/facebook/react/pull/27511
- https://github.com/facebook/react/pull/27508
- https://github.com/facebook/react/pull/27502
- https://github.com/facebook/react/pull/27474
- https://github.com/facebook/react/pull/26789
- https://github.com/facebook/react/pull/27500
- https://github.com/facebook/react/pull/27488
- https://github.com/facebook/react/pull/27458
- https://github.com/facebook/react/pull/27471
- https://github.com/facebook/react/pull/27470
- https://github.com/facebook/react/pull/27464
- https://github.com/facebook/react/pull/27456
- https://github.com/facebook/react/pull/27462
- https://github.com/facebook/react/pull/27461
- https://github.com/facebook/react/pull/27460
- https://github.com/facebook/react/pull/27459
- https://github.com/facebook/react/pull/27454
- https://github.com/facebook/react/pull/27457
- https://github.com/facebook/react/pull/27453
- https://github.com/facebook/react/pull/27401
- https://github.com/facebook/react/pull/27443
- https://github.com/facebook/react/pull/27445
- https://github.com/facebook/react/pull/27364
- https://github.com/facebook/react/pull/27440
- https://github.com/facebook/react/pull/27436

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-16 15:46:10 -07:00
Dmitriy Glazkov
26d0bf27fb
Update 05-mdx.mdx . Fix key of the prop (#56883)
Fix key of the prop

Also the same key prop we can find in `next-mdx-remote` [example with getStaticProps](https://github.com/hashicorp/next-mdx-remote#typescript)
2023-10-16 22:21:44 +00:00
Balázs Orbán
1ff7f07875
feat: drop Node.js 16 (#56896)
### What?

BREAKING CHANGE: Bump the minimum required Node.js version.

### Why?

Node.js 16 has reached end-of-life in September.

Bumped to `18.18.2` since it contained some security-related patches: https://nodejs.org/en/blog/vulnerability/october-2023-security-releases

### How?

Bumped `engines` where needed, upgraded the workflows.

This will allow us to remove quite a few polyfills, I'll open separate PRs for those.
2023-10-16 21:41:38 +00:00
Joris Tirado
21fadd3358
Fix typo (#56863) 2023-10-15 17:18:00 +00:00
Diana Gouveia
db188e480f
docs: fix cypress script typo in 10-testing.mdx (#56765)
fix cypress script name typo to run `cypress:open` as declared on package.json script example
2023-10-14 22:43:32 +00:00
VAS
14aeb49662
Update supported-browsers.mdx (#56815)
Fixed a typo -
docs/04-architechture/supported-browsers.mdx

Changes(s) made -
Fixed a typo for improving clarity
[includes -> include]
'your dependencies includes' -> 'your dependencies include'

Please review and merge it.
2023-10-13 21:04:49 +00:00
Michael Novotny
fd2724ace0
Changes codeblock filename delimiter (#56712)
Based on feedback from #56603, the `/` can be interpreted as file paths instead of filename separators / delimiters. We'll change them to use pipes `|` instead.
2023-10-12 23:18:22 +00:00
Balázs Orbán
6fdba20b6d
docs: fix typo in Update 02-get-static-paths.mdx (#56757)
Fix typo in docs

Fixes #56741

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-10-12 12:18:20 -04:00
Delba de Oliveira
b6cce9ce5e
Docs: Add missing description field (#56749)
Fixing error in next-site due to empty description field.
2023-10-12 08:16:06 -05:00
Farsab
1c07848297
fix(docs): adjust api route documentation examples (#56660)
Fixed the example functions in the documentation to use `async` in order to use `await` within the function body. 

Co-authored-by: Michael Novotny <446260+manovotny@users.noreply.github.com>
2023-10-10 15:23:00 +00:00
Krishnanand Yadav
f6d6acd9ec
Update 01-contribution-guide.mdx: Fix a typo (#56665)
Fix a small typo in the metadata section of the contributing guide.

Kindly add the label: `hacktoberfest-accepted`.
2023-10-10 15:15:13 +00:00