Commit graph

16309 commits

Author SHA1 Message Date
JJ Kasper
d457e989ff
Revert "Update swc_core to v0.78.15" (#51716)
Reverts vercel/next.js#51269

This is breaking some builds it looks like

x-ref: https://github.com/vercel/next.js/actions/runs/5357843108/jobs/9719367732
x-ref: https://github.com/vercel/next.js/actions/runs/5357843108/jobs/9719368519
2023-06-23 17:12:47 +00:00
이현재
889e2203a5
Update page.tsx tw className (#49040)
I changed the tailwindcss code, which is written differently than the
other elements in `app/page.tsx`

<!-- 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 or adding/fixing 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: Shu Ding <g@shud.in>
2023-06-23 17:11:59 +02:00
Delba de Oliveira
bb38fe5f08
[Docs] Update link validator: use checks, fail on PR from forked repo (#51706) 2023-06-23 14:39:29 +00:00
Tyler Lutz
b7d49e0e0f
Fix typo in 01-typescript.mdx (#51669)
Change 'Previous' to 'Previously'
2023-06-23 14:13:19 +00:00
Donny/강동윤
5f3d7c43ea
Update swc_core to v0.78.15 (#51269)
### What?

Update SWC crates to 8b765e6763

### Why?

There were many patches.

### How?

Closes WEB-1174

Turbopack counterpart: https://github.com/vercel/turbo/pull/5288
2023-06-23 11:40:11 +00:00
Bigyan
df08b22e7f
docs: fix generated app icons file extensions (#51562)
The file extensions of the generated file extensions section are not what it's supposed to be or not what documentation has specified.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-06-23 10:34:16 +00:00
Tobias Koppers
5abeb99b49
add edge rendering for app dir for Turbopack (#51666)
relanding #50830 and #51631 

### Turbopack Changes

* https://github.com/vercel/turbo/pull/5254 <!-- OJ Kwon - ci(workflow):
upload daily next.js test trace -->
* https://github.com/vercel/turbo/pull/5363 <!-- Tobias Koppers -
disable default features for turbopack-ecmascript-plugins -->
2023-06-23 07:08:17 +02:00
Lee Robinson
f1624b65b4
docs: link to tutorial for incremental adoption. (#51682)
https://www.youtube.com/watch?v=YQMSietiFm0
2023-06-23 01:25:45 +00:00
vercel-release-bot
d0a1e64962 v13.4.8-canary.1 2023-06-22 23:16:54 +00:00
Jiachi Liu
16eb80b0b0
Fix standalone rendering for unmatched _next routes (#51611)
Request data flow in the server

```
request ---> router worker (1) ---> ipc ---> render worker app (2)
                                                              |-----> render worker pages (3)
```

When it's hitting `_next/*` unmatched routes in standalone server, it will render 404, but when you hit `_next/*` it will render app not-found as the app router is always enabled, but router worker isn't set up with require-hook for proper built-in react version, then the app-render will fail with `./server.edge` exports not found error.

We detect if it's in the render worker, then do the app paths rendering instead of directly looking up for app paths in route worker. This could avoid unexpected accesses to the app-render

Fixes #51482 
Fixes #50232
Closes #51506
Reverts changes in #51172
fix NEXT-1260
2023-06-22 22:58:04 +00:00
Jiachi Liu
89f36a98bc
Hot reload when conflicted pages detected and when conflicts are resolved (#51516)
When conflicted pages occur between app and pages server used to throw error and you need to solve the conflicts and restart the server.

This PR capture the error during files aggregation, and send to client to display the error for files confliction. This will send all the conflicts to client and it will still error until you solve all of them. But since the server is not stuck by errors, client can recover once the error is solved.

Closes NEXT-1283
2023-06-22 22:32:14 +00:00
Jiachi Liu
db4b9858ca
Add esm entry for next/server and alias @vercel/og (#51651)
The next-metadata-route-loader emitted content with `"next/server"` is still using cjs version which is not get tree-shaked on edge runtime, This PR adds a new esm entry for it and mapped it that on edge runtime so unused exports can be tree-shaked. This case happened when users are using ImageResponse from `"@vercel/og"` instead of `"next/server"`.

2nd change is adding another alias to map `@vercel/og` package to vendored og package inside next.js, this way we could merge the two package instead of bundled both of them


Fixes: NEXT-1303

changed `require.reoslve("next/dist/xxx")` to `${NEXT_PROJECT_ROOT}/xxx}` to avoid to be traced by nft.
2023-06-22 21:34:12 +00:00
JJ Kasper
f749684921
Update cache handling in draft mode (#51663)
Similar to `getStaticProps` when draft mode is enabled we should bypass
the cache so fresh data is shown.

x-ref: [slack
thread](https://vercel.slack.com/archives/C052BQ8F9EJ/p1687440125828479?thread_ts=1684336597.437409&cid=C052BQ8F9EJ)
and
[tweet](https://twitter.com/tomus_sherman/status/1669023879656873988)

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-06-22 14:03:11 -07:00
Delba de Oliveira
82abde8dd9
Revert "[Docs] Fix validator action breaking when PRs originate from … (#51674)
Nvm, it doesn't work.
2023-06-22 19:50:14 +00:00
Delba de Oliveira
487f5d6b6f
[Docs] Fix validator action breaking when PRs originate from forks (#51668) 2023-06-22 19:22:29 +00:00
vercel-release-bot
554e58c31a v13.4.8-canary.0 2023-06-22 18:19:20 +00:00
Delba de Oliveira
0d7412ccc9
Move the Next.js team back to github codeowners (#51657)
Bring back the previous setting so specific team members get tagged on all PRs.
2023-06-22 17:24:09 +00:00
Tyler Lutz
df0612adf5
docs: Add 'DO NOT EDIT' comment (#51600)
### What?

Adds missing "DO NOT EDIT" comment to some of the shared documentation pages"

### Why?

A few of the shared documentation files didn't have the comment to not edit them.
2023-06-22 16:54:52 +00:00
Delba de Oliveira
8eef11c800
Remove the 'notify' modifier on .vercel.approvers (#51655) 2023-06-22 16:18:37 +00:00
JJ Kasper
d0e7d04dc5
Revert "add edge rendering for app dir for Turbopack" (#51659)
Reverts vercel/next.js#51631

This breaks the windows builds

x-ref:
https://github.com/vercel/next.js/actions/runs/5344032749/jobs/9687974376
x-ref:
https://github.com/vercel/next.js/actions/runs/5344032749/jobs/9687973522
2023-06-22 08:49:50 -07:00
Wyatt Johnson
5871b0d6d7
Pages Error Route Module Rendering (#51374)
Continuing on changes to move the rendering logic into the bundles.

- Unifies edge render functions: `appRenderToHTML` and `pagesRenderToHTML` becomes `renderToHTML`
- When an error occurs, the error module's match is used so the module's internal render can be used (easing transition away from using the server's render method)
- Improved test resiliance
2023-06-22 15:13:13 +00:00
Tyler Lutz
5127c33fc9
Add page router documentation (#51626)
Adds tailwindcss documentation for the pages router.
2023-06-22 14:12:50 +00:00
Keerthi Ramanarayan Meda
e3ad371c97
Add docs for src directory to include tailwindcss (#51619)
Tailwind CSS configuration is missing in the docs when configuring the `src` folder




Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-06-22 13:33:40 +00:00
Tobias Koppers
aa7fdc67b9
fix lockfile (#51650)
concurrent merges...
2023-06-22 13:12:14 +00:00
Jiachi Liu
04b26ffeb3
chore: make next/src/build files indexable on github (#51647)
`build/` folder is by default ignored by github, need to make them indexable for file searching

x-ref: https://docs.github.com/en/search-github/searching-on-github/finding-files-on-github#customizing-excluded-files
2023-06-22 11:32:42 +00:00
Tobias Koppers
99ec3057d7
add edge rendering for app dir for Turbopack (#51631)
## What

* reland #50830 
* remove Object.hasOwn
* fix CSS chunks in edge runtime

## Turbopack Changes

* https://github.com/vercel/turbo/pull/5253 <!-- OJ Kwon -
fix(turbopack): enable runtime flag -->
* https://github.com/vercel/turbo/pull/5295 <!-- Will Binns-Smith -
remove `__internal_nextjs_integration_test` compile-time feature -->
* https://github.com/vercel/turbo/pull/4362 <!-- Donny/강동윤 - Make build
faster -->
* https://github.com/vercel/turbo/pull/5352 <!-- Tobias Koppers - only
wait for JS chunks in none runtime backend -->
2023-06-22 11:43:59 +02:00
Zack Tanner
6f61fb4068
bugfix: route interception with dynamic paths (#51526)
### What?
Paths with interception markers adjacent to dynamic segments are not correctly parsed, which leads to the path match logic failing. 

### Why?
`getParametrizedRoutes` checks for brackets but isn't expecting to receive an interception marker. For example, a path of `/photos/(.)[author]/[id]` results in the following regex:
`/^\/photos\/\(\.\)\[author\]\/([^/]+?)(?:\/)?$/`

This will not match a path of `/photos/(.)zack/1` since it retained the `[author]` brackets.

`getSegmentParam` has a similar issue when getting values for path params, though we can just skip the interception markers and go straight to the params.

Closes NEXT-1166, NEXT-1013
Fixes #48143
Fixes #49614

link NEXT-1013
2023-06-22 09:43:24 +00:00
Alex Kirszenberg
c6313606c9
Next Build Turbo POC (2) (#51546)
Another attempt at getting https://github.com/vercel/next.js/pull/49942 in.

This time, the mold install step is gated to Linux.
2023-06-22 08:03:44 +00:00
Justin Ridgewell
b714ac55c1
Support response aborting (#51594)
### What?

This is an alternative to #51330, which only support aborting the response (doesn't support back-pressure). If the client cancels the request (HMR update, navigates to another page, etc), we'll be able to detect that and stop pulling data from the dev's `ReadableStream` response.

### Why?

We want to allow API routes to stream data coming from another server (eg, AI services). The responses from these other servers can be long running and expensive. In the case the browser aborts the connection, it's critical that we stop streaming data as soon as possible.

### How?

By checking whether `response.closed` is set during the `for await (…)` iteration, we're able to detect that the client has aborted the connection. Cleanup of the `ReadableStream` is handled implicitly by the async iterator when the loop ends.

The one catch is our use of http-proxy for worker processes. It does not properly detect a client disconnecting (but does handle back-pressure). In order to fix that, I've manually added event listeners to detect the disconnect and cancel the proxied req/res pair.

Re: [WEB-1185](https://linear.app/vercel/issue/WEB-1185) (we still need back-pressure)
Fixes https://github.com/vercel/next.js/issues/50364
Fixes https://github.com/vercel-labs/ai/issues/90
2023-06-22 00:43:31 +00:00
Yash Singh
f59710e907
feat: support for numeric separators in revalidate config (#51438)
### Fixing a bug

- [x] Related issues linked using `fixes #number`
- [x] 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

### What?

Currently, when the check on validating the type of `revalidate` is run,
we use the `Number` function to parse the value of `revalidate`, however
the `Number` function takes a
[`StringNumericLiteral`](https://tc39.es/ecma262/2023/#prod-StringNumericLiteral)
which doesn't allow the usage of the `_` separator to format your
numbers. This PR allows you to add numeric separators in the
`revalidate` export.

### Why?

When configuring the actual code, we should be allowed to use numeric
separators as it is a syntax that is supported by most runtimes.

### How?

A simple `replaceAll` call that removes all `_`s between digits.

Closes NEXT-1122
Fixes #49485

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-21 17:22:29 -07:00
Lee Robinson
e73baa5a65
docs: Add Panda CSS to CSS-in-JS docs. (#51484)
https://panda-css.com is a new solution that works with the Next.js App
Router.
2023-06-21 16:12:28 -07:00
Andrey Krasovsky
2cae83d0f2
fix(typo): rename var name in comment (#51531)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-21 16:01:46 -07:00
SHOURYA SHIKHAR
87bfab4448
added good to know in /app based pages and layout in nested layouts (#51558)
<!-- 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?

-->
Added a good to know section mentioning that one should not add `html`
or `body` tags in nested layouts under `/app` based routing.

It was not mentioned anywhere before and often one forgets this while
migrating from the `/pages` based routing

Fixes #51556

---------
2023-06-21 15:42:43 -07:00
Jon Meyers
0674d95d2e
examples: improve with-supabase example (#51442) 2023-06-21 15:37:03 -07:00
Wyatt Johnson
77ef61ea35
Route Module Updates (#51433)
Small QOL improvements to `RenderResult` and `RouteModule` setup. This
also adds a test to verify that headers aren't sent on responses that
have already been sent.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-21 15:30:24 -07:00
Jiachi Liu
f2263f0a6c
Auto fill title/images/description from openGraph for twitter if missing (#51453)
Follow up: #50854 
x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1687016097811079)

---------
2023-06-21 15:19:22 -07:00
vercel-release-bot
4e5fef4f36 v13.4.7 2023-06-21 21:12:57 +00:00
vercel-release-bot
6dd06dbe4d v13.4.7-canary.4 2023-06-21 20:38:43 +00:00
Shu Ding
a0cc4aa65e
Revert "Fix standalone not found" (#51506)
Reverts vercel/next.js#51172

Fixes #51482.
2023-06-21 13:15:05 -07:00
Leah
c1c3675fc4
refactor tests for readability (#51051)
You'll probably want to disable whitespace in the diff

## Description

This allows for better editor support by using `describe` or functions called `describe` with the same syntax instead of custom names.

Changes:
- `nextTestSetup` can be used instead of `createNextDescribe` keeping the same behaviour but being called inside a `describe` "block" (not applied everywhere)
- `getSnapshotTestDescribe` replaced with a custom `describe.each`
- `sandbox` helper function for `acceptance`/`acceptance-app` merged into a single shared one
- `outdent` to remove the indent from inline files in tests which helps with consistent snapshots
2023-06-21 19:47:21 +00:00
vercel-release-bot
c30f21fa77 v13.4.7-canary.3 2023-06-21 18:59:34 +00:00
JJ Kasper
9d043f6e35
Ensure upgrade request has request meta (#51590)
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1686906407341689)
2023-06-21 11:52:12 -07:00
JJ Kasper
4a5074346c
Update flakey build output test (#51625)
x-ref:
https://github.com/vercel/next.js/actions/runs/5328413826/jobs/9653007927
2023-06-21 11:22:57 -07:00
Tobias Koppers
343438ff3b
Revert "add edge rendering for app dir for Turbopack" (#51617)
Reverts vercel/next.js#50830
2023-06-21 10:34:55 -07:00
Shu Ding
2360925718
Temporarily disable flaky test (#51616) 2023-06-21 16:06:26 +00:00
Delba de Oliveira
a43b9ed601
[Docs] Update broken link validator (#51586)
- Add some basic error handling to the link validator action.
- Avoid unnecessarily creating a new bot comment when the validation is successful.
- Only scan .mdx files modified in the current PR for broken links.
2023-06-21 15:31:20 +00:00
Tobias Koppers
36a7aff6d6
use env var to switch next.js to turbopack mode (#51353)
### What?

this forces all tests to use turbopack independent of the way they invoke next dev

### Why?

some tests were not running turbopack

fixes WEB-1187
2023-06-21 13:52:14 +00:00
Jimmy Lai
bc9ed9de98
router: support layout/special files as direct children of parallel routes (#51604)
follow up on #51413 where I kinda forgot to support parsing layout files in sub routes in a parallel segment.

This should fix it by making sure that we check at all level of the app loader tree and by creating an implicit inner `children` for all parallel slot



link NEXT-1301
2023-06-21 11:16:21 +00:00
JJ Kasper
f6998e30a8
Update id env prefix (#51588)
Removes `__` prefix and ensures it's available on client/server as
expected.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04TNLL0LSK/p1687197571572119)
2023-06-20 16:41:28 -07:00
Joshua Baker
2d2180f43d
Moved new line to warnOnce call (#51552)
<!-- 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/Why

The `console.log` call was running per request and polluting logs.

### Locally

```
$ next start
- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- info Loaded env from /next/.env.local

- warn metadata.metadataBase is not set for resolving social open graph or twitter images, fallbacks to "http://localhost:3000". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase














^C
```

### Vercel

<img width="352" alt="Screenshot 2023-06-20 at 12 08 56@2x"
src="https://github.com/vercel/next.js/assets/160484/dee72cd3-aa4e-46d8-886f-9476b9345498">

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-20 16:13:45 -07:00