Commit Graph
2700 Commits
Author SHA1 Message Date
f705f9a1a0 docs(data-fetching): fix static params as promise examples (#72565)
### Improving Documentation

- Since the params prop is now a promise, the type of params in the
generateMetadata and Page components has been changed from `{ id: string
}` to `Promise<{ id: string }>`.

---------

Co-authored-by: JJ Kasper <[email protected]>
2024-11-12 21:10:47 +00:00
YeonHeeandGitHub 23dbf29b08 docs(use-cache): add missing function to page component examples (#72620)
### Improving Documentation

- This PR updates Page component examples by adding `function` keyword
to ensure proper syntax highlighting 🙂
- Also includes the missing `export default` for page components, and
applies consistent code formatting.

<img width="675" alt="image"
src="https://github.com/user-attachments/assets/c081f866-8523-4597-aa56-7baad96eecb5">

<br />
2024-11-12 13:09:06 -08:00
1b1cb3eece Add compiler.define option (#71802)
Adds a `compiler.define` option to next.config.js to statically replace
any variables during build-time for Turbopack. This is similar to
Webpack's `DefinePlugin`.

Relates to: https://github.com/vercel/next.js/discussions/71476

---------

Co-authored-by: Tim Neutkens <[email protected]>
2024-11-12 21:13:47 +01:00
Cena KopahiandGitHub b1f1328643 docs: remove unstable_after from Dynamic APIs (#72595)
This pull request removes the unstable_after from the Dynamic APIs, as
it does not cause a route to become dynamic.
2024-11-12 16:54:47 +00:00
Donny/강동윤andGitHub f8a10c79bf refactor(turbopack): Remove swc_css (#72602)
### What?

Remove `swc_css` from turbopack. It would not break the existing codebase, so it's fine.
2024-11-12 17:36:48 +09:00
0bc4086dff Add expireTag and expirePath APIs (#72485)
This adds `expireTag()` and `expirePath` APIs which are replacing
`revalidateTag` and `revalidatePath`. As such this also marks
`revalidatePath` and `revalidateTag` as deprecated and marked for
removal.

The arguments passed to these methods match `revalidateTag` and
`revalidatePath` with the exception that `expireTag` can receive
multiple tags now as separate arguments which matches our new
`unstable_cacheTag()` API.

We are wanting to update these APIs as `revalidateTag` naming has caused
some confusion as to when the affected items will be updated. The
underlying behavior of `expireTag` is to mark an entry as out of date
and for it to no longer be used so we are expiring it.

If you call `expirePath('/blog/first'`) the next time that item is
requested it is considered expired so the cache will not be used for it
and a fresh entry will be generated. Similarly for `expireTag('posts',
'blog')` the next time any cache with that tag is requested it's
respective cache will not be leveraged and new cache will be populated.

---------

Co-authored-by: Zack Tanner <[email protected]>
Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-11 19:23:39 +00:00
fe77761ee8 docs: fix broken link (#72169)
This PR fixes a broken link.
In my language (Japanese), MDN redirects were not functioning correctly,
so I replaced them with appropriate links.

https://developer.mozilla.org/docs/Web/Events/popstate redirects
https://developer.mozilla.org/ja/docs/Web/Events/popstate (404)

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-08 19:25:05 +00:00
51ee1c7f59 Fix grammatical error: remove unnecessary 'a' in 03-server-actions-and-mutations.mdx (#72496)
#### Description:
- fix grammatical error: remove unnecessary 'a'

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-08 11:21:23 -08:00
d8732b9f71 fix: remove unnecessary fragment (#72492)
Hi, Team.

I'd like to contribute as removing unnecessary fragments.
I believe that the fragment will create one more grouping node on
virtual dom, which is not necessary on this example.

If it is essential, please kindly let me know why.

Thank you so much for your support.

### Improving Documentation
- remove unnecessary fragment tags

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-08 11:21:00 -08:00
Delba de OliveiraandGitHub 0b35ddd825 Docs: Move next.config.js API pages under a config folder, fix headings in TS and ESLint config pages (#72465)
This PR:

- Moves `next.config.js` options under a "config" folder which includes
references for other configuration such as the ESLint plugin. I figure
it would be tidier than having "Next.config.js Options" and "Config" in
the API reference.
- Fixes the issue with the "config" folder not showing up in canary:
https://linear.app/vercel/issue/DOC-3749/bug-figure-out-why-new-config-folder-isnt-showing-up-in-the-canary
- Fixes the indentation issues and missing example header (caused by an
invisible character).

Redirects: https://github.com/vercel/front/pull/38704
2024-11-08 14:48:55 +00:00
Rich HainesandGitHub 302e0febf1 [Docs]: Remove try catch and link to error handling docs (#72500)
This PR updates the server actions error handling section to remove
advising using a try catch, in favor of linking to the Error Handling
docs, which has the correct information.

<!-- 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-11-08 14:16:56 +00:00
81271baece Correct reason for Turbopack incompat, remove inaccurate "good to know" (#72467)
- https://github.com/vercel/next.js/pull/72241#discussion_r1832894901

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

1. Fix the incorrect statement added in #72241, as per @timneutkens'
comment here:
   - https://github.com/vercel/next.js/pull/72241#discussion_r1832894901
2. Remove the outdated "good to know" section stating that Turbopack
requires `mdxjs-rs` and is not compatible with `@next/mdx`

### Why?

The docs are currently incorrect

### How?

Edit [remark and rehype
plugins](https://nextjs.org/docs/app/building-your-application/configuring/mdx#remark-and-rehype-plugins)
section on docs page

---------

Co-authored-by: Tim Neutkens <[email protected]>
2024-11-07 17:59:00 +01:00
Niklas MischkulnigandGitHub be40adb9d9 Add missing closing </AppOnly> (#72453)
The MDX was invalid after https://github.com/vercel/next.js/pull/72399
causing next-site deploy failures

(I'm not entirely sure if this is where the `</AppOnly>` should go, feel
free to correct that)

Closes PACK-3416
2024-11-07 11:40:25 +00:00
Delba de OliveiraandGitHub 224447cd65 Getting Started Docs: Improve "Project Structure" page (#72399)
Closes: 
- https://linear.app/vercel/issue/DOC-3695/page-project-structure

This PR: 
- Splits the page between the app/pages and the router docs. 
- Merge the colocation page from BYA.
2024-11-07 09:34:46 +00:00
856521bf47 docs(parallel-routes): update 11-parallel-routes.mdx example for modal closing (#72210)
docs(parallel-routes): update 11-parallel-routes.mdx example for modal
closing

- Updated `11-parallel-routes.mdx` to replace `'...'` with `null` in the
`page.tsx` return statement inside the slot for closing the modal when
navigating using `Link`.
- Also applied the same change in the `default.tsx` file to ensure
consistent behavior in the example.


![image](https://github.com/user-attachments/assets/e0c4b2cf-01e1-4cda-8488-11d12a75d32a)

![image](https://github.com/user-attachments/assets/fca6d051-8e43-4022-986c-60557d5da5e6)

<!-- 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 <[email protected]>
2024-11-07 09:11:34 +00:00
9d31638041 docs(route-handlers): add TS/JS switcher to Route Resolution section in Route Handlers (#72222)
This PR fixes issue on the [Route
Handlers](https://nextjs.org/docs/canary/app/building-your-application/routing/route-handlers)
documentation page:

Missing switcher for TS codeblock in [Route
Resolution](https://nextjs.org/docs/canary/app/building-your-application/routing/route-handlers#route-resolution)
section.

![image](https://github.com/user-attachments/assets/9263732d-2852-49a5-a718-1f40a060ee64)

<!-- 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 <[email protected]>
2024-11-07 09:11:15 +00:00
2211fd2b69 Docs: Vitest: Support for import aliases when using TypeScript (#72430)
Related to https://github.com/vercel/next.js/discussions/72424.

I wasn't able to test if the added "Terminal" switcher works, because I
don't know how to run the docs locally.

<!-- 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 <[email protected]>
2024-11-07 08:45:45 +00:00
Sam KoandGitHub 3b5b5a25a9 docs(output): update standalone docs with cp and start commands (#72432)
## Why?

We're not documenting a way to manually move files to `.next/standalone` for `output: 'standalone'`.
2024-11-06 14:50:14 -08:00
fa8d558154 Docs: Split Getting Started between App and Pages, improve Installation page (#72178)
Prepare **Getting Started** Section for upcoming changes, and work on
the first page: `Installation`.

Closes: 
-
https://linear.app/vercel/issue/DOC-3703/update-how-getting-started-is-handled-in-next-site
-
https://linear.app/vercel/issue/DOC-3694/page-how-to-set-up-a-new-nextjs-project-installation
- https://linear.app/vercel/issue/DOC-3707/create-subsection-for-plugins
- https://linear.app/vercel/issue/DOC-3709/eslint-plugin-api-reference
- https://linear.app/vercel/issue/DOC-3710/typescript-reference-page

### Key Changes: 

- Duplicate Getting Started Section between App and Pages Router docs 
- Since getting started will vary between the routers, each docs needs
to have their own Getting Started section
- Reorganize folder numbers
   
**Installation Page**: 
- Split app and pages router specific information
- Rename "Installation" to "How to set up a Next.js application" for SEO
- Add setup instructions for **TypeScript**
- Add setup instructions for **ESLint**
- Add setup instructions for **Absolute Imports and Module Path
Aliases**

**Side effects from moving content around**:
- Create a subsection in API Reference called **Configuration**. 
   - Add ESLint Plugin page, and update it to follow template
   - Add TypeScript page, and update it to follow template
- Remove the **Absolute Imports and Module Path Aliases** page, it's
small enough to live under the set up instructions.

---------

Co-authored-by: Rich Haines <[email protected]>
2024-11-06 12:32:05 +00:00
Delba de OliveiraandGitHub 8f99ab20ae Docs: Remove legacy tags from unstable_cache and unstable_noStore (#72134)
This was a premature move as the docs made their way into the stable
version. Can't risk these being merged just yet, and they're also not in
canary.
2024-11-06 08:35:52 +00:00
d399ed6cd4 docs(middleware): fix incorrect link to Pages in Middleware's NextResponse section (#72223)
This PR fixes an issue in the
[Middleware](https://nextjs.org/docs/canary/app/building-your-application/routing/middleware)
documentation where the
[NextResponse](https://nextjs.org/docs/canary/app/building-your-application/routing/middleware#nextresponse)
section incorrectly links to [Layouts and
Templates](https://nextjs.org/docs/canary/app/building-your-application/routing/layouts-and-templates)
instead of the intended
[Pages](https://nextjs.org/docs/canary/app/building-your-application/routing/pages)
link.


![image](https://github.com/user-attachments/assets/6738fb2d-1b93-4cfd-a6d4-bdb158407d11)

<!-- 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 <[email protected]>
2024-11-06 08:22:35 +00:00
20a55c0bfd docs: update use cache with inline links for relevant documentation (#72368)
<!-- 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 <[email protected]>
2024-11-06 08:03:32 +00:00
771bc2359b docs: fix double href typo in Link component (#72339)
<!-- 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 <[email protected]>
2024-11-06 08:02:02 +00:00
Sam KoandGitHub ea211a8788 docs(testing): update cypress note (v14 now supported) (#72366)
## Why?

Cypress has supported v14 for a while.

- Fixes https://github.com/vercel/next.js/issues/72325
2024-11-05 15:40:13 -08:00
はとぽっぽ丸andGitHub 7965dd7484 docs: Fix typo in closing tag of sample code (#72361)
Hello! Thank you as always 🫶 
I'd like to contribute to the following points:

### Improving Documentation

- fix typo in closing tag
  - `<>` -> `</>`

---
👇 Now

<img width="362" alt="image"
src="https://github.com/user-attachments/assets/fbb29a76-e1b8-467b-8453-46e5e1548db1">

in: [File Conventions: layout.js |
Next.js](https://nextjs.org/docs/app/api-reference/file-conventions/layout)

---

Thank you for reading! I look forward to working together.
2024-11-05 15:05:23 -08:00
e84ca38ba5 docs(typo): fix typos in 04-cypress.mdx (#72218)
## 📚 Improving Documentation

Hello, I’ve updated the `04-cypress.mdx` documentation with the
following improvements:

1. Changed `c` and `t` to uppercase. Other documentation consistently
uses uppercase for these letters.


![image](https://github.com/user-attachments/assets/17182c33-4473-4aea-9514-d6ae93601d7e)

2. Removed `.js` as I did in [this pull
request](https://github.com/vercel/next.js/pull/72061) because
`cypress.config` can use both `.ts` and `.js`.

3. Added a `switcher`.

4. Included a link to the `start-server-and-test` npm package.

Co-authored-by: JJ Kasper <[email protected]>
2024-11-05 20:45:17 +00:00
0a209a9640 Clarify serialization behavior of "use cache" (#72286)
Maybe not ideal wording but this should be more correct. See
https://github.com/vercel/next.js/pull/72081#discussion_r1828278059.

---------

Co-authored-by: Delba de Oliveira <[email protected]>
Co-authored-by: JJ Kasper <[email protected]>
2024-11-05 20:43:43 +00:00
b754b4edb9 docs(typo): fix typos in 03-playwright.mdx (#72182)
## 📚Documentation

Hello, I've made some corrections to `03-playwright.mdx`.

In other documentation files, "T" is consistently capitalized, so I
adjusted it here as well.


![image](https://github.com/user-attachments/assets/7677796f-853b-4208-a57e-7547cd8686f7)

Also, I removed the newline after `**Good to know**:` to match the
formatting in other docs.


![image](https://github.com/user-attachments/assets/ce048ddc-927a-4fbf-be94-f0e73176530e)

Co-authored-by: JJ Kasper <[email protected]>
2024-11-05 20:42:52 +00:00
fdcc3c9a22 Note missing plugins support in mdxRs, refine (#72241)
<!-- 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?

1. Document incompatibility of Turbopack with MDX remark and rehype
plugins
2. Improve casing and prose
3. Add link to `remark-gfm`

### Why?

It's confusing to users that plugins don't work with Turbopack (because
`mdxRs` is required, which [does not support
plugins](https://github.com/wooorm/mdxjs-rs#:~:text=This%20project%20does%20not%20yet%20support%20plugins.)):

- https://bsky.app/profile/matthamlin.bsky.social/post/3la2lzzuprj22

### How?

Edit docs page

Co-authored-by: JJ Kasper <[email protected]>
2024-11-05 10:10:14 -08:00
036d8d207b docs: add legacy version tag to exportPathMap docs (#72302)
## Description
At #71964, Legacy tag was introduced.
Then add that to `exportPathMap` docs instead of `deprecated` title
name.

In addition, remove [Static
Export](https://github.com/vercel/next.js/tree/canary/examples/with-static-export)
example because it's no more use `exportPathMap`.

### Improving Documentation

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

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-05 06:44:46 +00:00
bc6a0aa8dd docs: fix compatibility typo (#72304)
### Improving Documentation

- fix typo 

`compatability` -> `compatibility`

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-05 06:35:13 +00:00
e1cf7f85f7 "intrisic" docs: fix typo (#72308)
### Improving Documentation

fix typo

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-05 06:33:27 +00:00
7b3f4d23f3 docs: fix typo (#72309)
### 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

fix typo

myFeaturFlag.isEnabled() -> myFeatureFlag.isEnabled()

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-05 06:31:47 +00:00
037dacdad9 docs: fix intented typo (#72310)
### Improving Documentation
- fix typo

`intented` -> `intended`

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-05 06:31:29 +00:00
Sam KoandGitHub 8a0a3652d0 docs(fetch): update fetch example to v15 (#72295)
## Why?

The default cache config for fetch is `{ cache: 'no-store' }` with v15.

- Fixes https://github.com/vercel/next.js/issues/72213
2024-11-04 15:49:54 -08:00
be7dbc95d8 docs: update cookies reference url (#72151)
## Description
#69614 changes some anchor paths.
Then update the incorrect URLs.

### Improving Documentation

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

Co-authored-by: JJ Kasper <[email protected]>
2024-11-04 23:10:34 +00:00
817a4a1914 [Docs] updating information about fetch caching in the fetching docs (#72156)
Closes: https://github.com/vercel/next.js/issues/72152

This PR fixes a information about fetching being memoized by default in
the [fetching
docs](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching#reusing-data-across-multiple-functions)

---------

Co-authored-by: JJ Kasper <[email protected]>
2024-11-04 23:04:47 +00:00
Sam KoandGitHub 6cf63ff830 docs(use-cache): fix typo and link (#72292)
## Why?

We have a typo and incorrect link.

- Fixes https://github.com/vercel/next.js/issues/72266
2024-11-04 22:12:12 +00:00
Delba de OliveiraandGitHub 9bbf1d023c Docs: Fix css modules page in Pages docs (#72135)
Re: https://vercel.slack.com/archives/C07BS1WEYAZ/p1730162050697879
2024-11-04 12:23:43 +00:00
Balázs OrbánandGitHub 0ffc5f7b59 Revert "docs: change NextAuth.js to Auth.js" (#72257) 2024-11-04 11:42:54 +00:00
94eca4bb56 docs: change NextAuth.js to Auth.js (#72201)
## Summary
[`NextAuth.js`](https://next-auth.js.org/) is becoming
[`Auth.js`](https://authjs.dev/)!
Then update new documentation link.

### Improving Documentation

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

Co-authored-by: Zack Tanner <[email protected]>
2024-11-03 16:05:40 +00:00
2f427f33b2 docs(server-actions-mutations): Add missing TS/JS switcher to Passing Additional Arguments section in Server Actions and Mutations docs (#72226)
This PR adds a missing TypeScript/JavaScript code switcher to the
[Passing Additional
Arguments](https://nextjs.org/docs/canary/app/building-your-application/data-fetching/server-actions-and-mutations#passing-additional-arguments)
section in the [Server Actions and
Mutations](https://nextjs.org/docs/canary/app/building-your-application/data-fetching/server-actions-and-mutations)
documentation. This enhancement improves accessibility for users by
providing both TypeScript and JavaScript code examples, making it easier
for developers to follow along in their preferred language.


![image](https://github.com/user-attachments/assets/d8225abc-c1d0-478f-afc1-6830f83587c4)

<!-- 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: Jiwon Choi <[email protected]>
2024-11-03 14:24:43 +00:00
aee9c1ef06 docs(cacheLife): fix incorrect highlight and missing switcher (#72216)
This PR fixes two issues on the
[cacheLife](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife)
documentation page:

1. Incorrect highlight for `biweekly` in [Defining reusable cache
profiles](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife#defining-reusable-cache-profiles)
section. It should highlight `biweekly` but not `export default async
function Page()`


![image](https://github.com/user-attachments/assets/f5b331cf-a5eb-41b0-8cba-08b2a2ff836d)

2. Missing `switcher` for TS and JS codeblock in [Defining cache
profiles
inline](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife#defining-cache-profiles-inline)
section. Codeblock is displayed twice


![image](https://github.com/user-attachments/assets/e618f806-674f-4c21-8e02-8c90dd2308a5)

Signed-off-by: Eng Zer Jun <[email protected]>
Co-authored-by: Jiwon Choi <[email protected]>
2024-11-03 14:21:30 +00:00
9409a46218 docs(draft-mode): fix missing switcher for TS and JS codeblock (#72215)
The same codeblock is displayed twice.



![image](https://github.com/user-attachments/assets/01da38e1-4437-4b0a-a08e-a911bf9fea94)


![image](https://github.com/user-attachments/assets/5194faf6-7d5f-44aa-a445-21e02e635809)

Signed-off-by: Eng Zer Jun <[email protected]>
Co-authored-by: Jiwon Choi <[email protected]>
2024-11-03 14:19:57 +00:00
Eng Zer JunandGitHub 0c14b38c47 docs(cacheTag): remove unused cacheLife import and add missing switcher (#72217)
This PR fixes two issues on the
[cacheTag](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag)
documentation page:

1. Remove the unused `unstable_cacheLife` import in the TypeScript
codeblock of [Creating tags from external
data](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#creating-tags-from-external-data)
section:


![image](https://github.com/user-attachments/assets/db401635-f07b-4e48-bd39-9a21adedce41)


2. Missing `switcher` for TS codeblock in [Creating tags from external
data](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#creating-tags-from-external-data)
and [Invalidating tagged
cache](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#invalidating-tagged-cache)
sections. We already have the corresponding JS codeblock in the
Markdown.


![image](https://github.com/user-attachments/assets/33a36ac4-d936-47dd-8e96-df9e67366680)


![image](https://github.com/user-attachments/assets/2f91f7de-f440-439c-9cce-1749e9645516)

Signed-off-by: Eng Zer Jun <[email protected]>
2024-11-03 23:16:56 +09:00
a44a0d91b2 [Testing] Export utilities to help test middleware and next.config.js routing (#70731)
This PR adds some testing utilities for testing `middleware` and
`next.config.js`. The goal is to make it easy for anyone to add tests
that assert the behavior of routing, such as how
`next.config.js#redirects`, `next.config.js#rewrites`, and `middleware`
interact, or what paths are matched by middleware. This is useful to
catch routing issues before the code ever reaches production.

This code is exported in a new `next/server/testing` export to keep it
separate from the rest of the `next/server` code.

This testing code is marked as `unstable_` since it is not reusing all
of the same code that the actual routing in `next dev` and `next start`
is using. It is an approximation to make unit testing easier.

# Middleware

A new `unstable_doesMiddlewareMatch` function was added to assert when
middleware will be run for a path.

```js
import { unstable_doesMiddlewareMatch } from 'next/server/testing'

expect(
  unstable_doesMiddlewareMatch({
    config,
    nextConfig,
    url: '/test',
  })
).toEqual(false)
```

Helpers were also created to test for whether the response was a
redirect or rewrite.

# Next.config.js

A new `unstable_getResponseFromNextConfig` function was added to run
`headers`, `redirects`, and `rewrites` functions from `next.config.js`,
calling them in the order that they would actually be executed in.

```js
import { getRedirectUrl, unstable_getResponseFromNextConfig } from 'next/server/testing'

const response = await unstable_getResponseFromNextConfig({
  url: 'https://nextjs.org/test',
  nextConfig: {
    async redirects() {
      return [{ source: '/test', destination: '/test2', permanent: false }]
    },
  },
})
expect(response.status).toEqual(307)
expect(getRedirectUrl(response)).toEqual('https://nextjs.org/test2')
```

---------

Co-authored-by: Zack Tanner <[email protected]>
Co-authored-by: JJ Kasper <[email protected]>
2024-11-01 10:54:11 -07:00
53c631e1da Document default values in cookies options (#72183)
<!-- 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?

Document the default values for `cookies`, eg. used in
`cookies().set()`, fix typo

### Why?

Default values are undocumented (probably because there are almost no
default values)

![Screenshot 2024-11-01 at 16 20
57](https://github.com/user-attachments/assets/7de705f0-f0db-491d-9582-6f65f9688730)


### How?

1. Add a default annotation in the options table row for `path`, based
on the `packages/next/src/compiled/@edge-runtime/cookies/index.js` code:

https://github.com/vercel/next.js/blob/98fa0246d9d6f6adfcac91d8d9997672390cd051/packages/next/src/compiled/%40edge-runtime/cookies/index.js#L317-L328
2. Add a short paragraph about other options not having default values
3. Fix the extra `,` typo

---------

Co-authored-by: JJ Kasper <[email protected]>
2024-11-01 17:43:20 +00:00
98fa0246d9 docs: fix code block extension for cacheLife (#72171)
This PR modifies the code block extension for
[cacheLife](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife#usage).

As shown in the screenshot below, both code blocks were TSX
(TypeScript), so I followed the guidelines
[here](https://nextjs.org/docs/canary/community/contribution-guide#ts-and-js-switcher)
and changed one of them to JSX (JavaScript).


![image](https://github.com/user-attachments/assets/590b2f82-a46d-4cc8-bb45-8a5262ac6dec)

Co-authored-by: Delba de Oliveira <[email protected]>
2024-11-01 13:23:04 +00:00
3551a58356 Firefox Debugger instructions (#71938)
### What?

Added Firefox debugging instructions to Next.js docs

### Why?

To support developers who use Firefox for debugging

### How?

- Added Firefox config to VS Code launch settings
- Added Firefox-specific debugging instructions
- Updated relevant docs sections to include Firefox alongside Chrome

---------

Co-authored-by: Novalinium <[email protected]>
Co-authored-by: Delba de Oliveira <[email protected]>
2024-10-31 14:13:39 +00:00
b5531e99e5 docs: add missing root directory / to path (#72118)
## Summary
Add a slash to correct the problem.

### Improving Documentation

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

Co-authored-by: Delba de Oliveira <[email protected]>
2024-10-31 14:06:53 +00:00