Commit graph

15865 commits

Author SHA1 Message Date
Mark Barton
aaf7fa5d25
Update app-static-to-dynamic-error.md (#50085)
spelling error
2023-05-21 19:38:22 +00:00
Abhishek Kadam
a8621c7bb2
[create-next-app]: respecting the user's init.defaultBranch git con… (#49960)
### What?
This commit makes sure `create-next-app` doesn't ignore user's git configuration (`init.defaultBranch`).
### Why?
Hard coding configurations of a user is annoying (for the user).


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-05-20 23:53:58 +00:00
OJ Kwon
77a3172b8e
feat(turbopack): initial sass-loader support (#49882)
<!-- 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



### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?
WEB-654.

This PR attempts to implement initial sass support in turbopack, via
sass-loadder. Internally it points to sass-loader compiled in next.js
(`next/dist/sass-loader..`) with next.config.js's option. Still it is
not a complete implementation, for example sourceMap is not supported by
upstream turbopack.

PR requires turbopack side changes as well.
2023-05-20 00:38:12 +00:00
vercel-release-bot
804ca09383 v13.4.4-canary.0 2023-05-19 22:20:30 +00:00
Karl Horky
347da42eb1
Add optional generic parameter to NextResponse (#47526)
Fixes #45943

### What?

Allow for type checking the return type of a Route Handler in the `app/`
directory:

[TypeScript
Playground](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAkgOQCoFEBKCCCAZAyjAXhlwE8BbAIxABsAKAcgEswoBTAJzAENqZ3WIAB3ARW9AJQAoSawAew9rGDUuECDARyoaAcMisAPACEQAExKEYAVzABrMCADuYAHwwtrMKfU6hI1jAA3pIwMADaiKgYOLgAugBcQSGhMCbmAPyJaSQANMkAvtKhoJBQ7FbAUCDstFQZWWYkcGCMsAA+MGBW1NQ5MMytib56os2tloH54kkpMBBWghy1jX0DUFLJoVAAFowQEcjoWHixE4WhhcnQXFCMwDAAVhDgBgBSz2DZLsvmie-g2VWLSgmRgw38Y3WiU0sm0un8bw+XxmKQA9KiYAABKAQAC0ckWlXx7HY1RgSF26j2nRAsGYMGojAoqNMIDIfEYAHNtrAHI4+lwvDBHAFgIL6LAuFZOWRPHSoAA6TYwErQPjw-RDDWiSzg-QKp7gH65frAqSzfhQKycTqsRwaLR60S0fh+fV1E2ukasc0wQqXAnVWAAMxslUY4BgAHEUEhaOJoY7tYZAlwKMBEgBGABMAGZ8m5AjB0dHPBw7jAuOxOVZZSwYIJVKJTMlGMGYLQALI3bYK9iC1lkeMwNwABgVAFZpkXlZbrWAHbCnawDR9aKn01m81NixjAKDkNPcJOqiQ9Kuq-EqBWSc5tMLhbtEq6NgVMrGDiXosm-9B3JYPHCkuwp6NKaoAkqwV4BvIQYwKGYDhpGMZINm8aJkuyZBLuGggDAnJluwFZVjWdawFYzatu2XY9n2A5ssOY6TtOMCzqwVp3kmj4roaYDrmmGYwDm+bTP+h6ASelZgBYZ5cMAwCsIIbAthcN5sfOi4Pt6z68a+76ft+si-iJ+5icewGSdJoGyfJimsC2hRAA)

![Screenshot 2023-03-25 at 16 59
51](https://user-images.githubusercontent.com/1935696/227728328-43350f50-5067-4d27-8701-000569e757cc.png)

### Why?

There is currently no nice way to enforce the return type of a Route
Handler in the `app/` directory.

This is possible with `NextApiResponse` in the `pages/` directory,
because of this PR:

- https://github.com/vercel/next.js/pull/7841

### How?

This implements a generic parameter for the `NextResponse` class, which
can be used to pass a type argument when setting the return type for a
Route Handler.

<!-- 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>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-05-19 23:40:06 +02:00
Jiachi Liu
7450ab41df
test: disable cache flaky test (#50064)
x-ref: https://github.com/vercel/next.js/actions/runs/5026701083/jobs/9015343205?pr=50059
x-ref: https://github.com/vercel/next.js/actions/runs/5018835183/jobs/8998764611?pr=49965#step:6:5579
2023-05-19 21:19:56 +00:00
JJ Kasper
d6a3e7d07b
Remove node-sass from peerDependencies (#50065)
This removes `node-sass` from being explicitly marked as a peer
dependency as it's not recommended anymore and `sass` is already marked
as a `peerDependency`, further when auto-install peer dependencies is
enabled it can cause this to be pulled in unexpectedly
2023-05-19 13:10:10 -07:00
Justin Ridgewell
3558208df3
Add x-forwarded-* headers to turbopack renders (#50012)
This PR forwards the [new
`ServerInfo`](https://github.com/vercel/turbo/pull/5018) struct to
Turbopack's rendering processes, allowing it to initialize the
requesting headers with the `x-forwarded-*` headers. These headers, and
`x-forwarded-proto` in particular, are necessary for [NextAuth to
work](https://github.com/nextauthjs/next-auth/blob/f62c0167/packages/next-auth/src/core/index.ts#L73-L76).

These headers are initialized in the non-turbo server via
[`http-proxy`](https://github.com/http-party/node-http-proxy/blob/9b96cd72/lib/http-proxy/passes/web-incoming.js#L58-L86).

Fixes WEB-1064
2023-05-19 12:57:02 -07:00
Jiachi Liu
702eb17638
Fix client references extraction of CJS exports analysis (#50059)
client refs are not correctly extracted as we're using regex to get the exports names from cjs file. The regex was extracting some bad names from the code source, this PR fixes the regex to make sure they extract the correct content

Fixes NEXT-1213
2023-05-19 19:42:46 +00:00
Shu Ding
d381d581cf
Fix types of cookies() (#50052)
As explained in the comments, the `cookies()` API is a mix of request and response cookies. For `.get()` methods, we want to return the request cookie if it exists. For mutative methods like `.set()`, we return the response cookie type instead.
fix #50049
fix NEXT-1211
2023-05-19 19:02:16 +00:00
Shu Ding
26ea9c6333
Always defer close tags to be the suffix of body stream (#50056)
Currently the suffix logic is for pages so nothing happens in app dir. This PR changes it to **always** apply the `createSuffixStream(closeTag)` transform, to defer `</body></html>` to the end of the stream.
fix #48372
fix NEXT-1200
2023-05-19 18:25:04 +00:00
Jiachi Liu
f0d0811a42
Fix default metadata is missing in root not-found (#50044)
* Adding default metadata to root not found under root layout
* Refactor the tests a bit, previously it only checks if the text existed in html, it actually exisits in flight response

Fixes #49979
Closes NEXT-1207
2023-05-19 17:50:03 +00:00
Justin Ridgewell
448b74291e
[turbopack]: Update renamed SubpathValue (#49636)
https://github.com/vercel/turbo/pull/4895 renamed `ExportsValue` into
`SubpathValue`

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-05-19 18:46:10 +02:00
Jiachi Liu
0800ea7eec
Error in next export when serverActions is enabled (#50039)
Reland #49959 as it was reverted in #50019

* Only error when runing `next export` or `output` is "export"
* Add e2e test


Closes NEXT-634
2023-05-19 17:53:21 +02:00
Shu Ding
771141dcc9
Server Actions: Fix member expr in closure captured values (#50020)
For static member expressions like `foo.bar`, we currently treat it as one whole Ident `foo.bar` and pass it over the `$$bound` array as one value. That causes a problem where the Ident inside the function body needs to be converted, because it can no longer access to `foo`.

Closes #49985. 
fix NEXT-1206
2023-05-19 15:05:59 +00:00
Wyatt Johnson
1dcff1da62
Pages Module Transition (#49962)
This serves to create the loader that will allow us to transition more
of the rendering logic into each of the bundled entrypoints. This only
applies to pages routes inside the `pages/` folder in the node
environment.

fix NEXT-985

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-05-19 08:45:18 -06:00
OJ Kwon
dd85daaf4e
test(turbopack): script to sync latest test lists (#50008)
<!-- 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 #

-->

This PR adjusts manifests for the next.js test with Turbopack, as I
found upstream test keep changing and need to sync its latests state
into the manifest.

Manifest is now .js file contains 2 arrays, one for the enabled, and
others for the disabled. Disabled doesn't mean it's always failing
though.
2023-05-19 09:10:29 +02:00
vercel-release-bot
66a0083235 v13.4.3 2023-05-19 06:20:19 +00:00
vercel-release-bot
f299b0d86e v13.4.3-canary.3 2023-05-19 03:14:37 +00:00
JJ Kasper
9b0af737b8
Suggest a replay in the bug issue template (#50022)
x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1684457147422049)
2023-05-18 19:54:15 -07:00
OJ Kwon
eb2650ae68
build(cargo): update turbopack (#50013)
<!-- 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 #

-->

This PR updates turbopack to the latest.
2023-05-19 02:03:18 +00:00
Steven
4b4925f4e8
fix: set cookies followed by redirect() (#49965)
- Fixes #49237 


fix NEXT-1120

Co-authored-by: Wyatt Johnson <633002+wyattjoh@users.noreply.github.com>
2023-05-19 00:17:19 +00:00
JJ Kasper
ea9b1f5ebc
Remove custom handling for prebundled react env (#49954)
This removes the previous handling for the prebundled react env we were
setting in favor of https://github.com/vercel/vercel/pull/9974

We need to wait to land this until
https://github.com/vercel/vercel/pull/9974 has been rolled

Fixes: https://github.com/vercel/next.js/issues/49169
Fixes: https://github.com/vercel/next.js/issues/49753
x-ref: https://github.com/vercel/next.js/issues/48948
2023-05-18 16:51:18 -07:00
Tim Neutkens
c2da56e194
Fix going back to page after applying hash link (#50006)
## What?

@steven-tey noticed that on upstash.com that scrolling to hash keeps
happening regardless of the hash being set:

- Open site
- Click `Pricing` which adds `#pricing` and scrolls to the
`id="pricing"`
- Click `About` 
- Click on the logo

You'll notice that navigating back to the homepage ends up scrolling to
the `id="pricing` instead of to the top of the page.

## How?

This happened because we didn't reset the `hashFragment` and
`segmentPaths` for scrolling when scroll was applied, which means it
would keep that value in the state and would be applied as such on
navigation.

This PR ensures that besides setting `apply` to `false` we also reset
the `hashFragment` and `segmentPaths`.

Fixes NEXT-1205

<!-- 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: JJ Kasper <jj@jjsweb.site>
2023-05-18 16:33:58 -07:00
Steven
783acc59a0
fix: warning fetch for [object Request] specified (#50003)
This PR fixes a warning that previous looked like the following:

```
Warning: fetch for [object Request] specified "cache: default" and "revalidate: 60", only one should be specified.
```
2023-05-18 23:20:05 +00:00
Steven
0a81cc0f16
Revert "Error in next export when serverActions is enabled" (#50019)
Reverts vercel/next.js#49959 since the PR [was failing CI](https://github.com/vercel/next.js/actions/runs/5015634314/jobs/8991545593#step:6:179)
fix NEXT-634
2023-05-18 22:26:02 +00:00
Tim Neutkens
babe50364e
Reset not-found and error boundary when navigating (#49855)
## What?

Currently the error boundary state does not reset when a navigation
happens because the `key` does not change. Because of that navigating
using next/link when the error boundary is in the open state ends up not
rendering the contents of the new navigation, instead it keeps the error
boundary contents.

## How?

This PR uses a pattern that is recommended in the React docs (setState
during render) to reset the error boundary if the `usePathname` value
has changed, it is used as a proxy for a new navigation.

Fixes #47862
Fixes NEXT-963
Fixes #49736
Fixes #49732
Fixes #49599


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

-->
2023-05-18 22:06:57 +02:00
Maia Teegarden
e5eab8b38d
update with-turbopack example (#49332)
Updated to latest app-playground code
2023-05-18 17:33:02 +00:00
Shu Ding
eaea2084de
Error in next export when serverActions is enabled (#49959)
Since a server is always required for Server Actions, they won't work
with static exports at all.
fix NEXT-634

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-05-18 17:56:02 +02:00
Shu Ding
c7e5d76717
Fix custom server React resolution with app dir and pages both presented (#49805)
If running Next.js in the custom server with both app and pages directories presented, a standalone server needs to serve all traffic and the server running in main thread should be a no-op. (cc @ijjk).

Fixes the problem described here: https://github.com/vercel/next.js/issues/49355#issuecomment-1537536063.
2023-05-18 01:31:43 +00:00
Jiachi Liu
a09dc5f268
Add @vercel/og to external server packages (#49944)
`@vercel/og` should also be treated as external package as precompiled one (x-ref: #48844)

As it's ESModule, it could escalate the importee modules to become ESM as well, then `require()` won't be able to load the proper module, we need to switch to await the require result (just like **dynamic import**) for node module loader

[slack thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1683577269970609?thread_ts=1683569728.697039&cid=C03KAR5DCKC)
2023-05-17 21:23:31 +00:00
JJ Kasper
f3ae39530a
Update default for appDocumentPreloading config for minimalMode (#49952)
This config shouldn't be needed in minimal mode as code is evaluated
just-in-time
2023-05-17 14:00:59 -07:00
vercel-release-bot
20db2f3b0d v13.4.3-canary.2 2023-05-17 16:59:53 +00:00
JJ Kasper
917b9aefeb
Move build workers count change behind flag (#49937)
It seems the build workers count calc change that was made in https://github.com/vercel/next.js/pull/47823 caused a regression in performance as we aren't utilizing as many workers as we previously did so this moves that change behind an experimental flag while additional tweaking is investigated. 

x-ref: https://github.com/vercel/next.js/pull/47823
Fixes: https://github.com/vercel/next.js/issues/49593
2023-05-17 15:54:42 +00:00
Alex Kirszenberg
91861210a7
Port sorted-routes.ts to Rust (#48334)
`getSortedRoutes` is used in the `BuildManifestPlugin`, which I'm in the
process of porting to Next.js Turbo as part of Next Build. As such, I
ported it to Rust using GPT-4 (with manual review over the code).

The resulting code is not particularly idiomatic nor optimized Rust
code, but it passes all tests (similarly converted) and should be more
than fast enough for now.

In the process of porting, GPT-4 made some "suggestions" (read: it
automatically and silently changed parts of the code) which actually fix
some formatting issues with errors:
https://github.com/vercel/next.js/pull/48298

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-05-17 17:00:21 +02:00
Alex Kirszenberg
051c90d43c
Introduce NextMode (#49852)
This introduces a `NextMode` enum that controls which mode Next.js Turbo
is currently running in:
* `NextMode::Development`: `next dev`
* `NextMode::Build`: `next build`

Requires https://github.com/vercel/turbo/pull/4972

This also update Turbopack to `turbopack-230517.2` with the following
changes:

* https://github.com/vercel/turbo/pull/4972 <!-- Alex Kirszenberg -
Configure React development flag, inherit NODE_ENV from execution
context -->

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-05-17 16:22:50 +02:00
Jiachi Liu
7641278f82
Fix port value for metadataBase (#49924)
metadataBase is using `process.env.PORT` to construct a host when there's no `metadataBase` specified in layout. Dev server needs to pass down the PORT env from the parent prcoess.

Fixes #49807
Fixes #49859
Closes #49889
2023-05-17 13:37:47 +00:00
Shu Ding
4970811c5d
Fix chained .bind of Server Actions (#49874)
This makes sure that you can `.bind` a Server Action multiple times. Thanks to the feedback from @sophiebits:  https://github.com/vercel/next.js/pull/49422#pullrequestreview-1419134304
2023-05-16 22:36:17 +00:00
Rodrigo Esteves
9e5116975d
Upgrading react-ga to react-ga4 (#48932)
taken from google analytic's page:

 "_On July 1, 2023, this property will stop processing data. Starting in March 2023, for continued website measurement, migrate your original property settings to a Google Analytics 4 (GA4) property, or they'll be copied for you to an existing GA4 property, reusing existing site tags._"

The package 'react-ga' doesn't support GA4, so i updated the package to 'react-ga4', the example continues primarily the same, the only differences is that specifying 'pageview' is now required instead of just setting the location of the pageview and the expection() function doesn't exist in this package.

required changes are welcomed




Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-05-16 22:06:09 +00:00
OJ Kwon
de08f8b3d3
refactor(next-core): move transforms to plugin (#49621)
### What? 

relateed to WEB-1048.

Moving emotion to the plugin, deprecate enable_emotion option.
2023-05-16 17:47:31 +00:00
Shu Ding
05a9e0ac49
Fix conflict when re-exporting multiple Client References (#49468)
Closes #49324. Default export should only be added in the loader
generated boundary file when it actually exists.

fix NEXT-1112
2023-05-16 12:35:12 +02:00
Alex Kirszenberg
2dade5df48
Refactor pages structure (#49802) 2023-05-16 11:52:57 +02:00
Donny/강동윤
e5ad96edd5
chore(turbopack): Update swc_core to v0.76.6 (#49792)
### What?

Updates `swc_core` to `v0.76.x`, which adds support for `Explicit Resource Management` (stage 3)

### Why?

It's stage 3

### How?

Closes WEB-1040


---

turbopack counterpart: https://github.com/vercel/turbo/pull/4937

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2023-05-16 05:08:17 +00:00
vercel-release-bot
33bdf6105c v13.4.3-canary.1 2023-05-16 03:01:47 +00:00
Leah
aeed1c770a
add support for globally providing mdx components to turbopack (#49818)
### What?

Adds support for `mdx-components` at the root/src directory.
This is a feature `next-mdx` already has:
https://github.com/vercel/next.js/tree/canary/packages/next-mdx#usage-1

Fixes WEB-1012

Depends on https://github.com/vercel/turbo/pull/4944

### Turbopack updates

* https://github.com/vercel/turbo/pull/4949 <!-- OJ Kwon -
refactor(turbopack): deprecate single react_refresh options -->
* https://github.com/vercel/turbo/pull/4944 <!-- Leah - add mdx
`providerImportSource` option -->
2023-05-16 00:45:08 +00:00
Dev Agrawal
9e978cf64f
with-clerk example updated to app router (#49717)
<!-- 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?
Updates the `with-clerk` example to use the app router and latest
version of `@clerk/nextjs`
### Why?

### How?

Closes NEXT-
Fixes #

-->

Updates the `with-clerk` example to use the app router and latest
version of `@clerk/nextjs`
2023-05-15 22:25:43 +00:00
Rishabh Poddar
af3380790e
Update with-supertokens example (#49804)
Update dependencies of our SDKs to point to the latest version

---------
2023-05-15 14:25:43 -07:00
OJ Kwon
a7601213ab
refactor(next-core): consolidate react_refresh options (#49822)
<!-- 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



### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

WEB-1049. Removes separate enable_refresh options.
2023-05-15 19:31:42 +00:00
Leah
138a795263
turbo-binding -> turbopack-binding (#49816) 2023-05-15 17:02:25 +00:00
Travis Arnold
6fd866bfd7
add @swc/core to server external packages (#49721)
<!-- 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 #

-->

Adds `@swc/core` to the default external server packages for use in
packages within node_modules. This package is useful for generating
documentation and is related to #48739. Ideally, this would be respected
by the `serverComponentsExternalPackages` options.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-05-15 17:56:23 +02:00