Commit graph

13534 commits

Author SHA1 Message Date
Max Proske
ce0bcd38f2
Convert with-gsap, with-mqtt-js, with-mux-video examples to Typescript (#43874)
Converted three more examples to TypeScript.

Changes to individual examples pushed as separate commits.

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm build && pnpm lint`
- [X] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-12 01:53:08 +00:00
Shu Ding
6cfebfb02c
Skip creating VSCode config and .gitignore if running in CI (#43935)
NEXT-233

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-11 00:08:07 +00:00
Shu Ding
1fb4cad2a8
Add auto completion for prop names and types to the TS plugin (#43909)
For example, [named
slots](https://nextjs.org/blog/layouts-rfc#convention:~:text=After%20this%20change%2C%20the%20layout%20will%20receive%20a%20prop%20called%C2%A0customProp%C2%A0instead%20of%C2%A0children.)
should be hinted when typing:

```ts
export default function Layout({ f|
                                  ^foo
```

And the prop type:

```ts
export default function Layout({ foo }: { f|
                                           ^foo: React.ReactChildren
```

And
[params](https://beta.nextjs.org/docs/api-reference/file-conventions/page#params-optional):

```ts
export default function Page({ p|
```

NEXT-178

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-10 20:07:56 +01:00
Jiachi Liu
3833aed08d
Fix next/dynamic types for resolving named export module (#43923)
## Bug

Fixes: #43915

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
2022-12-10 17:35:13 +00:00
AZM
6c1dd229d7
Update compiler.md (#43872)
The sentence is very confusing. Excessive/invalid usage of English grammar



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2022-12-10 15:38:43 +00:00
Shu Ding
8ded79728e
Support for named slots in type checking (#43906)
Follow up to #43903, this PR adds named slots to the generated typings,
and provides better error messages for `next build`.

For example, a layout can have `test` as a prop because it has `@test`
co-located. But `invalid` is not a possible prop here:

![CleanShot 2022-12-09 at 21 24
21@2x](https://user-images.githubusercontent.com/3676859/206790150-0e2d7905-fad8-4b26-86ee-d5e69a5ad0f9.png)

And here's the error when running `next build`:

<img width="651" alt="CleanShot 2022-12-09 at 21 21 11@2x"
src="https://user-images.githubusercontent.com/3676859/206789969-8bbd75bd-e7e3-4109-9e0d-d5f8f9a4bbb5.png">

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-09 23:29:57 +01:00
Shu Ding
833a9aff19
Improve type checking error message for invalid props (#43903)
Previously when you have wrong props for a page or layout:

<img width="639" alt="CleanShot 2022-12-09 at 20 27 25@2x" src="https://user-images.githubusercontent.com/3676859/206782176-a91ec178-a7b7-4e17-b990-a0fe90402ebf.png">

With this PR:

<img width="643" alt="CleanShot 2022-12-09 at 20 27 30@2x" src="https://user-images.githubusercontent.com/3676859/206782204-4623c830-86e9-4b95-abc9-b0819475a74b.png">

Next step is to generate prop types for named slots.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-09 20:17:22 +00:00
Shu Ding
582070eb7b
Improve type checking error message for invalid props (#43903)
Previously when you have wrong props for a page or layout:

<img width="639" alt="CleanShot 2022-12-09 at 20 27 25@2x"
src="https://user-images.githubusercontent.com/3676859/206782176-a91ec178-a7b7-4e17-b990-a0fe90402ebf.png">

With this PR:

<img width="643" alt="CleanShot 2022-12-09 at 20 27 30@2x"
src="https://user-images.githubusercontent.com/3676859/206782204-4623c830-86e9-4b95-abc9-b0819475a74b.png">

Next step is to generate prop types for named slots.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-09 21:15:57 +01:00
Jiachi Liu
d8545e6273
fix: forwarding props to no ssr dynamic (#43901)
## Bug

Fixes: #43764

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
2022-12-09 19:00:28 +00:00
Shu Ding
5415a0d954
Fix error message for invalid runtime option in app dir (#43900)
Currently it shows `Provided runtime "undefined" is not supported`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-09 18:35:27 +00:00
JJ Kasper
9d97a1e34a
v13.0.7-canary.4 2022-12-09 09:04:30 -06:00
JJ Kasper
dbbbbd13c7
Update freebsd build (#43866)
Fixes:
https://github.com/vercel/next.js/actions/runs/3652055251/jobs/6170973932

Passed:
https://github.com/vercel/next.js/actions/runs/3655313786/jobs/6176560747

Co-authored-by: LongYinan <lynweklm@gmail.com>
2022-12-09 08:55:37 -06:00
Jiachi Liu
a7f29108f4
Alias next/head to noop for rsc and add upgration warning (#43885)
This will reduce the bundle size and also give user proper hint to upgrade to `head.js`

* Mark `next/head` as noop in app dir
* Add warning for users to check the upgration guide to migrate it to head.js
2022-12-09 14:45:31 +00:00
Jiachi Liu
5f27b9d607
test: use react latest (#43884)
Update the e2e test with react/react-dom latest
2022-12-09 14:32:30 +01:00
Jan Kaifer
367a5df546
Clarify e2e dependency on yarn in contributin docs (#43287)
`yarn` installed with `corepack` won't run in our repo because it is configured as a `pnpm` project. `yarn` binaries installed from other sources don't care.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-09 12:34:32 +00:00
Tim Neutkens
ea58d94e9d
Move prefetch bailout to start of the prefetch function for pages (#43731)
Found that prefetching bails later than it has to in development for `pages`. This moves it to be the first thing that is checked in prefetch()


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-08 21:35:51 +00:00
OJ Kwon
f144c39ca4
build(cargo): bump up swc_core, turbopack (#43652)
<!--
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 that you're making:
-->

## Bug

Fixes WEB-166.

This supersedes https://github.com/vercel/next.js/pull/43449, updating
swc_core and turbopack both with its transitive dependencies. Version
bump includes one important build side issues to having circular
dependencies.
2022-12-08 12:58:48 -08:00
Thomas Ballinger
aa4b4bf8ae
Update dependencies for Convex demo (#43855)
Resolves the issue described in
https://github.com/microsoft/TypeScript/issues/51567 in the Convex demo
by updating type definitions.

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] **The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)**
- actually updated dependencies this time
2022-12-08 12:43:56 -08:00
Hannes Bornö
df8dde7731
Refactoring in @next/font (#43848)
Some refactoring, renaming and fixed comments in @next/font

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-08 12:43:11 -08:00
Jimmy Lai
589f090d0b
memory: fix 2 memory leaks in next-dev (#43859)
This PR fixes two memory leaks I found debugging with @sokra.

## 1) Leak in `next-server.ts`

The first leak was caused by the fact that the `require.cache` associated to the `next-server` module was not being cleared up properly, so we leaked context from modules required in that page, like API routes.

## 2)  Leak with React Fetch

When evaluating a route, we also evaluated the `react.shared-subset.development.js` module where React patches the `fetch` function. The problem is that when re-evaluating a route as part of hot reloading, we were patching over the previously patched `fetch` function. 
The result of this operation meant that we were keeping a reference to the context of the previous `fetch` and thus to the previous route context, thus creating a memory leak, since we only needed the new context.

## Test plan

Checked manually the heap snapshots of a test app.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-08 19:50:46 +00:00
Steven
8a171986ad
Delete duplicate SECURITY.md (#43856)
This file is redundant because it is already [inherited from the org](https://github.com/vercel/.github/blob/main/SECURITY.md). 

This will allow us to manage the security policy in one place for all repos.

See [the docs](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file) for more info.
2022-12-08 19:25:43 +00:00
Shu Ding
013a58d58e
Use proxy to ensure Flight is referencing to the latest module during development (#43823)
As @timneutkens pointed out [here](https://github.com/vercel/next.js/pull/43819#discussion_r1042408158), changing the key will make Flight's module cache grow indefinitely. While I've thought about updating Flight's logic to clean the cache at some point, but that's tricky to do correctly as everything is asynchronous and we have to trigger clean up from outside (Webpack).

So currently, a better way I can think of is to just give Flight a proxied object as `moduleExports`. Even if Flight is getting the same object from cache, it will always require the latest module from Webpack.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-08 19:00:52 +00:00
Harang
d4a8edf771
docs(migrating): fix broken react-router link (#43843)
<!--
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 that you're making:
-->

Fix broken link in migrating/from-react-router.md
- https://nextjs.org/docs/migrating/from-react-router#code-splitting
- https://nextjs.org/docs/migrating/from-react-router#scroll-restoration

The current link is shown as 404 because it is redirected to the
[document in react-router v6](https://reactrouter.com/en/main).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-08 10:28:36 -08:00
Jiachi Liu
f5ec62db21
test: client component under server component with ssr:false (#43853)
update test, if the client component under server component with
`ssr:false`, it shouldn't be rendered in SSR or flight
2022-12-08 09:27:23 -08:00
Jiachi Liu
a6714d3cdc
docs: add readme with development instructions for next/swc (#43834)
* Creating the readme for me `@next/swc` with basic development
instructions
* Adding instructions for testing and updating the `next/swc` tests


## Documentation

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
2022-12-08 13:38:44 +01:00
Hannes Bornö
98cb2547cd
Unhandled errors and rejections opens as minimized in app dir error overlay (#43844)
Updated version of the reverted https://github.com/vercel/next.js/pull/43511

Unhandled errors that did not occur during React rendering (those errors are caught in `getDerivedStateFromError` in the Error Overlay) should be opened in the minimized toast state instead of fullscreen. For example if they occur in event handlers or setTimeout. Errors that breaks the app, such as uncaught render errors or build errors, still opens up in fullscreen mode.

The added test make sure the errors opens up as minimized, but if there's a breaking error it should "win" and open up in fullscreen. The updated tests either throw errors inside an event handler or a setTimeout, or the error is handled in a custom error boundary - which means the app don't break.

Closes NEXT-128

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-08 11:30:27 +00:00
Jan Kaifer
c341c7648e
Test imports of all file types (#43751)
Test imports of `.js`, `.jsx`, `.ts` and `.tsx` from all file types.

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-12-08 09:42:47 +00:00
Shu Ding
8da43b1e7e
Refactor code (#43828)
Didn't modify any test, just merging HMR related ones together.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-08 01:19:58 +00:00
aaronbrown-vercel
579979d5d6
modify rd email (#43837)
<!--
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 that you're making:
-->

## Feature
- [X] Documentation added
2022-12-07 18:20:39 -06:00
Shu Ding
1930a950a1
Provide error hints for invalid layout props via the TS plugin (#43835)
This PR adds named slot detection in the TS plugin, so we can hint
layout props too. Note that `test` is valid but `invalid` shows an
inline error here:

![CleanShot 2022-12-08 at 00 30
22@2x](https://user-images.githubusercontent.com/3676859/206319749-a9e51318-e9d2-434a-8cfb-abb91c853959.png)

Since page props can only be `params` or `searchParams`, that part was
already supported.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-07 18:18:39 -06:00
Jiachi Liu
57515a767a v13.0.7-canary.3 2022-12-07 23:40:19 +01:00
Jiachi Liu
a97e6fff31
Upgrade playwright to 1.28.1 (#43818)
Upgrade playwright to see if the playwright installation job will be
back to normal

x-ref:
https://github.com/vercel/next.js/actions/runs/3639757976/jobs/6143653702
2022-12-07 14:14:55 -08:00
OJ Kwon
a752f4dac7
ci(actions): pin prod-test action image (#43748)
## Bug

Test(Production) CI fails with error

```
Package libicu66 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'ttf-unifont' has no installation candidate
E: Package 'ttf-ubuntu-font-family' has no installation candidate
E: Unable to locate package libenchant1c2a
E: Package 'libicu66' has no installation candidate
E: Unable to locate package libvpx6
E: Unable to locate package libwebp6
Failed to install browser dependencies
```

This is due to new release for the runner image (https://github.com/actions/runner-images/issues/6399) now sets ubuntu 22.04 as latest, but playwright have release to support it (https://github.com/microsoft/playwright/issues/13738) but @replayio/playwright seems not picked it up yet (https://github.com/replayio/replay-cli/blob/main/packages/playwright/package.json#L23) 

PR tries to pin to known working image (20.04) until dependencies can support new image gracefully.

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-07 22:00:33 +00:00
Shu Ding
2332272ae1
Do not attach CSS checksum for production build (#43827)
The flight CSS dev loader only does one thing: adding a checksum string to the module exports to make sure the content hash updates during development (so we can trigger HMR properly). This loader is not needed for production builds.

This PR makes sure that the checksum isn't attached and shipped to the client:

<img width="1226" alt="CleanShot 2022-12-07 at 20 49 30@2x" src="https://user-images.githubusercontent.com/3676859/206281754-5f00dfbc-d065-40a7-931f-431a6e9cb34a.png">

Which is 0.25kB for that testing page.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-07 20:28:10 +00:00
Jiachi Liu
cd0ebd8e8c
Implement loadable with lazy and suspense for next dynamic (#42589)
### Summary

Migrate `next/dynamic` to implementation based on `React.lazy` and
`Suspense`. Then it becomes easier to migrate the existing code in pages
to layouts. Then we can support both `ssr` and `loading` option for
`next/dynamic`.

For `loading` option, it will work like `Suspense`'s `fallback` property

```js
<Suspense fallback={loading}>
  <DynamicComponent />
 </Suspense>
```

For `ssr` option, by default `React.lazy` supports SSR, but we'll
disable the `ssr: false` case for dynamic import in server components
since there's no client side involved.

Then we don't need `suspense` option anymore as react >= 18 is always
required. Mark it as deprecated.

It also supports to load client component dynamically in server
components now.

#### Code code changes
* switch loadable component to `lazy` + `Suspense`
* will make sure it's retuning a module from `loader()` to
`loader().then(mod => ({ default: mod.default || mod }))` since `lazy()`
only accepts loader returning a module
* Inside suspense boundary, throwing an error for ssr: false, catch the
error on server and client side and ignore it.
* Ignore options like ssr: false for server components since they're on
server, doesn't make sense
* Remove legacy dynamic related transform
#### Feature changes
* `next/dynamic` will work in the same way across the board (appDir and
pages)
* For the throwing error, will make it become a API that throws error
later in the future, so users can customize more with `Suspense`
* You can load client components now in server components with dynamic.
Resolves #43147

#### Tests
* existing dynamic tests all work
* add case: import client component and load through next/dynamic in
server components

### Issues
2022-12-07 19:42:10 +01:00
JJ Kasper
a704b71cba
Lock pnpm version during publish (#43820)
x-ref: [slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1670409758653869)
2022-12-07 17:24:43 +00:00
JJ Kasper
d798df838f
Fix test binary generation and update test config (#43790)
Leverages the playwright container more to avoid the flaky setup step
for the necessary dependencies. Also fixes the dev binary generating
from https://github.com/vercel/next.js/pull/43745

x-ref:
https://github.com/vercel/next.js/actions/runs/3633110048/jobs/6129816165
x-ref:
https://github.com/vercel/next.js/actions/runs/3633110048/jobs/6129815918
x-ref:
https://github.com/vercel/next.js/actions/runs/3633110048/jobs/6129810273
2022-12-07 08:43:19 -08:00
Shu Ding
476bb09b09
Fix HMR issue after patching the client module (#43819)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2022-12-07 17:34:56 +01:00
Jiachi Liu
56ea306167
Display error digest if presented (#43742)
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-07 17:34:25 +01:00
Jan Kaifer
2022fa6d45
Add test for providing correct params to layouts (#43775) 2022-12-07 17:34:01 +01:00
Jan Kaifer
aa7cdf35ea
Remove notifications emitted during pnpm dev (#43801)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-07 17:11:29 +01:00
Jan Kaifer
16cf9a8b83
Remove serverComponents from next.conf.js because it's unused (#43805) 2022-12-07 15:57:03 +01:00
Shu Ding
2a230397c0
Assign layer to app client entries (#43197)
This is one of the required changes to refactor bundling strategy for
pages and app.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-07 15:20:50 +01:00
Thomas Ballinger
dbc833440c
chore(examples): Update convex example (#43741) 2022-12-07 14:12:36 +01:00
Anuj Singh
8006dbc741
chore(examples): Remove deprecated function from chakra (#43784)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-12-07 14:10:32 +01:00
Max Proske
f56e5c942d
Convert with-why-did-you-render example to TypeScript (#43736) 2022-12-07 14:10:04 +01:00
Grace Yun
783a3cede1
Remove swcMinify from Next config in CNA template (#43782)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-12-07 14:09:29 +01:00
Shu Ding
b168c37cb5
Fix chunk hash logic in hot-reloader for server components (#43778)
Previously we were assuming that `serverOnlyChanges` is the same as
"server component changes". However that's not always true, as one can
change a component from server component to client component, or vice
versa, where the change affects both server and client builds, so
`serverOnlyChanges` will be empty.

This PR fixes the logic by strictly hashing and comparing modules in the
server layer. Note that I intentionally skipped the test as this fix
[isn't
complete](https://vercel.slack.com/archives/C035J346QQL/p1670343453333079).

NEX-30

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-07 13:13:31 +01:00
Jan Kaifer
08d270cdeb
Add tests for rendering null and undefined in RSC (#43768) 2022-12-07 12:24:02 +01:00
Hannes Bornö
738de0164f
Remove __webpack_exports__ from error overlay (#43715) 2022-12-07 11:50:39 +01:00