Commit graph

12216 commits

Author SHA1 Message Date
Henrik Wenz
53ecdd12db
[Docs] Prefer function _app component in examples (#39967)
## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-26 08:17:54 +00:00
Balázs Orbán
a037c0867d
fix(ts): use AppProps's generic for pageProps (#38867)
Currently, you cannot set `pageProps`'s type when using `AppProps`'s generic, it's always `any`.

Before:
![image](https://user-images.githubusercontent.com/18369201/180234440-3b37460c-ff92-413f-9d1c-38e35e35a5b4.png)


After:
![image](https://user-images.githubusercontent.com/18369201/180234644-335eec85-0315-4ff8-aba1-53edf0b64e1a.png)



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-26 01:10:11 +00:00
Lee Robinson
d267c300fa
[docs] Update UTM params of some links (#39951)
Noticed a few outdated links, plus some that have since had redirects added, so took this opportunity to make the UTM params consistent 👍
2022-08-25 21:15:37 +00:00
Lee Robinson
c4a240d981
Update Font Optimization docs (#39950)
This makes it more clear that using Document is recommended for the best font experience, versus manually adding it every page. More updates coming to this page in the future as we add support for more features here.
2022-08-25 20:29:56 +00:00
JJ Kasper
5e5d56c1f7
Fix passing VERCEL_CLI_VERSION env for deploy tests (#39946)
The quotes around the env were being passed literally breaking usage of the env variable so this removes them. 

x-ref: [slack thread](https://vercel.slack.com/archives/C02K2HCH5V4/p1661417510950809?thread_ts=1659529028.137779&cid=C02K2HCH5V4)
2022-08-25 14:03:00 -05:00
JJ Kasper
434a8699d2
Increase test concurrency (#39922)
This increases our test concurrency to reduce CI times since it's increased as we've added more tests.
2022-08-25 12:33:03 -05:00
Balázs Orbán
5c8183464d
chore: check against npm version in issue validator (#38915)
I did some experimenting to see if we can grab the latest version from npm instead of GitHub releases since that's the version the user can actually use.

The npm registry sends the package metadata in a gigantic (~8mb for `next`) JSON response and parsing it with `res.json()` takes several seconds, but using `ReadableStream`, we only care about the first chunk. This way we can grab the relevant version information in a few ms. ~I added `undici` which implements `res.body.getReader()`.~ Using Node 18/native `fetch`.
2022-08-25 11:43:20 -05:00
Shu Ding
f12788dee8
HMR for client CSS imports (#39916)
Follow-up to #39758, this PR makes sure that CSS imports (both global and CSS modules) from client components are not handled by mini-css-extract's HMR logic. Instead, we trigger a server component update and let the client to refetch the RSC payload.

However, we are still leveraging the mini-css-extract plugin to emit CSS assets. So in this PR we add a new pitch loader to calculate the original file hash, but replace the final content to eliminate HMR logic but only keep the hash (so hot reloader can keep tracking that).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-25 16:40:16 +00:00
Jerome Leclanche
a799d25cfa
Mention largePageDataBytes in warning docs (#39941)
Also fix the KB unit to `kB` (https://en.wikipedia.org/wiki/Kilobyte)

## Documentation / Examples

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-08-25 10:52:32 -05:00
Mosaad
9a7a8acc64
fix hash-link (#39929) 2022-08-25 15:42:45 +00:00
Esben Anker-Møller
a9772b1310
Adds note about custom server requirements (#39931)
This wasn't obvious to me when trying out middleware in our project, and the error message was `Invalid URL` - took me embarrassingly long to remember that we run a custom server. Would it be possibly to detect that middleware is used and then throw a descriptive error message when trying to call `next` without `hostname` and `port` in a custom server? If someone can point me to where that could be done, I would be happy to make a pull request.

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`

I made the change in Github ui, so couldn't run `pnpm lint`. Is this automated or should I clone and run it locally?
2022-08-25 14:39:31 +00:00
Simon Gavelin
3da768f839
[docs] Fixed 404 links to Layouts RFC blog post (#39937)
Fixes broken links to Next.js Router and Layouts RFC blog post


## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
2022-08-25 14:21:39 +00:00
Kiko Beats
8958867d91
build: upgrade edge-runtime (#39898)
https://github.com/vercel/edge-runtime/compare/v1.1.0-beta.27...v1.1.0-beta.31

Related: https://github.com/vercel/next.js/issues/38658
2022-08-24 23:59:12 +00:00
Jiachi Liu
e2a5b095ae
test: merge edge ssr tests (#39924)
- Group edge ssr tests, merge `edge-vs.-non-edge-api-route-priority` and `react-18-streaming-ssr` into 1 e2e test suite
- Add rewrite case to edge ssr in switchable runtime
2022-08-24 23:56:59 +01:00
JJ Kasper
bd82f690e5
v12.2.6-canary.5 2022-08-24 15:18:19 -05:00
JJ Kasper
49b4dae570
Handle edge runtime for app (#39910)
Continuation of https://github.com/vercel/next.js/pull/38817 this adds handling to allow leveraging the `experimental-edge` runtime for `app`. 

## Bug

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

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2022-08-24 14:49:47 -05:00
Steven
b757db4378
Bump @vercel/nft@0.22.0 (#39906)
This PR bumps `@vercel/nft` to version [0.22.0](https://github.com/vercel/nft/releases/tag/0.22.0)
2022-08-24 15:30:25 +00:00
JJ Kasper
35f86d5bfd
Fix rsc basic e2e test on deploy (#39905)
This test is currently not expected to run against deploy mode similar to the other app tests so this skips it for now. 

Fixes: https://github.com/vercel/next.js/runs/7988021472?check_suite_focus=true
2022-08-24 10:07:04 -05:00
Jonas Strassel
638e6d16f8
chore(with-docker): don't copy package.json twice (#39896)
the directory `/app/.next/standalone` already contains a copy of the package.json so we can skip copying it before we copy the standalone dir

## Documentation / Examples

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-08-24 09:35:44 -05:00
JJ Kasper
1d9706f443
Remove un-necessary internal jest-worker error during ts/lint error (#39886)
This ensures we strip the un-necessary `jest-worker` error shown from an error with verifying TypeScript during build as this error just clutters the output and doesn't provide any additional helpful context. 

x-ref: [slack thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1661300070830909)

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-24 09:29:27 -05:00
Tim Neutkens
0e678db500
Add path to export-page (#39893)
Adds a missing tag in the trace-to-tree helper that allows you to see the path of the `export-page` span.


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-24 10:29:47 +00:00
JJ Kasper
34e10f302a
v12.2.6-canary.4 2022-08-23 23:30:54 -05:00
JJ Kasper
08dd08ec72
Skip auto-install for missing deps in CI (#39882)
Follow-up to https://github.com/vercel/next.js/pull/39838 this skips auto-installing missing TypeScript dependencies in CI environments as this creates a side-effect which we want to avoid. 

x-ref: [slack thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1661301586792559?thread_ts=1661299706.559769&cid=C03KAR5DCKC)

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-23 22:53:05 -05:00
JJ Kasper
9d4bb49af9
Fix failing e2e getServerSideProps test (#39885)
After the fix was landed for `_error` being used even when it's a serverless function this test no longer shows the default Vercel error page.  

Fixes: https://github.com/vercel/next.js/runs/7985910009?check_suite_focus=true
2022-08-23 22:41:38 -05:00
JJ Kasper
88916fbaf0
Fix runLintCheck during build (#39883)
Follow-up to https://github.com/vercel/next.js/pull/39872 this fixes a check in `runLintCheck` causing setup to start during build and adds a regression test. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-23 22:36:52 -05:00
JJ Kasper
1c61eff67d
v12.2.6-canary.3 2022-08-23 19:00:15 -05:00
Steven
73bffd6fd7
Fix next/future/image blur-up placeholder (#39785)
This PR is a follow up to PR #39190 so that we can dynamically set the `feComponentTransfer` when we know the image doesn't have transparency (at this time its just jpeg).

We also set the stdDeviation to 1 and the viewbox to the placeholder's width/height to avoid any rounding issues.

Finally, we also fix the conversion from `objectPosition` to `backgroundPosition` because they have different default values according to the spec.
2022-08-23 18:56:52 -05:00
OJ Kwon
17244b8a23
feat(next/swc): enable wasm first binding load for the platforms (#38883)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order 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:
-->

This PR enables a path to loading wasm binding first for the few platforms we'll attempt to remove native binaries. As a first step, this change does not actually removes native bindings, but will try to load wasm binding first and use it if loading success. 

It may take some time to actually remove native bindings, I expect we may need to fix few regressions from wasm bindings for some places like loading / installing itself for the platforms not being used widely, meanwhile native bindings can be used as a fallback.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-08-23 14:59:13 -05:00
Wyatt Johnson
9cc156c3ae
Added tests for next/router in app directory (#39867)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order 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:
-->

Added tests to ensure that the `next/router` returns null for `useRouter` and `withRouter` when used with the app directory.
2022-08-23 14:29:29 -05:00
Henrik Wenz
64a3697d05
[Docs] Update examples to favour functional _document (#39871)
## Changes

- Migrate class based `_document`s to functional documents 
- Removed `_document.js` where default
- Removed `MyDocument.getInitialProps` where default

## Motivation

This removes some boilerplate and prepares examples for server components.

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-23 18:52:31 +00:00
JJ Kasper
b85628392b
Remove eslint warning when no eslint config is present (#39872)
We shouldn't be warning when no eslint config file is present as it's valid not to use eslint. The warning is still shown if an empty eslint config file is added as this gives intent to using eslint. 

x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1661268593890619?thread_ts=1661266342.496699&cid=CGU8HUTUH)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-23 13:42:36 -05:00
JJ Kasper
7f5bc71712
Update flakey relay analytics test (#39877)
Implements `check` on relay analytics test as the timing can be indeterminate. 

Fixes: https://github.com/vercel/next.js/runs/7979410199?check_suite_focus=true#step:9:230
2022-08-23 13:29:17 -05:00
JJ Kasper
ec25b4742b
Add handling for auto installing TypeScript deps and HMRing tsconfig (#39838)
This adds handling for auto-detecting TypeScript being added to a project and installing the necessary dependencies instead of printing the command and requiring the user run the command. We have been testing the auto install handling for a while now with the `next lint` command and it has worked out pretty well. 

This also adds HMR handling for `jsconfig.json`/`tsconfig.json` in development so if the `baseURL` or `paths` configs are modified it doesn't require a dev server restart for the updates to be picked up. 

This also corrects our required dependencies detection as previously an incorrect `paths: []` value was being passed to `require.resolve` causing it to fail in specific situations.

Closes: https://github.com/vercel/next.js/issues/36201

### `next build` before

https://user-images.githubusercontent.com/22380829/186039578-75f8c128-a13d-4e07-b5da-13bf186ee011.mp4

### `next build` after


https://user-images.githubusercontent.com/22380829/186039662-57af22a4-da5c-4ede-94ea-96541a032cca.mp4

### `next dev` automatic setup and HMR handling

https://user-images.githubusercontent.com/22380829/186039678-d78469ef-d00b-4ee6-8163-a4706394a7b4.mp4


## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2022-08-23 13:16:47 -05:00
Sukka
8dfab19d6e
fix(#39807): ignore width/height from webpack with "fill" (#39849)
Fixes #39807.

When statically importing an image, the `width` and `height` will always be provided alongside the `src` by the Webpack. `next/image` will ignore `width` and `height` come from Webpack when `layout === 'fill'`, while `next/future/image` will not, hence the issue. The PR fixes that. The corresponding integration test cases are also added.

cc @styfle 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-23 13:06:44 -05:00
JJ Kasper
cb430cce90
v12.2.6-canary.2 2022-08-23 09:29:24 -05:00
Henrik Wenz
16838d5dd4
[Docs] Migrate data-fetch example to typescript (#39852)
## Changelog

- Updated deps
- Migrated to Typescript
- Replaced `div` with `Fragment`

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-23 14:23:38 +00:00
Hannes Bornö
ca9fef6ef6
Docs: Updated note about using next/head in basic-features/font-optimization (#39863)
## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-23 09:15:09 -05:00
JJ Kasper
611e13f515
Fix disposing active entries in dev compilers (#39845)
As noticed in https://github.com/markdoc/markdoc/issues/131 it seems we are incorrectly disposing active entries causing HMR to fail after the configured `maxInactiveAge`. To fix this instead of only updating lastActiveTime for one compiler type's entry we update all active compiler types for the active entry. 

This also updates an existing test to catch this by waiting the `maxInactiveAge` before attempting a change that should trigger HMR. 

## Bug

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

Fixes: https://github.com/markdoc/markdoc/issues/131
2022-08-23 07:23:43 +00:00
JJ Kasper
31bcd044ff
Ensure moduleResolution is written correctly (#39836)
This removes the usage of `Node12` from the `parsedValues` for `moduleResolution` as this caused false detection of `undefined` being a valid value when it was removed in TypeScript. This also copies over the test from https://github.com/vercel/next.js/pull/37302 to ensure we don't regress on this. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/37296
Closes: https://github.com/vercel/next.js/pull/37302
2022-08-22 18:36:36 -05:00
Shu Ding
cb1038cb6d
Refactor client CSS imports (#39758)
Removed the hack of client-side CSS injection via `chunk`. Instead collect them with the manifest plugin and SSR them as link tags.

Next step is to adjust HMR to not relying on mini-css-extract plugin and webpack.
2022-08-22 18:09:56 -05:00
Steven
3d0d09002a
Improve error message on next/future/image when objectFit or objectPosition (#39614)
Improve PR improves the error message on `next/future/image` when `objectFit` or `objectPosition` is provided and suggests using `style` instead. It also prints the stack trace so its clear where the error came from.
2022-08-22 23:07:41 +00:00
Steven
7e9f9bfbef
Fix onError handling in next/future/image (#39824)
This PR fixes a race condition where the `onError` handler was never called because the error happened before react attached the error handler.
2022-08-22 21:37:16 +00:00
Miguel Oller
1f5da04dad
Update cms-makeswift example (#39834)
Upgrade @makeswift/runtime to the latest version. This removes the need
for the MAKESWIFT_API_HOST environment variable and improves error
messages when integrating Next.js with Makeswift.

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-22 16:02:19 -05:00
sumiren
6bc7cdaf47
doc: improve a word client side rendering (#39771)
The term client-side rendering is ambiguous and misleading.
Some people would assume the architecture where a blank page is returned from the server and HTML generation is totally done on the frontend.

So I changed the term to `client-side data fetching`, which is widely used throughout the rest of the document.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-22 14:55:46 -05:00
Arthur Denner
d2ab9bcc85
Mention router.isPreview on Preview Mode page (#39830)
The documentation is concise and straightforward, so I just added a sentence.
Let me know if you'd like to describe more, add an example, etc.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-08-22 19:46:54 +00:00
Steven
b6bbbc813f
Update docs next/future/image with details about computed aspect ratio (#39829)
The browser support for this feature was added to caniuse so we can link there instead of linking to each browser bug tracker.
2022-08-22 17:31:57 +00:00
JJ Kasper
d2a2cc7808
Skip building /500 in dev mode (#39828)
Follow-up to #39826 this skips ensuring the /500 page when in development as it's not used since we use the error overlay instead. This also fixes the case where we don't clear the stalled timeout debug log when an error is thrown during ensuring.
2022-08-22 11:59:23 -05:00
JJ Kasper
4955da9eed
Update stalled ensure log to use debug instead (#39826)
This updates the stalled ensure log to use debug instead the log isn't really actionable by the user and is more so meant for debugging purposes.
x-ref: slack thread
2022-08-22 11:32:30 -05:00
JJ Kasper
b431bd4ba0
Leverage VERCEL_CLI_VERSION env for deploy tests (#39823)
This updates our next-e2e test deploy mode to auto pass along the VERCEL_CLI_VERSION env variable to allow testing builder changes easier. cc @nkzawa who encountered this.
2022-08-22 09:54:25 -05:00
Michael Oliver
c172d461c8
Remove unnecessary type reference in Vitest example (#39819)
Documentation / Examples

 Make sure the linting passes by running pnpm lint
 The examples guidelines are followed from our contributing doc


The Vitest docs state that /// <reference types="vitest" /> is only required when importing defineConfig from vite.
2022-08-22 09:18:40 -05:00