Commit graph

13825 commits

Author SHA1 Message Date
JJ Kasper
5f937d6eaa
Update flakey polyfills and acceptance tests (#45313)
x-ref:
https://github.com/vercel/next.js/actions/runs/4015096851/jobs/6896473744
x-ref:
https://github.com/vercel/next.js/actions/runs/4015096851/jobs/6896483400
2023-01-26 10:25:47 -08:00
Tim Neutkens
d1f18a51fe
Move router reducer to separate file (#45236)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-26 13:23:43 +01:00
Gal Schlezinger
35f68bc691
[edge] improve fetch stack traces in edge runtime (#44750)
Right now, when doing the following in an Edge API:

```typescript
export default async () => {
  await fetch("https://hello.world");
};
```

The stack trace generated does not contain the actual line of code that caused the error.
This gives a bad developer experience when working with `next dev`.
This PR fixes that for this specific use case and adds a test to make sure there's no regression.

For `next start`, there's also a small change, that needs to be pushed upstream to `edge-runtime`.
In order to run user code in the Edge Runtime, we call `vm.evaluate(code: string)`. However,
if we embrace the `options` from the signature of `vm.runInContext(code, ctx, options)`, we can
pass in the filename so the stack trace is correct.

## 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)
2023-01-26 10:16:53 +00:00
JJ Kasper
8f05c0c07e
Update flakey test cases (#45290) 2023-01-25 22:55:49 -08:00
Will Binns-Smith
3e0231735b
build(cargo): update turbopack to turbopack-230125.1 (#45283) 2023-01-25 19:38:38 -08:00
Hyunseung Lee
412dfc52cc
Update getting-started documentation (#45284)
## 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: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-01-26 01:25:42 +00:00
Rishabh Poddar
9a82bba86e
Updates with-supertokens example app (#45214) 2023-01-25 16:41:07 -08:00
Shu Ding
d5504cea2c
Allow metadata related exports in TS plugin (#45282)
This PR ensures that `metadata` and `generateMetadata` are valid exports
for pages and layouts during the TS plugin check.

## 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>
2023-01-25 23:48:19 +01:00
Shu Ding
f2a295de9d
Fix typo in TS plugin (#45279) 2023-01-25 14:12:08 -08:00
Shu Ding
e8b208d170
TS plugin: warn about amp config in app (#45254)
Asked by @ijjk in
https://github.com/vercel/next.js/pull/45228#discussion_r1086004983:

<img width="1171" alt="CleanShot 2023-01-25 at 10 26 15@2x"
src="https://user-images.githubusercontent.com/3676859/214526847-6481e33b-060e-4e15-bf1d-4274760068f5.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)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-25 22:19:19 +01:00
JJ Kasper
e868f77ede
Update app cache handling in development (#45248) 2023-01-25 11:51:53 -08:00
Shu Ding
2725a379bb
Attach exports information in SWC transforms (#45261)
Fixes NEXT-414

## 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)
2023-01-25 12:51:59 +01:00
Shu Ding
ac0b6d2a71
Update transform exports and tests (#45251)
<!--
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

- [ ] 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)
2023-01-25 10:44:13 +01:00
JJ Kasper
6a51edc35d
v13.1.6-canary.1 2023-01-24 20:00:52 -08:00
Andrés Bedoya (SrHart)
91e0be1c3e
Update no-html-link-for-pages.md (#45247)
Update no-html-link-for-pages.md based on the new link API https://nextjs.org/docs/api-reference/next/link
2023-01-25 03:17:09 +00:00
JJ Kasper
7b40ffa587
Add handling for app/pages manifest race condition (#45244) 2023-01-24 17:51:18 -08:00
Jan Kaifer
5ca8bd943a
Revert "Fix new-error command" (#45221) 2023-01-24 16:47:48 -08:00
OJ Kwon
a6dcbfedd0
ci(workflow): notify new releases to vercel/turbo via repo_dispatch (#45201)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-24 16:41:28 -08:00
Julius Marminge
00cbc5abf4
refactor(create-next-app): simplify import alias validation logic (#45241) 2023-01-24 16:36:16 -08:00
JJ Kasper
298148809c
Increase cache timeout for swc built files (#45243) 2023-01-24 16:12:18 -08:00
Jimmy Lai
2811722ba0
misc: change strategy for link prefetch test (#45234)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-24 16:04:56 -08:00
Hannes Bornö
018208fb15
Add editor links to RSC build error (#45179) 2023-01-24 15:13:37 -08:00
Clemens Paumgarten
43b6e08eea
Update testing.md (#45216)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-24 14:22:49 -08:00
JJ Kasper
f9c10469a2
Run dev tests against default CNA templates (#45211) 2023-01-24 11:01:03 -08:00
Jiachi Liu
45a9373113
Support metadata icons field (#45105)
NEXT-400

## Feature

- [x] 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`
- [x] [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)
2023-01-24 18:19:11 +00:00
Jimmy Lai
ff1664b11b
perf: avoid sync re-renders when using next/link and next/image (#45165)
fixes NEXT-164

## Context

This PR fixes an issue happening when using `next/image` or `next/link` where rendering them caused sync re-renders with React. This breaks [selective hydration](https://github.com/reactwg/react-18/discussions/130) in React.

## The fix

The cause of this behaviour is that we're calling `setState` in a ref mount, which basically "forces" React to disable concurrent rendering. It finishes the render, runs synchronously the passive effects and re-renders again to make sure that everything is in sync, all of that in without yielding to the browser to paint.

Here in this case, the `setState` call is because of the `useIntersectionObserver` hook. It's implemented in a way that requires the user to call a setter that will store the ref value in a component state variable to re-trigger a render and re-run the effect to create the intersection observer.

This is not necessary as the ref init phase always runs before the passive effect runs, so we can just copy the ref to another ref inside `useIntersectionObserver` without triggering a re-render.

## Before/After

1st screenshot: before
2nd screenshot: after

Basically on the first screenshot, you can see that React is doing a synchronous re-render (see `flushPassiveEffects`). This is not good.

If you look at screenshot 2, you can see it does not happen anymore and that the passive effects are flushed in another block in the flamegraph.

<img width="1110" alt="CleanShot 2023-01-23 at 14 30 11@2x" src="https://user-images.githubusercontent.com/11064311/214051860-c42d2849-cd10-4922-a3e0-9b715fc87b23.png">

<img width="520" alt="CleanShot 2023-01-23 at 14 29 01@2x" src="https://user-images.githubusercontent.com/11064311/214051555-04adf516-9c0b-4056-ac65-1ef33614c767.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)
2023-01-24 17:47:18 +00:00
Jan Kaifer
b386f680cc
Update handling of autoscrolling on navigation in app (#43845)
- Add support for scrolling to the sides and down when navigating
- Add tests for vertical scrolling
- Add tests for horizontal scrolling
- Add tests for `router.refresh()`
	- should not scroll by itself
	- should not block router.push from scrolling
	- should not scroll when page refreshed using fash refresh
- Scroll to the top of document if that gets page into viewport
	- I didn't want to implement some heuristics on if we can scroll to the top of the page so I just scroll there and check.
	- This implementation may not play well with some nested scrollable containers (but that never worked, just FYI)
	
- Improved typings on `BrowserInterface` a little - backward compatible change.

Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
2023-01-24 15:41:06 +00:00
Tim Neutkens
a4a5f84b00
Allow unit tests to be written in packages/next/src (#45222)
Allows `.test.ts` to be colocated next to files so that unit tests can be written in the Next.js core codebase.

## 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)
2023-01-24 14:32:09 +00:00
JJ Kasper
2e251cb85f
Revert "Revert "Revert "Revert "Initial support for metadata (#44729)"" (#45113)"" (#45196)
Hopefully last time

Reverts vercel/next.js#45130
2023-01-24 13:21:59 +00:00
Jan Kaifer
558d61f5fc
Fix turbo cache miss due to depending on gitignored files (#45166)
Workaround for this issue in turbo https://github.com/vercel/turbo/issues/2560

It caused that we always cache-missed.
2023-01-24 11:53:07 +00:00
Hannes Bornö
0d2aeb570d
Reduce component stack spacing for components without metadata (#45218)
Reduces the spacing when the component doesn't have any metadata.

Before
![image](https://user-images.githubusercontent.com/25056922/214269347-a9da3372-b22e-45ef-89a8-f9c794e661f4.png)

After
![image](https://user-images.githubusercontent.com/25056922/214269203-0fd6fb53-1cf8-44a2-94e1-427ab234c1d6.png)

Compared to components with file
![image](https://user-images.githubusercontent.com/25056922/214269573-5e723669-5eb9-446d-bc1a-ca8d9d8fe612.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)
2023-01-24 11:15:05 +00:00
Hannes Bornö
7d00e362d2
Show component stack in error overlay on hydration error (#45089) 2023-01-24 11:12:29 +01:00
Hannes Bornö
6b5f5d2f9f
Add build time error if error.js is missing "use client" (#44961) 2023-01-24 09:57:40 +01:00
Derek Tissaw
05d887dc3b
Fix error overlay links in parenthesis (#45155)
Fixes https://github.com/vercel/next.js/issues/38362

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-23 20:09:11 -08:00
JJ Kasper
c0ad169e17
Ensure ctrl + c handling works with CNA prompts correctly (#45205) 2023-01-23 19:30:38 -08:00
Thomas Ballinger
0670d8b283
Pin library version in Convex example (#45206)
The version spec for [convex](https://www.npmjs.com/package/convex) in the convex example was `latest`, which meant developers who created a project with this example during the period of time between a new convex release with non-back compatible changes and an update to the demo in this repo would have broken projects. For less stress all around, let's pin the version here!

## 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)
2023-01-24 03:16:54 +00:00
Julius Marminge
98156d13ce
fix: add src prefix on index page (#45150)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-23 18:57:15 -08:00
ilyasmez
57d0e77f78
chore: fix invalid-new-link error typo (#45157) 2023-01-23 17:06:50 -08:00
JJ Kasper
752136e84b
v13.1.6-canary.0 2023-01-23 15:04:49 -08:00
Jan Kaifer
1c7f66c70b
Update testing.md to reflect that we don't use yarn anymore (#45185) 2023-01-23 14:41:42 -08:00
JJ Kasper
775254af74
Add timeout for actions/cache restoring (#45198) 2023-01-23 14:39:11 -08:00
Jiachi Liu
e6ff749aee
Fix React.lazy preloading during SSR (#45160)
## Bug

Previously the `React.lazy` and Loadable preloading are creating different module loading promises with loader. Now we change to wait the loader in `React.lazy` to make sure for SSR case they're preloaded. The case to trigger this bug is: When adding `Document.getInitialProps` (aka. gIP), rendering goes to process the gIP first which would make the lazy elements executed before gIP, then preloading will happen after lazy which leads to Suspense resolves too fast without content.

Fixes #45151

- [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)
2023-01-23 22:13:37 +00:00
Jiachi Liu
e33e46d950
Fix dynamic no ssr with babel transform (#45091) 2023-01-23 13:39:47 -08:00
asad
095a3c4b27
Update example test file name in cypress example (#45146)
closes https://github.com/vercel/next.js/issues/45145

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-23 13:37:56 -08:00
JJ Kasper
f931a636e1
Add debug info to static bailout message (#45192) 2023-01-23 13:25:00 -08:00
Cachorro Cami
1fa16e6dee
Update README.md for examples/with-mqtt-js (#45162)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-23 12:22:11 -08:00
Max Leiter
a3b89a5230
create-next-app: warn if project dir isn't empty before prompts (#45195) 2023-01-23 12:10:45 -08:00
JJ Kasper
189008c6a9
Re-prompt on invalid import alias (#45194) 2023-01-23 12:00:02 -08:00
JJ Kasper
4e6ea4aaf2
v13.1.5 2023-01-23 11:32:41 -08:00
JJ Kasper
8dac22ad56
v13.1.5-canary.3 2023-01-23 10:40:13 -08:00