Commit graph

17399 commits

Author SHA1 Message Date
Wyatt Johnson
540f8e29a0
Cleanup of /_next/data handling in server (#54689)
Previously the code used in both edge and node runtimes used _almost_ the same code. This unifies the two into the base server implementation while also preserving the specific case handled by the split.

This also moves the `/_next/data` route matching to a cached value to prevent it from creating the `RegExp` on every request evaluation.
2023-08-28 23:48:30 +00:00
Jiachi Liu
8ed492f3c1
Default app router not found (#54199)
Adding a default app router not-found error page in production. We introduced a custom global not-found page if you have `not-found.js` file under app directory. Next.js will still routed you to default pages 404 if there's no routes matched when you don't have a custom `not-found.js`.

This PR creates a default layout (only having `html` and `body`) and will use the default not-found component as children to build a default 404 page for app router, and server will route to that page when there's any app router pages existed. This will also fix the hmr issue that when you hit a pathname doesn't exist, nextjs will compile `/_error` for you which is not expected, now we're using `/not-found` instead

Closes NEXT-1359
2023-08-28 22:09:16 +00:00
Steven
a6a452b3b2
chore: update gitattributes with linguist-vendored (#54683)
> Excluded from stats

https://github.com/github-linguist/linguist/blob/master/docs/overrides.md
2023-08-28 21:50:19 +00:00
Shohei Maeda
efd8d22654
Add new permanentRedirect function in App Router (#54047)
for internal:
https://vercel.slack.com/archives/C03S8ED1DKM/p1691700057242999

### Problem

- The existing [`redirect()`
function](https://nextjs.org/docs/app/api-reference/functions/redirect)
can't control the status code.
- The existing [`redirect()`
function](https://nextjs.org/docs/app/api-reference/functions/redirect)
returns a 307 HTTP redirect response while it returns a 308-equivalent
meta tag `<meta http-equiv="refresh" content="0;url=/foo"/>` in
streaming response (e.g., suspense boundary), making the behavior
inconsistent.

### Solution

Adding a new `permanentRedirect()` function and changing the meta tag
default accordingly.

| func   |      HTTP status      |  meta tag |
|---|:---:|---|
| `redirect()` | 307 | `<meta http-equiv="refresh"
content="1;url=/foo"/>` |
| `permanentRedirect()` | 308 | `<meta http-equiv="refresh"
content="0;url=/foo"/>` |

ref.
https://developers.google.com/search/docs/crawling-indexing/301-redirects

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-28 14:22:43 -07:00
Krychaxp
bdfbde5db8
Update revalidatePath.mdx (#54631)
add if statement, because typescript throws error: revalidatePath require `string`, but `searchParams.get('path')` returns `string|null` type




Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-28 20:33:49 +00:00
Wyatt Johnson
0f822373ee
File Reader Improvements (#54645)
This replaces the existing recursive directory reading beheviour with a more efficient implementation. Rather than previously doing actual recursion with the function calls to go deeper into each directory, this has been rewritten to instead use a while loop and a stack. This should improve memory usage for projects with very deep directory structures. 

The updated design that performs directory scanning on all directories found at each layer, allowing more filesystem calls to be sent to the OS instead of waiting like the previous implementation did.

**Currently the new implementation is about 3x faster.**
2023-08-28 18:09:56 +00:00
Steven Tey
989233eba3
updated sitecore deploy button (#54678) 2023-08-28 17:59:53 +00:00
Tim Neutkens
e1e1fffa49
Remove unused cssnano-simple file (#54658)
Couldn't find this file being used anywhere so I think it was left over after a refactor.
2023-08-28 15:31:09 +00:00
vercel-release-bot
5b62f15586 v13.4.20-canary.11 2023-08-28 14:27:50 +00:00
Tobias Koppers
ef0c5e20b8
add support for app pages to next.rs api (#54668)
### What?

fix the paths for app pages with route groups (e. g. `(dashboard)`)


Closes WEB-1463

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-28 16:23:43 +02:00
vercel-release-bot
1491d4c2ed v13.4.20-canary.10 2023-08-28 13:30:48 +00:00
Indraan S. Toor
dda62b693e
Fix weight values above 900 not working with Google Fonts (#54339)
## What?
This PR fixes issue #54304. As discussed in the issue it was suspected that the values of weights were not being sorted correctly. The weights were being sorted in lexicographical order. 

In order for Google fonts to work, Google Fonts need the values of weights present in the url in sorted order.

Due to this the url which was being generated for Google Fonts which had a value of "1000" in weight was giving an error and the font was not working.

## Why I Think This Solution Works?

Let's assume that we have an object named axes with the property named named "wght" which will have the value of weights as following:

```
const axes = {
  wght: ["100", "200", "300", "400", "500", "600", "700", "800", "900", '1000']
}
```

Let's create another variable named "display" with the value set as "swap" and create another variable named "fontFamily" with the value as "DM Sans" (this is the font which was being used in the issue).

```
const fontFamily = "DM Sans";
const display = "swap";
```

If we call the function using them
```
const FONT_URL = getGoogleFontsUrl(fontFamily, axes, display);
console.log("The font url is: ", FONT_URL)

Output Will Be:
The font url is: https://fonts.googleapis.com/css2?family=DM+Sans:wght@100;1000;200;300;400;500;600;700;800;900&display=swap
```
It will give the incorrect value which was shown in the issue. 

If you see at line number 56 there was no comparison function passed in the sort function which is what was suspected earlier and it was sorting the values lexicographically.

Create another variable inside the function above line 54 where we are updating the value of "url" variable.

```
const variantValues = variants.map((variant) => variant.map(([, val]) => val).join(','))
console.log("Variant Values: ", variantValues)

Output Will Be:
Variant Values: ["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000"]
```

Now call the function again with the same values you will see the values in the correct order but as soon as you call "sort" function it will give you incorrect sorted values which is what is happening in the "url" variable.

```
const variantValues = variants.map((variant) => variant.map(([, val]) => val).join(',')).sort()
console.log("Variant Values: ", variantValues)

Output Will Be:
["100", "1000", "200", "300", "400", "500", "600", "700", "800", "900"] 

(As you can see the values are sorted incorrectly)
```
There was one case when I implemented this solution. When "ital" is also passed then the values are in "ital,wght" format and because of it the sorting was giving incorrect result for this case.

Let's update the "axes" variable which we made previously to contain these values:

```
const axes = {
  wght: ["500","300", "400"],
  ital: ["0","1"]
}
```
Now when we run the function it gives us the result as:
`
https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,500;0,300;0,400;1,500;1,300;1,400&display=swap`

Where as the expected result was: 

`https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap`

So, I rewrote the "sort" function to also handle this case.

## What Did I Do To Fix It?

I passed the comparison function inside the "sort" function which was being to ensure that the elements are compared as integers, and thus the sorting will be done numerically.

Which gave me the correct output as url:

`https://fonts.googleapis.com/css2?family=DM+Sans:wght@100;200;300;400;500;600;700;800;900;1000&display=swap`

With values being sorted correctly and if you visit the link you will see the response instead of the error.

Any thought's or suggestions would be greatly appreciated.
2023-08-28 12:02:40 +00:00
Tim Neutkens
2ab39ec14a
Implement hot reloader interface for Turbopack (#54632)
Implements the `NextJsHotReloaderInterface` type for the Turbopack
implementation. This removes the Proxy that had an `any` type and did
not have all methods implemented.

<!-- 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-08-28 13:34:38 +02:00
Donovan Dikaio
41368670a3
docs: fix small typo (#54656) 2023-08-28 07:25:51 +00:00
Emilio Schaedler Heinzmann
a699c980aa
docs: updates generateMetadata function signature (#54638)
Change optional arg to non-optional arg of `parent` in the `generateMetadata` API function example in oder to avoid the error shown below.
 
![Screenshot 2023-08-27 at 15 23 02](https://github.com/vercel/next.js/assets/103655828/a39dc0c0-ab1b-4a26-9ac0-1e9ddcfd11da)
2023-08-27 23:21:48 +00:00
Tim Neutkens
5152842496
Remove this as any cases (#54642)
Noticed there were two cases in `next-server.ts` that leverage `this as any` to call functions defined only in next-dev-server.
This change ensures the types are correct, which is useful for refactoring, e.g. renaming the function in `next-dev-server` would cause the original code to break unexpectedly.
2023-08-27 23:08:13 +00:00
Tim Neutkens
6ea0763224
Implement hot-reloader interface (#54629)
Splits out the public API that is used for the hot reloader. This will
be used in a follow-up PR to implement the same interface for Turbopack.

<!-- 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-08-27 23:12:36 +02:00
Tim Neutkens
27020e299e
Rename hot-reloader to hot-reloader-webpack (#54628)
Small rename to better signal hot-reloader.ts is only used for webpack.

<!-- 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-08-27 22:26:41 +02:00
Lee Robinson
68331892cc
docs: Add JS code snippets for forms (#54577)
https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations

Some of the code blocks where I only specified TS code snippets aren't
working with JS as well (when there are no types). I think I might have
incorrectly assumed you could leave those out. So added the JS snippets
in here (same code, just different file names).
2023-08-27 11:37:10 -05:00
Chan Nyein Thaw
a221121002
Update revalidatePath to revalidateTag (#54633)
Fix typo in `revalidateTag.mdx`. Updated `revalidatePath` -> `revalidateTag`
2023-08-27 15:58:25 +00:00
Tobias Koppers
fd2a01ac14
Turbopack: add middleware support for next.rs api dev mode (#54555)
### What?

* adds middleware support
* adds a test case
* moves templates since they are used for more then next-route-loader


Closes WEB-1445
2023-08-27 12:10:15 +02:00
JJ Kasper
8997ab0812
Implement granular rust caching (#54582)
This fixes our caching for the docker builds as they were missing inputs
the other jobs had also enables caching the rust target cache which
improves build times when only changing our package and the lockfile
isn't invalidated.

Tested here https://github.com/vercel/next.js/actions/runs/5987764387
2023-08-26 18:54:14 -07:00
Delba de Oliveira
05dbd9a8a2
Docs: Update Edge runtime and data revalidation information (#54499)
Fixes: https://vercel.slack.com/archives/C042LHPJ1NX/p1692666204185669

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-08-26 18:33:15 -07:00
Alex Hawley
c1b753c795
(Example) Add CMS Sitecore XM Cloud Example (#54535)
### What?

This PR adds the `cms-sitecore-xmcloud` example.

Sitecore XM Cloud is a headless CMS platform that empowers content editors to manage content, layout, and structural aspects of web pages. The Sitecore JSS framework connects frontend JavaScript applications to the XM Cloud API, allowing retrieval of content and presentation layout information.

Sitecore JSS for Next.js integrates Next.js with Sitecore JSS, offering a structured approach to connect a Next.js application to XM Cloud. The `cms-sitecore-xmcloud` example, derived from the Sitecore JSS initializer, showcases the frontend application exclusively, omitting backend implementation details.

### Why?

While Sitecore offers detailed documentation for creating XM Cloud projects and JSS applications, existing starter templates often combine frontend and backend configurations. The `cms-sitecore-xmcloud` example focuses solely on the frontend application and includes environment variable examples to establish a connection with XM Cloud, eliminating the need for a .NET-compatible machine.

### How?

For comprehensive guidance on setting up an XM Cloud site and JSS application, refer to Sitecore and Vercel documentation. The `cms-sitecore-xmcloud` example is created using the Sitecore JSS initializer, integrating Next.js and SXA (Sitecore Experience Accelerator) add-ons. Further documentation can be found at:

- [Deploying to Vercel](https://doc.sitecore.com/xmc/en/developers/xm-cloud/walkthrough--deploying-your-front-end-application-to-vercel.html)
- [Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
- [Documentation (XM Cloud)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
- [Documentation (Create an XM Cloud project from a starter template)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/create-an-xm-cloud-project-from-a-starter-template-in-the-xm-cloud-deploy-app.html)


Co-authored-by: Steven Tey <28986134+steven-tey@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-27 01:27:38 +00:00
Shu Ding
52e0b1d1ef
Fix router CPU profiling (#54497)
Since we've merged the app and router processes, the `__NEXT_PRIVATE_CPU_PROFILE` env was missing.
2023-08-27 01:22:30 +00:00
Zack Tanner
40b3226352
modify bench scripts to not conflict with dev task (#54600)
I don't believe these benches were intended to run as part of the monorepo `dev` task. This renames the `dev` task to `dev-application` similar to `build-application` (which I assume was aliased for a similar reason)

Fixes #54592
2023-08-26 22:58:00 +00:00
Jiachi Liu
6d401c1a47
chore: add extra error info for rsc info helper (#54609)
When I was working on #54199 , if the file path is wrong the next app build error only shows "can't read file from ...", it took me hours to figure out where it actually fails in next build command. Adding an prefix for the error message so that could identify it easier.

Also clean up other unused comments and incorrect named variables
2023-08-26 22:55:21 +00:00
Tim Neutkens
eca06a56b2
Add cleanup logic to worker.ts (#54500)
This implements the same cleanup logic used for start-server and render-workers for the workers used during build.

It's more of a contingency as we do call `.end()` on the worker too.

Fixes #45508




Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2023-08-26 21:28:46 +00:00
Vector73
f2766b979b
docs: Fixes typo in route handlers (#54605) 2023-08-26 15:24:16 -05:00
Vercel Release Bot
c8ff659133
Update font data (#54585)
This auto-generated PR updates font data with latest available
2023-08-26 16:46:25 +00:00
Tim Neutkens
1fe5f9511d
Reuse edgeConditionNames variable (#54594)
Small change to reuse the same array defined right above.

<!-- 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: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-26 13:45:46 +02:00
JJ Kasper
8afd85d47f
Add missing install env for release stats (#54581)
This should fix the stalled action as it seems we aren't skipping this postinstall step when we should be which explains why it was passing for PR stats but not release stats

x-ref: https://github.com/vercel/next.js/actions/runs/5980582756/job/16227150469
2023-08-25 22:44:15 +00:00
vercel-release-bot
529a1be6c1 v13.4.20-canary.9 2023-08-25 21:26:50 +00:00
Shu Ding
b4a5663c5f
optimize_barrel SWC transform and new optimizePackageImports config (#54572)
## Implementation

Base on #54530, we're implementing a `optimize_barrel` transform to
optimize barrel files to only export the names we need. If the
transformed file isn't a "barrel file", we just re-export the names from
it without any transformation.

Take `lucide-react` as an example, with #54530 we are able to transform

```js
import { IceCream } from 'lucide-react'
```

to 

```js
import { IceCream } from '__barrel_optimize__?names=IceCream!=!lucide-react?__barrel_optimize_noop__=IceCream'
```

And then, we apply that new request with a new Webpack module rule to
use the SWC loader with option `optimizeBarrelExports: ['IceCream']`,
which eventually got passed to this new `optimize_barrel` transform and
does the optimization.

## Notes

We'll have to add a new `getModularizeImportAliases` alias list to map
`lucide-react` to the ESM version, as we have the `['main', 'module']`
resolve order for the server compiler. Otherwise this optimization
doesn't work in that compiler.

There's no e2e test added because it's already covered by the
`modularize-imports` test as we removed the default `lucide-react`
transform rules and it still works.

We'll need to test other libs before migrating them to the new
`optimizePackageImports` option.

---

Closes #54571, closes #53605, closes #53789, closes #53894, closes
#54063.
2023-08-25 22:29:39 +02:00
JJ Kasper
eee137615e
Update release stats install/build executing (#54576)
Aims to make debugging the release stats failure easier as currently we
don't see the logs are the command is executing

x-ref:
https://github.com/vercel/next.js/actions/runs/5976635577/job/16221230094
x-ref: https://github.com/vercel/next.js/pull/54536
2023-08-25 12:45:58 -07:00
Lee Robinson
b048d7eee2
docs: Forms and mutations (#54314)
This PR is a larger change to documentation to make the following
updates:

- Deconstructs [Server
Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions)
into "Forms and Mutations" and an API reference
- Removes content in place of future React API documentation pages
- Removes outdated [Building
Forms](https://nextjs.org/docs/pages/building-your-application/data-fetching/building-forms)
docs from the Pages Router and adds conditional content for both routes
in "Forms and Mutations"
- Adds TypeScript code blocks to API Routes page, recommends Route
Handlers for isomorphic signatures.
- Updates `revalidatePath` and `revalidateTag` docs to have a Server
Actions example.

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-08-25 14:31:11 -05:00
Tobias Koppers
2de45693a9
Revert "Decreased watchpack aggregate timeout" (#54515)
Reverts vercel/next.js#54461

Closes WEB-1436
2023-08-25 16:46:12 +00:00
Vincent Voyer
e4ff4da7c8
fix(DX): More precise error messages for export const config deprecation (#54492)
Before:
```
Error: `export const config` in /vercel/path0/src/app/api/route.js is deprecated. Please change `runtime` property to segment export config. See https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
```

After:
```
Error: `export const config` in /vercel/path0/src/app/api/route.js is deprecated:
  - Change `config.runtime…` to `export const runtime = "edge"`
  - Change `config.regions…` to `export const preferredRegion = ["us-east-1"]`
Visit https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config for more information.
```

The values proposed in Change.. are the actual ones from the customers, they can just copy paste.

Closes NEXT-1560
2023-08-25 16:25:15 +00:00
Clément Dreptin
41be932238
docs: fix source files hash calculation (#54509)
Hello!

I recently tried to cache the `.next/cache` directory in a GitHub action following what was said in the documentation and realized that hashing the source files didn't work properly.

This problem also occured in [next-cache](https://github.com/jongwooo/next-cache) and was fixed by [this PR](https://github.com/jongwooo/next-cache/pull/17).

This PR simply changes the example from the documentation to apply the same fix (stop using brackets in the patterns passed to `hashFiles`).

Hope it helps!

### 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
2023-08-25 16:04:21 +00:00
vercel-release-bot
dbfcfd75b7 v13.4.20-canary.8 2023-08-25 14:28:07 +00:00
Tobias Koppers
08d3258762
update turbopack (#54558)
* https://github.com/vercel/turbo/pull/5723 <!-- Alex Kirszenberg - Misc
comments in turbo_tasks -->
* https://github.com/vercel/turbo/pull/5714 <!-- OJ Kwon - test(ci):
update datadog-ci -->
* https://github.com/vercel/turbo/pull/5705 <!-- Justin Ridgewell -
Transformation code necessary to support Server Actions -->
* https://github.com/vercel/turbo/pull/5739 <!-- Justin Ridgewell -
Update rust toolchain -->
* https://github.com/vercel/turbo/pull/5785 <!-- Tobias Koppers - add
evaluatables to chunk list ident -->
* https://github.com/vercel/turbo/pull/5783 <!-- Tobias Koppers -
Tracing improvements -->
* https://github.com/vercel/turbo/pull/5738 <!-- Alex Kirszenberg -
Generic types over Vcs -->
* https://github.com/vercel/turbo/pull/5795 <!-- Leah - fix: snapshot
test path canonicalization -->
* https://github.com/vercel/turbo/pull/5794 <!-- Tobias Koppers - fix
"any" context condition implementation -->
* https://github.com/vercel/turbo/pull/5800 <!-- Tobias Koppers - add
middleware entry type -->
* https://github.com/vercel/turbo/pull/5786 <!-- Tobias Koppers -
perform invalidation directly on writes -->

Closes WEB-1446
2023-08-25 16:22:35 +02:00
Steven
6a70ebf2aa
chore(docs): add example of sanity image to loaderFile config (#54529)
https://www.sanity.io/docs/image-urls
2023-08-25 14:10:26 +00:00
vercel-release-bot
d8b1ad41a7 v13.4.20-canary.7 2023-08-25 13:43:11 +00:00
Jiachi Liu
b82e2cde89
Fix missing new line for certain logs (#54442)
When logging are sending from worker they're missing new line, that
could be directly added after to spinner

#### After

![image](https://github.com/vercel/next.js/assets/4800338/c4494ff8-0335-49e3-8cce-2f9dc1fe7975)

#### Before

![image](https://github.com/vercel/next.js/assets/4800338/bcf3e27d-de39-4e27-ac57-09c922c09ecc)
2023-08-25 15:27:27 +02:00
JJ Kasper
483ebc2516
Skip copying signal field for revalidate (#54533)
This ensures we don't pass through the signal field when revalidating a
fetch as that can be delayed and we don't want to abort the
revalidation.

Closes: https://github.com/vercel/next.js/issues/54045
2023-08-25 15:24:06 +02:00
Balázs Orbán
9a2a349639
chore(eslint): bump ESLint plugins (#54490)
Fixes #54480
2023-08-25 10:58:06 +00:00
Tobias Koppers
4d6febf426
Turbopack: add edge support for pages apis (#54449)
### What?

* add support for middleware manifest and edge adapter for pages API
routes
* improve the error reporting a tiny bit

### Why?

### How?


Closes WEB-1428
2023-08-25 09:11:31 +02:00
Zack Tanner
dbac7552eb
fix resolve routes behavior when matching a dynamic segment (#54539)
When `fallback: false` is set and you visit a dynamic segment (e.g. `/[slug]`), the router server was getting stuck in a `x-no-fallback` loop and eventually would fail because it was matching the output at `check_fs` before attempting to resolve dynamic routes in the `check: true` block.

Closes NEXT-1557
2023-08-25 02:14:09 +00:00
JJ Kasper
36b45c6f50
Break-up install and build steps for PR stats (#54536)
Breaks up these commands to track down the timeout for release stats. 

x-ref: https://github.com/vercel/next.js/actions/runs/5969590815/job/16195862006
2023-08-25 02:00:36 +00:00
Ahmed Abdelbaset
7ac6bb1a88
docs: Add missing parameters to both useSelectedLayoutSegment & useSelectedLayoutSegments (#53602)
This PR adds missing parameters to the `useSelectedLayoutSegment` & `useSelectedLayoutSegments` hooks since they take *optional* `parallelRoutesKey`.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-08-24 23:14:47 +00:00