Commit graph

15570 commits

Author SHA1 Message Date
Jan Kaifer
cc2bcece63
Start recommending gRPC with otel (#48915) 2023-04-28 11:43:28 +00:00
Connor Prussin
20d8e93d1e
Correct some jest types (#48923)
# What?

This PR just refines some of the typescript types around `nextJest`, specifically refining the argument `customJestConfig` and the return value.

### Why?

Before this PR, the return type of `nextJest` was inferred by typescript as `any` which is inaccurate and would require type casting for typescript to enable it to be used in a jest configuration written in typescript.


I didn't add an issue for this since it was so trivial, but I can do so if it would be helpful.
2023-04-28 10:57:41 +00:00
Jiachi Liu
44dc4efad2
Fix dynamic routes for generateImageMetadata (#48928)
* Fix the `generateImageMetadata` for non dynamic routes and related
`param` matching (Found during development)
* Fix dynamic routes with number suffix `(\d)` (Fixes #48689)
2023-04-28 12:27:21 +02:00
vercel-release-bot
c94122dc2c v13.3.2-canary.12 2023-04-28 09:25:25 +00:00
Balázs Orbán
88a033fa1f
chore: expose globalThis.crypto when not available (#48941)
### What?

Exposing `globalThis.crypto`, based on [Node.js' WebCrypto
API](https://nodejs.org/api/globals.html#crypto_1)

### Why?

Similar to `fetch`, `crypto` is a popular API that is currently not
available on `globalThis` in all active Node.js versions yet.

This can help library authors to create runtime-agnostic packages.

### How?

Node.js already has the WebCrypto API that can be imported, we just
expose it on `globalThis` in Node.js versions where this is not
available.

Closes NEXT-1063

[Slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1681821510191059)
2023-04-28 11:18:55 +02:00
sagarpreet-xflowpay
0918ebd69a
fixes #48794 : When using pageExtensions like "page.jsx", global css import not working (#48795)
fixes #48794 


<!-- 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: Jimmy Lai <laijimmy0@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-28 10:23:00 +02:00
Justin Ridgewell
a2a3f5e378
turbopack: parse and propagate output: 'export' (#48046)
Depends on https://github.com/vercel/turbo/pull/4491

This adds support for the new `output: 'export'` configuration, and
propagates the value through to our Node.js rendering code to render.
Unfortunately, we don't support page-level configs at the moment, so we
can't set a `export const config = { dynamic: 'force-dynamic' }` and
test that the export value is being received (I've manually verified it,
though).

Fixes WEB-842
2023-04-28 06:36:32 +00:00
Donny/강동윤
e260adb805
fix: Enable CJS annotations for next.js files (#48811)
### What?

Enable import/export annotations for next.js files.

### Why?

It's required to allow importing next.js modules from node.
`cjs-module-lexer` needs these annotations to import CJS modules.

### How?

Closes WEB-949
Fixes #48801
2023-04-27 23:13:40 +00:00
Kiko Beats
7b66e8aef8
fix: explicit undefined typecheck (#48920)
The current implementation is throwing wrongly if you set a falsy JS value (like `0` or `null`)

So right now this is fail even it's a legit implementation: `process.counter = 0`
2023-04-27 19:01:23 +00:00
Kiko Beats
678c69753b
Upgrade Edge Runtime (#46818)
Hello,

This Edge Runtime update fix some small bugs, and also it allows using `TextDecoderStream` and `TextEncoderStream` for development (aka `next dev`)

Related: https://github.com/vercel/edge-runtime/releases/tag/edge-runtime%402.1.0

Fixes #47189
fix NEXT-833 ([link](https://linear.app/vercel/issue/NEXT-833))
2023-04-27 17:04:14 +00:00
vercel-release-bot
3efbb1a14f v13.3.2-canary.11 2023-04-27 15:21:01 +00:00
Shu Ding
8e723ede65
Change Server Reference creation on client (#48824)
Mostly mirrors the changed made in
https://github.com/facebook/react/pull/26632 to our SWC transform. The
implementation difference is that the AST transformer only adds a
general purpose wrapper call `createServerReference(id)` from an aliased
import, so we can easily change the underlying function in the bundler.
This change only affects the client layer (when `self.config.is_server
=== false`).

Needs to be landed after another React upgrade:
https://github.com/vercel/next.js/pull/48697.

cc @sebmarkbage.
2023-04-27 17:02:23 +02:00
Tobias Koppers
fafecb8438
add missing exports for static generation bailout (#48910)
### What?

add missing exports from next-app-loader

### Why?

avoid crashing

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-27 15:28:10 +02:00
Tim Neutkens
b002102c0b
Ensure __PAGE__ is checked in all cases (#48862)
## What

We recently added the searchParams as part of the __PAGE__ key in the
router. There were still a few cases where it incorrectly checked equals
instead of startsWith.

## How

Searched for ` '__PAGE__'` in order to find the leftover cases and
changed them.

<!-- 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-04-27 14:51:39 +02:00
Alex Kirszenberg
3ed412a308
Selectively load runtime CSS modules to avoid rule duplication (#48866)
See https://github.com/vercel/turbo/pull/4695

### Turbopack changes

* https://github.com/vercel/turbo/pull/4683 <!-- Alex Kirszenberg -
Update benchmark data -->
* https://github.com/vercel/turbo/pull/4695 <!-- Alex Kirszenberg -
Selectively load runtime CSS modules to avoid rule duplication -->

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-27 13:47:36 +02:00
vercel-release-bot
80a9454faf v13.3.2-canary.10 2023-04-27 10:56:05 +00:00
Josh Story
7a5ef27b5e
Preload css (#48840)
This PR implements preloading of CSS from RSC.

1. The underlying Flight protocol was extended in
https://github.com/facebook/react/pull/26502 to allow sending hints from
RSC to SSR and Client runtimes. React was updated to include these
changes.
2. We now call `ReactDOM.preload()` for each stylesheet used in a
layout/page layer

There are a few implementation details to take note of
1. we were previously using the `.browser` variant of a few React
packages. This was a holdover from when there was just browser and node
and we wanted to use the browser variant b/c we wanted the same code to
work in edge/node runtimes. React now publishes a `.edge` variant which
is like `.browser` but expects to be server only. This is necessary to
get the opt-in for `AsyncLocalStorage`.
2. Even with the above change, AsyncLocalStorage was not patched on the
global scope until after React was loaded. I moved this into a module
which is loaded first
3. The component passed to RSC's `renderToReadableStream` is not
actually part of the RSC module graph. If I tried to call
`ReactDOM.preload()` inside that function or any other function defined
inside `app-render.tsx` file it would actually see the wrong instance of
`react-dom`. I added a new export on the RSC top level export which
exposes a `preloadStyle(...)` function which just delegates to
`ReactDOM.preload(...)`. This makes the preload run in the right module
graph


~There are a couple of bugs in React that this work uncovered that I
will upstream. We may want to delay merging until they are addressed.
I'll update this comment when that is complete.~
1. ~React, during SSR, can emit a preload for a style twice in some
circumstances because late discovered stylesheets don't consider whether
a preload has already been flushed when preparing to reveal a boundary
they are within~
2. ~React, during RSC updates on the client, can preload a style that is
already in the document because it currently only looks for existing
preload links and does not consider if there is a stylesheet link with
the same href.~

~both of these issues will not break functionality, they just make the
network tab look at bit more noisy. We would expect network deduping to
prevent multiple actual loads~

The above React bugs were fixed and included now in the React update in
this PR

---------

Co-authored-by: Shu Ding <g@shud.in>
2023-04-27 12:51:52 +02:00
vercel-release-bot
ffefb31efb v13.3.2-canary.9 2023-04-27 08:27:05 +00:00
Tim Neutkens
d9850940ad
Fix scrolling when invisible element is targeted (#48874)
### What?

Mux reported they're experiencing a specific case where scroll wasn't
applied. I've found a bug when the first element in a layout or page,
the one that React will return from `findDOMNode`, is display: hidden.
At that point the rect is is `0` `0` `0` `0` and the current logic
assumes that means it's in the viewport as it's top `0`.

In order to fix this I've looked at a few ways:

- Scrolling to top when the element is not visible
- Scrolling to the parent element that is visible
- **Scrolling to the closest sibling (nextSibling) of the element that
is visible**

Eventually I landed on the third option after looking at the Mux case,
my reproduction, and the way vercel.com's pages leveraging App Router
are structured.

### How?

Used a while loop to check if the domNode is visible, if not we continue
to the next sibling until one that is visible is found. If none are
found we bail on resolving further.

While looking into this it highlighted that we should add a global
scroll handler in app-router too for the case where none of the
layout-routers apply scroll. With this fix that is less urgent though so
I've added a todo.


Fixes NEXT-1056

<!-- 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-04-27 10:00:51 +02:00
JJ Kasper
0b59b1708f
Update min Node.js version to v16 (#48903)
Since Node.js v14 is [end of life this week](https://github.com/nodejs/Release) this updates our minimum supported Node.js version to v16. 

x-ref: [slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1681225776529319?thread_ts=1681202375.559349&cid=C04DUD7EB1B)
2023-04-27 07:31:27 +00:00
Tobias Koppers
b50ecb7e53
add support for static implicit metadata in turbopack (#48823)
### What?

* support local static metadata files; opengraph-image, twitter-image,
favicon, manifest, icon, apple-icon
* support global static metadata files: robots.txt, sitemap.xml,
favicon.ico
* dynamic metadata is not yet implemented, but yields a warning

It's implemented a bit different compared to the webpack version.
All images will use the usual image machinery, so they are emitted to
output directory, content hashed and the url is shared with the same
import import in the app.

### Why?

Unsupported, and we want to have that.

### How?

see also https://github.com/vercel/turbo/pull/4692

fixes WEB-524
2023-04-27 05:54:53 +00:00
vercel-release-bot
0cfa3fce23 v13.3.2-canary.8 2023-04-27 03:40:24 +00:00
JJ Kasper
073a1753d0
Ensure require-hook env is set properly on deploy (#48902)
This ensures we set the pre-bundled react env variable early enough when
in a deploy environment as otherwise incorrect react versions could be
initialized with app directory.

Test deployment with fix can be seen here
https://metadata-dynamic-lsbqdamud-vtest314-ijjk-testing.vercel.app/dynamic/test

This re-adds the patch we were doing before
b5f7f84485 (diff-90d1d5f446bdf243be25cc4ea2295a9c91508859d655e51d5ec4a3562d3a24d9)

No additional tests were added here as existing e2e deploy tests were
failing without this.

Fixes: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1682546721052149)
Fixes: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1682539142269669)
Fixes: https://github.com/vercel/next.js/issues/48872
2023-04-26 22:28:51 -05:00
Sebastian Markbåge
f4a01b4b0e
Make prefetch not async (#48897)
The prefetch method is currently an async method but there's nothing to await. It's updated out-of-band. It shouldn't return a Promise.

I also found a console.log that looked out of place.
2023-04-27 00:17:05 +00:00
Jiachi Liu
98e0c4a51c
External vercel og for nodejs runtime (#48844)
### Why

Default font file of `@vercel/og` is not loaded, because the og package is bundled by webpack and we should external it so that `fs.readFileSync` is bundled and manged that can't be traced by nft.


### How
This PR externals `@vercel/og` so that they don't need to be bundled and files can be properly traced

Closes NEXT-1047
Fixes #48704
2023-04-26 23:36:42 +00:00
Tobias Koppers
219d1d49c7
update turbopack (#48893)
### What?

* https://github.com/vercel/turbo/pull/4700 <!-- Tobias Koppers - update
deps -->
* https://github.com/vercel/turbo/pull/4706 <!-- Tobias Koppers - make
library code less verbose in stack traces -->
* https://github.com/vercel/turbo/pull/4705 <!-- Tobias Koppers -
improve error handling in update stream -->
* https://github.com/vercel/turbo/pull/4667 <!-- Caleb Webber - remove
box_syntax -->
* https://github.com/vercel/turbo/pull/4714 <!-- Tobias Koppers - chunk
hash need to include availability root -->
* https://github.com/vercel/turbo/pull/4709 <!-- Alex Kirszenberg -
Allow the dev server socket to be reused immediately -->
* https://github.com/vercel/turbo/pull/4716 <!-- Tobias Koppers - errors
lead to consistent exit code in issue detail -->
2023-04-27 00:46:04 +02:00
Jiachi Liu
7c1ee055ce
test: disable client cache flaky test (#48890)
x-ref: https://github.com/vercel/next.js/actions/runs/4813019532/jobs/8569073395?pr=48844
2023-04-26 21:44:50 +00:00
OJ Kwon
ea472e8058
refactor(next-core): emit unsupported package warning (#48837)
### What?

WEB-953. 

This PR moves, bubbles up unsupported package warning from turbopack to next-core using resolve plugin. Featurewise it behaves same, however removes turbopack aware specific next.js package (`@vercel/og`) internally.
2023-04-26 21:11:07 +00:00
Jiachi Liu
a4d63092e8
Support generate dynamic sitemaps for dynamic routes (#48867)
### What

For dynamic routes you might have different sitemap for different params

* Unloack using `sitemap.[ext]` in your app everywhere
* Support `generateSitemaps()` to create multiple sitemaps at the same time

### How

* Change the metadata regex to allow use sitemap in every routes
* Similar approach to `generateImageMetadata`, we make `sitemap.js` under dynamic routes to a catch all routes, and it can have multiple routes

Closes NEXT-1054
2023-04-26 20:41:37 +00:00
Shu Ding
b6e0c350ed
Update the mutableCookies class to accept extra options (#48877)
This PR changes `mutableCookies` from `RequestCookies` to a
`ResponseCookies` instance, and it now accepts extra options for each
cookie. Take a look at the tests for more details.

cc @styfle

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-04-26 19:13:03 +00:00
JTaylor0196
f7baa56792
update example Deploy button URLs (#48842)
### What?
Updates Deploy button URLs for all listed examples here:
https://github.com/vercel/next.js/tree/canary/examples

### Why?
The Deploy URLs are currently broken and result in a failed clone
attempt on Vercel.

### How?
The URLs have been changed from https://vercel.com/new/git/external?… to
-> https://vercel.com/new/clone?…
(Last updated
[here](8eaabe2fb0)
in 2021)
2023-04-26 13:31:44 -04:00
Tobias Koppers
6e896d3dc8
add missing aliases for next/dynamic and next/head (#48871)
### What?

missing aliases for app dir functionality

### Why?

### How?
2023-04-26 18:53:36 +02:00
Kiko Beats
1274713b1a
edge: expose Websocket constructor (#48870)
This PR make possible to use WebSocket in an Edge Function 🙂
2023-04-26 17:38:39 +02:00
Martin Wahlberg
c390c1662b
Add missing word to getStaticProps documentation (#48854)
### What?
Added missing `that` to documentation for getStaticProps

### Why?
This change fixes grammar.

### How?
Updated the text.
2023-04-26 14:02:53 +00:00
OJ Kwon
f3d5c2fe9e
refactor(next-swc): turbopack_ecmascript_plugins (#48671)
<!-- 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?

This PR is necessary changes to apply
https://github.com/vercel/turbo/pull/4662. Need turbopack bump to make
CI pass.

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-26 15:55:53 +02:00
Shu Ding
b21fd96606
Implement MutableRequestCookies in server entries (#48847)
Similar to #47922 but based off the latest server implementation and #48626:

> This PR implements the MutableRequestCookies instance for cookies() based on the current async context, so we can allow setting cookies in certain places such as Server Functions and Route handlers. Note that to support Route Handlers, we need to also implement the logic of merging Response's Set-Cookie header and the cookies() mutations, hence it's not included in this PR.
>
> fix [NEXT-942](https://linear.app/vercel/issue/NEXT-942)

This PR also adds the same support for Custom Routes.

cc @styfle.

fix NEXT-942, fix NEXT-941.
2023-04-26 13:19:01 +00:00
Tim Neutkens
da2804f974
Fix scrolling on navigation in app (#48863)
## What?

When investigating #48852 I found that when there's a `segmentPath` set
in the `focusAndScrollRef` it would compare that entire path with the
`segmentPath` of the layout-router. This logic works in cases where the
entire page is rendered but doesn't take into account cases where for
example a suspense boundary is triggered below the common layout.

Because of the order `useEffect` is run in we can already assume that if
a more specific match existed it would have scrolled there. As that is
not the case in e.g. #48852 it ended up opting out of scrolling
entirely. In order to fix that the logic needs to be different, it needs
to check if the layout-router's `segmentPath` matches, if it matches
every level then we can apply scrolling in that layout-router.

## How?

Implemented the opposite of the current logic, running `.every` on the
layout-router segmentPath instead of on the router provided segmentPath.

Fixes #48852
Fixes NEXT-1053

Related PR #48862

<!-- 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-04-26 14:33:58 +02:00
Jan Kaifer
6902e5b547
Fix issues where saving next.config.js too quickly could result in multiple dev servers running at once (#48857)
We were adding filling in our cleanup function after we started our server. So If we restarted while the server was starting, we would fire an empty cleanup function which would lead to the server not being cleaned up (once it starts).

The only slight issue is that it won't watch for changes while cleaning up the previous run (waiting for the server from the last run to start and finish).

fix NEXT-1052
2023-04-26 09:58:50 +00:00
vercel-release-bot
1c0c61a66c v13.3.2-canary.7 2023-04-26 08:38:47 +00:00
Tobias Koppers
5a46b01ab9
update turbopack (#48846)
* https://github.com/vercel/turbo/pull/4692 
* https://github.com/vercel/turbo/pull/4595 
* https://github.com/vercel/turbo/pull/4690 
* https://github.com/vercel/turbo/pull/4663
2023-04-26 06:55:37 +00:00
Shu Ding
f12aa35b0d
Fix accessing strict of undefined in writeConfigurationDefaults (#48799)
Fixes the 

```
TypeError: Cannot read properties of undefined (reading 'strict')
    at writeConfigurationDefaults
```

error.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-25 15:53:21 -05:00
Shu Ding
641d419ada
Add async context to server request handler (#48626)
This PR adds an `AsyncLocalStorage` wrapper to the action handler, so
underlying function calls can tell if it's running in that.
2023-04-25 18:45:10 +02:00
Shu Ding
ac8de9fae8
Polyfill FormData with edge-runtime primitives (#48826)
It makes more sense to use the `FormData` from `@edge-runtime/primitives` to ensure the version and implementation are aligned, and avoid importing extra modules (as we always import the Edge Runtime).
2023-04-25 15:55:31 +00:00
Tobias Koppers
8602bf35e0
fix query for app dir in turbopack (#48828)
### What?

Fix the query for app dir

### Why?

it's not correct in app dir
2023-04-25 15:31:07 +00:00
Shu Ding
287e379b92
Vendor react@experimental (#48697)
Part of #47759 (which had been reverted twice so here we only land a part of the change), relates to NEXT-926. Thanks to #48506 we can soon switch between these two channels during runtime.

Also fixes a problem of `renderKind` (only revealed after upgrading React), it should be also based on the `match` kind.
2023-04-25 14:29:02 +00:00
Shu Ding
f08cab3b0f
Only track client entry modules in the client reference manifest (#48814)
This is currently an overhead, that we check a module's layer (`mod.buildInfo.rsc?.type === RSC_MODULE_TYPES.client`) and put all client modules in the client reference manifest, but the manifest is only used for accessing these entry modules. So here we change the util to check if it's an client entry instead.

With this change the client manifest of a test app decreased from 177 KB to 70 KB.

Ref: 5b609e264f/packages/next/src/build/analysis/get-page-static-info.ts (L50-L64)
2023-04-25 12:27:53 +00:00
Jiachi Liu
0f6b357181
Improve typing of resolve metadata (#48670)
Improve array resolving in metadata, remove ts comments for errors
2023-04-25 10:17:54 +00:00
vercel-release-bot
9863935f44 v13.3.2-canary.6 2023-04-25 09:13:29 +00:00
Tim Neutkens
ee86ace5ce
Fix hash apply after server-patch action (#48813)
### What?

Mux reported that their website does not scroll to hash when clicking a search result. Found it's related to `server-patch` triggering and overriding the hashFragment. That should be preserved similarly to `apply`.

### How?

handleMutable had a default of `null` instead of using the existing value. It should use the existing value.
2023-04-25 09:05:44 +00:00
Donny/강동윤
a18f50a321
fix: Update @swc/helpers to v0.5.1 (#48808)
### What?

Update `@swc/helpers` to `v0.5.1`.

### Why?

Webpack merges `@swc/helpers@v0.4.x` and `@swc/helpers@v0.5.x`, due to `resolve.alias` config in 2f6ff0dab3/packages/next/src/build/webpack-config.ts (L1070-L1072)

To workaround it, `@swc/helpers@v0.5.1` reexports from entries just like `v0.4`.

### How?

Closes WEB-948
Fixes #48593
2023-04-25 04:32:27 +00:00