Commit graph

13534 commits

Author SHA1 Message Date
Jan Kaifer
f07f69dd0f
Add test checking that repeated edits won't cause hydration issues (#44189) 2022-12-21 14:17:50 +01:00
Jan Kaifer
6713ce4cab
Move tests into their test folder (#44183) 2022-12-21 14:16:52 +01:00
Steven
6f1f3e6ced
Disable Image Optimization API when next.config.js has unoptimized: true (#44205)
This fixes a bug where next.config.js was configured with `images.unoptimzed: true` but the Image Optimization API was not truly disabled. Since there is no way to override the config at the component level, its safe to say the API can be disabled.
2022-12-21 00:14:47 +00:00
JJ Kasper
0ac617eccd
v13.0.8-canary.2 2022-12-20 16:18:54 -06:00
Steven
54e95c1d52
Bump @vercel/nft@0.22.6 (#44193)
Changes: https://github.com/vercel/nft/compare/0.22.1...0.22.6
2022-12-20 13:41:50 -08:00
OJ Kwon
1f8dbf20c1
build(cargo): bump up turbopack (#44206)
This PR bumps up turbopack for the next canary release.

## 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-20 21:08:23 +00:00
Shu Ding
186e25f7b1
Add warning for experimental flags that have moved (#44202)
These options have been moved out of `experimental`.

## 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-20 19:46:01 +00:00
Shu Ding
e847b49673
Add telemetry for stable features (#44201)
Follow up to #44195 #44194.

## 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
- [x] 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-20 19:20:44 +00:00
Shu Ding
966d2b16c3
Fix CSS resources being duplicated in app dir (#44168)
Currently, to get all the chunk files that contain a specific module in a build, we use `chunk.files`. However a module itself can be included by multiple chunks, or even chunks from different entries. Theoretically that's correct but in our architecture, we only need these chunks that are from the entry that is currently rendering.

One solution is to add a 2-level key (the entry name) to modules in flight manifest, but that introduces too much size overhead to the manifest. So instead we leverage the `__entry_css_files__` field to generate a list of all files for a specific entry, and then find the intersection set of `{CSSFilesForEntry, CSSFilesForModule}` to get the corresponding CSS files for a specific Next.js entry.

Also renamed `__entry_css__` to be more specific, and did some performance optimizations.

NEXT-297

## 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-20 18:43:03 +00:00
Shu Ding
04daf7eb06
Move transpilePackages out of experimental (#44194)
Should be good to land and it got tests covered.

## 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: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-12-20 17:27:30 +00:00
Shu Ding
cafb886ed6
Move options to stable (#44195)
This PR moves `allowMiddlewareResponseBody`, `skipMiddlewareUrlNormalize` and `skipTrailingSlashRedirect` to stable.

## 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-20 16:17:40 +00:00
Erik Hedberg
2b3a38ee47
docs: fix spelling error (#44191)
## 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-20 14:51:14 +00:00
Jiachi Liu
2f0b5a282e
Also check error.message as digest for recoverable errors in pages (#44185)
Follow up for #44161

According to https://github.com/facebook/react/pull/25313, the `errorInfo.digest` will be moved to `error.digest`, but for now we use it as a fallback for pages. we can remove it later once the migration is done in required react version for nextjs

## Bug

- [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-20 14:44:30 +00:00
Hannes Bornö
39f30fbdb4
Remove browser.refresh in app tests (#44186) 2022-12-20 14:37:55 +01:00
Jan Kaifer
66408466ad
Document how chain works in BrowserInterface and chain to browser.eval (#44085)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-20 13:03:51 +01:00
Jan Kaifer
f6cba806ad
Increase recommended git clone depth (#44181)
Follow-up in https://github.com/vercel/next.js/pull/44158/files#r1053100022
2022-12-20 09:53:36 +00:00
Hannes Bornö
9203386f91
Enable ReactRefreshLogBox scss test (#44180)
## 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-20 09:18:13 +00:00
JJ Kasper
5a35be1e0f
Fix pnpm install on Azure (#44179)
Seems Azure fails to install due to the git URL being used in the
lockfile so this corrects it.

Fixes:
https://dev.azure.com/nextjs/next.js/_build/results?buildId=45436&view=logs&jobId=59111904-15f9-56fe-00af-da61f595b979&j=59111904-15f9-56fe-00af-da61f595b979&t=5a27f6c6-b109-58f5-7373-fdf51f21d023
2022-12-19 23:53:43 -08:00
LongYinan
38165640fd
Fix crash in GraalVM (#44176)
Refs:
- https://github.com/oracle/graal/issues/5581
- https://github.com/oracle/graal/issues/5582
- https://github.com/napi-rs/napi-rs/issues/1392
2022-12-20 07:39:15 +00:00
JJ Kasper
7368b6f9e6
v13.0.8-canary.1 2022-12-19 17:14:36 -08:00
Akshit Sinha
c3d1f024a5
Remove devcontainer network host argument (#44157)
This removes the `--net=host` argument passed to the devcontainer.
Originally introduced for X11 forwarding, devcontainer already passes
`--network host` argument doing the same
[thing](https://stackoverflow.com/q/50644889/8429267)?
Check the build logs
```
Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,src=/var/lib/docker/codespacemount/workspace,dst=/workspaces --mount source=/root/.codespaces/shared,target=/workspaces/.codespaces/shared,type=bind --mount source=/var/lib/docker/codespacemount/.persistedshare,target=/workspaces/.codespaces/.persistedshare,type=bind --mount source=/.codespaces/agent/mount,target=/.codespaces/bin,type=bind --mount source=/mnt/containerTmp,target=/tmp,type=bind --mount type=bind,src=/.codespaces/agent/mount/cache,dst=/vscode -l Type=codespaces -e CODESPACES=true -e ContainerVersion=12 -e RepositoryName=next.js --label ContainerVersion=12 --hostname codespaces-9b31fb --add-host codespaces-9b31fb:127.0.0.1 --cap-add sys_nice --network host --cap-add SYS_PTRACE --security-opt seccomp=unconfined --entrypoint /bin/sh vsc-next.js-e4966344b9ebb252cd82cad8e4b143f1 -c echo Container started
```

[Refer](https://github.com/vercel/next.js/pull/43138#issuecomment-1328026282)
for original issue with the current configuration. Closes #43451

P.S. Why do we have X11 support in devcontainers in the first place? Its
not something *most* people will use, especially if it comes with the
cost of codespaces not working. Need someone to verify if X11 forwarding
still works with this configuration as it probably should.
2022-12-19 16:38:20 -08:00
Steven
a32b3dde51
Fix test template example (#44170)
- Fixes typo from #44147 

`getElementByCss` => `elementByCss`
2022-12-19 16:31:28 -08:00
Jiachi Liu
e27a7bd7a4
Update styled-jsx (#44070)
x-ref: https://github.com/vercel/styled-jsx/releases/tag/v5.1.1
2022-12-19 23:58:50 +00:00
OJ Kwon
e8dc27bb02
build(cargo): update turbopack (#44167)
## 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-19 23:18:16 +00:00
Long Zheng
2f79baf94b
Update disabling-http-keep-alive.md for server-side only (#43374)
fixes #43354

It is not possible to specify an `agent` on a single `fetch()` call since the types for `fetch` come from TypeScript where `agent` is not supported as an option.
2022-12-19 22:54:12 +00:00
Jiachi Liu
9855fd7bc5
test: add test for notFound during streaming (#44078)
Add test for notFound case added in #41735
2022-12-19 14:15:51 -08:00
Jiachi Liu
13a9fb994a
Align onRecoverableError callback between pages and app dir (#44161)
Should not re-throw the error on client for errors from
`onRecoverableError` callback in pages, this PR share it as a same
callback between pages and app dir

follow up for #42589
2022-12-19 13:50:06 -08:00
Jiachi Liu
6827b586f0
docs: update next/dynamic docs (#44067)
## 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-19 13:38:30 -08:00
JJ Kasper
19013a5e3f
Ensure next.url is used instead of next.appPort (#44163)
`appPort` shouldn't be used unless absolutely necessary as `next.url` is
more specific and allows more control.

x-ref:
https://github.com/vercel/next.js/actions/runs/3734223762/jobs/6336069606
2022-12-19 13:29:50 -08:00
OJ Kwon
3dd9af785c
build(cargo): fix turbopack + next-swc build (#43983)
Fixes WEB-301. 

This PR fixes build failure with latest turbopack, also update necessary
dependencies.

---

Edit by @kdy1:
 - Closes https://github.com/vercel/next.js/issues/43052
2022-12-19 13:10:02 -08:00
Jiachi Liu
ea7d85687b
Fix styled-components setup in turbo example (#44165)
Closes: #44164

Sync to the latest setup doc on https://beta.nextjs.org/docs/styling/css-in-js#styled-components

## 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-19 20:59:16 +00:00
Grace Yun
43c9d8940d
Wrap CSS variable in var (#44153)
Adds missing CSS var() wrapper + spelling error, caught in [Discussion
#9094](https://github.com/vercel/vercel/discussions/9094).

Closes: #44126
Closes: https://github.com/vercel/next.js/pull/44127 

## Bug

- [x] 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-19 12:05:46 -08:00
Grace Yun
68d06fe015
Update README templates to include snippet on next/font (#44088)
Updates the README templates for `create-next-app` to include
information on the addition of the `next/font` library.

## 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-19 11:49:41 -08:00
Jason Long
4796fb3dd4
Upgrade undici to 5.14.0 to fix fetch redirect bug (#44133)
<!--
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:
-->

Fixes https://github.com/vercel/next.js/issues/44132

## Bug

- [x] 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)
2022-12-19 11:27:41 -08:00
Tim Neutkens
397fc57224
Update pnpm new-test to use createNextDescribe (#44147) 2022-12-19 20:08:50 +01:00
Jan Kaifer
60b8468b35
Suggest contributors to use shallow clone (#44158)
It will decrease the download size from `1.7GiB` to just `28MiB`.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-12-19 19:02:25 +00:00
Didi Keke
ae5502eaaf
docs: Add missing type to import statement (#44111)
<!--
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

- [ ] 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)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-12-19 10:46:06 -08:00
Jan Kaifer
887cbe4334
Add types as a default dependency into tests (#44140) 2022-12-19 19:05:53 +01:00
Jiachi Liu
ded93bf645
should not contain pages css in app dir (#44151)
* Filter out the css chunk from `pages/`
* add indent for flight manifests in dev mode for development convenience

## Bug

- [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-19 17:51:34 +00:00
l1qu1d
723311bde9
Revert "Remove useState from next/image (#43587)" (#44094)
# Reverts vercel/next.js#43587

PR #43587 breaks the `placeholder="blur"` property on the `<Image />`
component by keeping the `blurStyles`, e.g. the blurred image, after the
image is loaded.

**This regression does _not_ introduce any breaking changes or bugs.**

---

The reason for the original PR was:
> This PR remove `React.useState()` from the `next/image` component. It
was only used in the `onError` case and it was causing Safari to become
very slow when there were many images on the same page. We were seeing
1s delay blocking the main thread when there were about 350 images on
the same page. Chrome and Firefox were not slow.

The original PR is a performance improvement for Safari on a corner
case.

Additionally, when tackling this performance improvement again, the
`blurStyle` needs to know when the the image is done loading so it can
get rid of the blur. The state is updated in `handeLoading()` and isn't
just used `onError`.

## Fixes issues

- Fixes #43829
- Fixes #43689

## To reproduce

For reference this when #43587 was pulled into Next.js
[v13.0.6-canary.3](https://github.com/vercel/next.js/blob/v13.0.6-canary.3/packages/next/client/image.tsx)

- Regress the `image.tsx` to
[v13.0.6-canary.2](https://github.com/vercel/next.js/blob/v13.0.6-canary.2/packages/next/client/image.tsx)
- Do a local build with the regressed `image.tsx` on (current canary
build)
[v13.0.8-canary.0](https://github.com/vercel/next.js/releases/tag/v13.0.8-canary.0)
- Example code, (import any image you like) make sure to use
`placeholder="blur"`
```typescript
import Image from 'next/image'
import CatImage from '../public/cat.png'

<Image
    src={CatImage}
    width={500}
    height={500}
    alt="Cat"
    priority
    placeholder="blur"
/>
```
- Image will still have the blur after the image is loaded
- Before and after screenshot


![before](https://user-images.githubusercontent.com/1037693/208206084-bd6fa143-ca19-4fda-9f4e-8fcec9836848.png)


![after](https://user-images.githubusercontent.com/229881/208470446-3a00eac6-f82e-4017-bd9f-7c6145456959.png)

Co-authored-by: Steven <steven@ceriously.com>
2022-12-19 12:10:23 -05:00
Jan Kaifer
fa880d04ea
Add test for rewriting in middleware in app-dir (#43971)
- add test for rewriting in middleware in app-dir
- add test for redirect
- add tests for router.push
- add test for rewrites in config.next.js
- add test for redirects in config.next.js
- add test for catchall rewrite in config.next.js

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-12-19 12:32:17 +00:00
Tim Neutkens
e45bbbe734
Add jsdoc/no-types eslint rule for TypeScript files (#44049)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-12-19 10:21:08 +01:00
Tim Neutkens
7a2ec41601
Refactor more tests to createNextDescribe (#44104) 2022-12-19 10:20:01 +01:00
JJ Kasper
b8ae447b0f
Fix dev session stopped handling (#44112)
This ensures we properly handle the dev session stopped event now that
the dev server runs in a different worker so the telemetry globals are
no longer available by default in the main process. No additional tests
have been added as the existing test caught this.

Fixes:
https://github.com/vercel/next.js/actions/runs/3715725536/jobs/6301287357
x-ref: https://github.com/vercel/next.js/pull/43958

## 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)
2022-12-17 17:18:49 -08:00
Harry Manchanda
ac1950d66e
Docs: Update deployment.md with Firebase, Amplify and Cloudflare (#44092)
This proposes updates based on New Cloud Services that are supporting Next.js.

1. Cloudflare Pages and Firebase are not Static Only Anymore so moved them to respective sections
2. Added AWS Amplify

**Please merge this open source contribution if this seems valid to you. 🙏** 



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


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-12-17 15:26:29 +00:00
Tim Neutkens
04e325d1d2
Add lodash to server components external packages (#44022)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-17 09:06:15 +01:00
OJ Kwon
b45c81577c
refactor(next-swc): introduce next-binding to consolidate dependencies. (#43473)
<!--
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:
-->

Partial solutions for WEB-225.

One of the issue we want to improve is version bump process across
multiple dependencies sharing same transitive dependencies. There were
known cases of last-minute build failures of next-swc due to this. The
biggest thing is we have lot of dependenceis rely on swc_core, and
consolidating it altogether is tricky.

PR introduces `next-binding`, which reexports all the related
dependencies that next-swc and turbopack commonly uses. Unfortunately,
this is not a complete solution, but at least it'll make `upfront` cost
to turbopack when it try to update swc_core and others, so by the time
upgrading it in next-swc we expect minimal friction. Note not 0
friction: due to how cargo behaves for the merging all of the features,
there's still chances to have some build failures but meaningfully less
I believe.

I think the easiest way to describe before / after is having some
diagrams. This is rather simplified to illustrate problems easily, i.e
when it comes to actual build if there are same version of deps cargo
will dedupe, so below illustaration only would occur for non-compatible
version cases, etcs.

**Before**
```mermaid
graph TD
    A[next-swc] --> B(next-dev)
    A --> C(swc_core)
    A --> D(swc_emotion)
    D --> E(swc_core)
    A --> F(styled_jsx)
    F --> E
    A --> G(mdxrs)
    G --> H(swc_core)
    B --> I(swc_core)
    B --> J(swc_emotion)
    J --> K(swc_core)
```

**After**
```mermaid
graph TD
    A[next-swc] --> B(next-binding)
    B --> C[swc_core]
    B --> D[swc_emotion]
    D --> I[swc_core]
    B --> H[styled_jsx]
    B --> F[next-dev]
    B --> J[node-file-trace]
    F --> C
    H --> I
    B --> E(mdxrs)
    E --> G(swc_core)
 ```

You can see repeated dependencies (`swc_core`, `swc_emotion`) occurs lot more in next-swc in `before`, including next-swc top level direct import itself. In result, update process have to align between next-swc, turbopack, swc-plugins and others.

With newly proposed changes, `next-swc` no longer directly owns deps reduces those repetaed deps. At the moment of version bump, only `next-binding` need to be updated.

This brings small caveat however : next-swc does not directly update `swc_core`, but have to bump turbopack and its transitive dependencies. Given our bump process usually requires to bump up turbopack anyway, I wouldn't consider this as hard blocking though.
2022-12-16 11:47:56 -08:00
Tim Neutkens
1e0acc2e58
Implement new core test API (#44086)
Adds a new way to write e2e tests for the Next.js core, mostly to reduce common boilerplate and make it easier to write tests for now team members.

```ts
// test/e2e/app-dir/head/head.test.ts
import { createNextDescribe } from 'e2e-utils'

createNextDescribe(
  'app dir head',
  {
    files: __dirname
  },
  ({ next }) => {
    test('handles ', async () => {
      // get cheerio (jQuery like API to traverse HTML)
      const $ = await next.render$('/')
      // get html
      const html = await next.render('/')
      // use fetch
      const res = await next.fetch('/')
      // get browser
      const browser = await next.browser('/')
    })
})
2022-12-16 17:21:02 +00:00
Jiachi Liu
137a63b90d
Fix ignoring dev warning for preload component (#44065)
Fix ignoring warning added in #41519
2022-12-16 17:47:30 +01:00
Jiachi Liu
595ecdbfdc
feat: app dir error-global component (#44066)
## Feature

NEXT-54

When there's an error in the one of the root level pages, there's no way to handle it. The team discussed this and decided there should be a global error boundary to pick up anything not handled further down in the tree. It can be called `global-error.js`.

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-12-16 11:04:43 +00:00