Commit graph

6826 commits

Author SHA1 Message Date
Jiachi Liu
6028a7a69f
Remove react root condition and always use concurrent mode (#42141)
Removing the `hasReactRoot` condition and `__NEXT_REACT_ROOT` env var since next 13 requires latest react 18 to be installed, all the react 17 (non concurrent mode) compatible code can be dropped now.
2022-10-29 20:34:03 +00:00
Shu Ding
6e734d92a1
Fix CSS imports from outside of the app dir when src folder is present (#42108)
Previously we use `path.join(compiler.context, chunk.name)` as the entry
name, which isn't always the case especially when there is the `src`
folder. This PR fixes that by using `appDir`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-29 01:38:55 -07:00
Jiachi Liu
d510204fe5
types: leverage webpack types and remove casting (#42104)
* Use webpack types directly through webpack namespace
* Remove webpack types casting to any
2022-10-29 04:00:33 +02:00
teobler
e2e1048b71
fix: Data URL images with 'fill' are always triggering 'missing sizes' warning (#42030)
fixes https://github.com/vercel/next.js/issues/42006

this issue occurred because images with `data url` src start with `blob`
and `data` will be mark as `unoptimized`, then its `sizes` will be
assigned with `undefined`.

I just skip the check for `data url` images, if there is any better
solution, we can have a discuss here.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

- [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: Steven <steven@ceriously.com>
2022-10-28 18:08:04 -04:00
Shu Ding
984bd77bdc
Fix css modules imports in client components (#42077) 2022-10-28 14:43:50 -07:00
JJ Kasper
80843e1a2b
Fix turbo custom config detection (#42022)
Fixes: https://github.com/vercel/next.js/issues/41920

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-28 14:36:42 -07:00
Jiachi Liu
70e7e58c37
Update react next channel (#42021)
Update react channel for `fetch` patching updates 

x-ref: [slack
thread](https://vercel.slack.com/archives/C03ENM5HB4K/p1666802006931969?thread_ts=1666799939.726859&cid=C03ENM5HB4K)
2022-10-27 17:33:47 -07:00
Tim Neutkens
65083f8faa
Allow disabling Strict mode in app (#41894)
Follows `reactStrictMode`. Still recommended to have it enabled (which is the default for new apps).  This will become increasingly more important as other features on top of concurrent rendering are implemented.


## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-28 00:30:07 +00:00
Shu Ding
491a21b5f1
Fix build type error of page params (#42019)
This PR temporarily fixes #41884 by loosing the type check rules. I will
work on a follow up PR to type params better with tests.

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2022-10-27 16:53:38 -07:00
Jiachi Liu
3618b9017e
Merge app internal chunk into main chunk for layouts (#41902)
When emitting the client components entry from server compiler, merging
app internal entry into main-app to avoid duplicated chunks like react
are generated in both sides

Related: https://github.com/vercel/next.js/issues/41870
2022-10-27 16:50:46 -07:00
Hannes Bornö
4b004957fe
Google fonts multiple weights & styles (#42008)
Enable using multiple weights and styles in the same google font loader
call.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-27 15:25:57 -07:00
Tim Neutkens
b9140ed40b
Add never return type for redirect() and notFound() (#42009)
Ensures cases like this work:

```
function username(user: null | User) {
  if (!user) redirect();
  return user.name;
}
```
<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-27 15:07:59 -07:00
Shu Ding
c8983a6b0a
Fix page static info extractor for app dir (#42001)
We currently only fallback to the global `runtime` option if the page
actually **needs** a runtime (not statically optimizable). That happens
for SSG (ISR) and SSR for pages/. But for app/, we will always need a
`runtime` to render server components.

Also in this PR, I improved the tests to actually **test** the runtime
to ensure it has `globalThis.EdgeRuntime` so it's not running in the
Node.js runtime
([ref](https://edge-runtime.vercel.app/features/available-apis#addressing-the-runtime)).

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 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-10-27 14:55:35 -07:00
OJ Kwon
5d2e2783d7
fix(next/dev): do not suppress error from bindings (#41989)
## Bug

Minor fix to --turbo to not to suppress errors thrown from bindings.

- [ ] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-27 21:33:38 +00:00
Shu Ding
b512f8d8b5
Revert "Include frameworks in main-app" (#41997)
Reverts vercel/next.js#41465

This resolves #41870, will investigate and reopen a better solution to
reduce number of loaded chunks in the future.
2022-10-27 13:13:16 -07:00
Kiko Beats
288144c7e5
Upgrade Edge Runtime (#41987)
dropped node12 support

Co-authored-by: Steven <steven@ceriously.com>
2022-10-27 15:07:05 -04:00
Steven
191710ddfe
Show error message when using legacy props on new next/image (#41930)
This PR shows a better error message when using legacy props on new
`next/image` (introduced in Next.js 13) and makes the codemod more
discoverable.
2022-10-27 12:17:28 -04:00
JJ Kasper
0beed3563c
v13.0.1-canary.0 2022-10-27 00:22:43 -07:00
Balázs Orbán
4d20beb7c5
BREAKING CHANGE: feat(edge): split NextCookies to RequestCookies and ResponseCookies (#41526)
Ref: [Slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1666056382299069?thread_ts=1666041444.633059&cid=C035J346QQL),
[docs update](https://github.com/vercel/front/pull/17090)

Spec: https://wicg.github.io/cookie-store/

BREAKING CHANGE:

Ref: https://github.com/vercel/edge-runtime/pull/177,
https://github.com/vercel/edge-runtime/pull/181

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-27 00:20:39 -07:00
Yomi Ikuru
0e25f8c629
[Doc] Update inline documentation for next/link (#41871)
## Addresses Issue #41807

## 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/examples/adding-examples.md)

Co-authored-by: Yomi Ikuru <abayomi.ikuru@gmail.com>
2022-10-26 23:32:03 -07:00
Kévin Berthommier
05d4c9e729
Fix lint cli help (#41783)
<!--
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`

## 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 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-10-26 23:02:08 -07:00
Hannes Bornö
e64bf98511
Update font links and add missing error (#41910)
Adds an error that was missing. Link to beta until the changes are live.

closes #41900

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-26 23:00:40 -07:00
Tim Neutkens
c6107a9189
Add data attribute to div to distinguish it (#41889)
Makes it clearer why this is added by Next.js and allows searching for
it in the docs.

You can learn more about why here:
https://beta.nextjs.org/docs/routing/linking-and-navigating#focus-and-scroll-management

<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-26 22:51:16 -07:00
JJ Kasper
9781c62c30
Fix revalidate check in client component (#41917)
Ensures we check for the explicit type on revalidate as client
components can return an object when accessing module export.

Patched deployment can be seen here
https://next-13-client-page-iuqrog6hj-ijjk-testing.vercel.app/broken

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/41890
2022-10-26 17:24:38 -07:00
Karl Horky
d402bb71ab
Remove swcMinify: true since this is 13's default (#41869) 2022-10-26 10:51:28 -07:00
LongYinan
83347b3efa
Rest of options in experimental.turbotrace and documentation (#41817)
<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-26 14:31:49 +08:00
LongYinan
1b2636763c
Update Cargo.lock file 2022-10-26 11:56:53 +08:00
JJ Kasper
63aab20a2c
v13.0.0 2022-10-25 09:16:28 -07:00
JJ Kasper
bee5215407
v12.3.2-canary.43 2022-10-25 05:14:49 -07:00
JJ Kasper
e841558cf3
Update async storage fix (#41779)
<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-25 05:13:24 -07:00
Tim Neutkens
f9768a7122
Add head handling (#41768)
- Port tests
- Handle head on initial SSR

<!--
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`

## 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 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>
Co-authored-by: Josh Story <jcs.gnoff@gmail.com>
2022-10-25 05:10:30 -07:00
JJ Kasper
bd16ef3c1b
v12.3.2-canary.42 2022-10-25 02:59:20 -07:00
Tobias Koppers
b69dcb5dd2
Make ship happen (#41776)
The Snozzberries taste like Snozzberries...!

Co-authored-by: OJ Kwon <kwon.ohjoong@gmail.com>
Co-authored-by: LongYinan <lynweklm@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
2022-10-25 02:56:26 -07:00
JJ Kasper
a090b5cdec
Ensure async_hooks are not resolved for client (#41778)
Fixes: [slack
thread](https://vercel.slack.com/archives/C02UJN0A1UL/p1666689839050269)
2022-10-25 02:51:41 -07:00
JJ Kasper
e7f97c332e
Fix no-store test case (#41775)
<!--
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:
-->

x-ref:
https://github.com/vercel/next.js/actions/runs/3319321225/jobs/5484439514
2022-10-25 02:05:48 -07:00
JJ Kasper
fe5a502d51
v12.3.2-canary.41 2022-10-25 01:36:20 -07:00
JJ Kasper
f2d2dde5ba
Fix revalidate during dev (#41772)
Fix typo `revalidate` -> `fetchRevalidate`
2022-10-25 01:27:02 -07:00
JJ Kasper
67c802ac17
Add initial head handling in app (#41607)
<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-25 01:09:26 -07:00
Jiachi Liu
e8d5de6b07
Only import dev overlay for dev mode (#41771)
* Import dev overlay for dev mode only
* Remove other unused code

<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-25 00:53:13 -07:00
Gal Schlezinger
455161cb3c
[typescript] fix typo in edge runtime name (#41773)
There's a typo, the `l` is missing in "experimenta**l**-edge", so this
PR fixes it :sunglasses_+1:

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-25 00:46:58 -07:00
Steven
e107bc4561
Throw error <a> child in <Link> (#41756)
This PR improves the error message when `<a>` is a child of `<Link>`
2022-10-24 22:39:22 -07:00
Steven
a5d674237a
Bump minimum Node.js version to 14.6.0 (#41765)
We found a case where 14.0.0 breaking with private class methods, such
as:

```js
class C {
  #x() { return 42; }
  x() {
    return this.#x();
  }
}
```

This feature was introduced in Node.js 14.6.0, so we can bump the
minimum version.

See https://node.green
2022-10-24 21:47:54 -07:00
Janicklas Ralph
16c7480fcf
Updating avg width metrics for google fonts (#41755)
Updating the average with using the string
"aaabcdeeeefghiijklmnnoopqrrssttuvwxyz "

<!--
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`

## 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 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: Hannes Bornö <hannes.borno@vercel.com>
2022-10-24 21:17:32 -07:00
Hannes Bornö
10e7d45231
Font description and error messages (#41764)
Improve font error messages and readme

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-25 03:15:06 +00:00
Jiachi Liu
78bf0a792b
Update react next channel (#41761)
apply react updates x-ref: https://github.com/facebook/react/pull/25560
2022-10-25 02:32:20 +00:00
Hannes Bornö
1d596ca90c
Pathname and search params SSG (#41247)
Bailout to client rendering when using useSearchParams and usePathName
during SSG.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-24 18:58:10 -07:00
Jiachi Liu
f5a89eb00a
Dont apply existing externals path changing to rsc layers (#41744)
We have existing rule for pages ssr that `next/dist/server` and
`next/dist/shared` will not be bundled, but we shouldn't apply it to rsc
layers since the they should bundle the dependencies in their own way.

Adding a test that using `next/head` in the page, since head is exported
from `next/dist/shared`, expect the page is not broken but we don't
expect it's working

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-24 18:00:44 -07:00
Shu Ding
c124cabdc7
Fix edge entry layer resolution bug (#41757)
By default the edge page entry is in the client layer because it bundles Next.js. It's a virtual loader (edge-ssr-loader) but that makes the SWC loader think the page's source is a client component.

We use the resource query `__edge_ssr_entry__` to convert it to the server layer but we need to add that condition to the SWC loader too.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-25 00:33:19 +00:00
ahhshm
8678865907
feat: set a better type for the default image loader (#41639)
## 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 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-10-24 23:59:07 +00:00
JJ Kasper
17a4f6a69f
v12.3.2-canary.40 2022-10-24 16:23:32 -07:00
Javi Velasco
4b8f16c7da
Add message for appDir feedback (#41751)
This PR adds a message with a link to leave feedback for `appDir` when
the user enables it.
2022-10-24 16:21:28 -07:00
Shu Ding
e9684b0225
Remove unneeded types (#41752)
We are moving the Head export.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-24 16:02:19 -07:00
Shu Ding
8fd5f0b591
Add default not found template (#41750)
It should correctly render the global not found fallback page even if
the not-found file is missing.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-24 15:46:59 -07:00
Hannes Bornö
c5111f772f
Update font avg (#41734)
Update the avg calculations.

## 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 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-10-24 13:47:19 -07:00
Steven
b17701372c
Add error if app detected but config is missing (#41696)
Previously, creating the `app` dir without enabling the config would
print an error about `pages` missing:

> Couldn't find a `pages` directory. Please create one under the project
root

This PR prints a better error message:

> The `app` dir is experimental. Please add `{experimental:{appDir:
true}}` to your `next.config.js` to enable it

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-24 13:42:11 -07:00
Shu Ding
383ec5a6a6
Fix static generation and crawler requests (#41735)
Right now the SSG condition is determined _only_ based on
`supportsDynamicHTML`. However that `supportsDynamicHTML` flag can be
affected by bots too.

Here we exclude the `isBot` condition from the SSG flag, and set proper
status and meta tags for static HTML requests (and/or 404 cases).

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 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-10-24 13:38:30 -07:00
JJ Kasper
3a0fc134df
Update CNA app template (#41701)
Updates the template

## 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/examples/adding-examples.md)

Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-24 13:23:00 -07:00
Shu Ding
fa04df25e1
Fix ignored file path (#41747)
<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-24 13:18:49 -07:00
Shu Ding
ef62bf3bf1
Fix module trace error messages to not include queries (#41738)
This improves errors like this:

```
One of these is marked as a client entry with "use client":
  app/page2/page.tsx?__edge_ssr_entry__
```

## 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 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-10-24 12:32:43 -07:00
Kiko Beats
89355298f2
Upgrade Edge Runtime v.1.1.0 (#41727)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-24 10:49:49 -07:00
JJ Kasper
997a4f3740
v12.3.2-canary.39 2022-10-24 09:07:31 -07:00
Shu Ding
92254d137a
Emit VSCode settings for TypeScript (#41710)
This makes sure that the TypeScript in the workspace can be enabled.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-24 01:07:56 -07:00
Jiachi Liu
20f5db06fa
Update precompiled react to next channel (#41708)
Precompile `react@next` and to unlock `cache` and `use` API
2022-10-24 00:31:52 -07:00
Javi Velasco
95af245498
Fail on prerendering with dynamic error config (#41707)
This PR adds the ability to fail on pre-rendering for a page configured
with `dynamic="error"`
2022-10-23 23:08:15 -07:00
JJ Kasper
ceb07ff00c
v12.3.2-canary.38 2022-10-23 22:25:08 -07:00
Shu Ding
fbe1ffb657
Include resolved external package dirs (#41706)
We currently assume that external packages are installed via a package
manager, but actually in a monorepo they can be in local.

## 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 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-10-23 22:23:50 -07:00
Hannes Bornö
ef7de2a93f
Font subsets in function call (#41694)
Enable setting font specific subsets in the call.

## 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 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-10-24 05:21:38 +00:00
Jiachi Liu
a9d1452164
Move redirect and notFound to navigation exports (#41703)
* Move `notFound` and `redirect` to `next/navigation`
* Mark createContext related hooks as client components
2022-10-23 21:49:48 -07:00
Donny/강동윤
2d9e17c6fe
chore: Update swc_core to v0.40.16 (#41702)
This PR applies https://github.com/swc-project/swc/pull/6241 to fix the
build
2022-10-23 21:29:38 -07:00
JJ Kasper
752f06f701
Revert "Revert "chore: Update swc_core to v0.40.13"" (#41700)
Reverts vercel/next.js#41699

Seems this isn't the root cause x-ref: [slack
thread](https://vercel.slack.com/archives/CGU8HUTUH/p1666583144325379?thread_ts=1666573520.221259&cid=CGU8HUTUH)
2022-10-23 20:48:01 -07:00
JJ Kasper
49842b9e83
v12.3.2-canary.37 2022-10-23 20:32:38 -07:00
JJ Kasper
db3e95379c
Revert "chore: Update swc_core to v0.40.13" (#41699)
Reverts vercel/next.js#41692

x-ref:
https://github.com/vercel/next.js/actions/runs/3309747708/jobs/5463279709
2022-10-23 20:29:41 -07:00
Jiachi Liu
5de6f46d39
Support next option for Request (#41614)
Follow up for #41505. Addding `next` option to Request options
2022-10-23 20:24:35 -07:00
JJ Kasper
496b2eb7d3
v12.3.2-canary.36 2022-10-23 20:16:03 -07:00
Steven
b411567792
Print error when next dev has conflicting app & page (#41656)
This PR prints an error when the `app` and `pages` directory contain the
same route.

## build error
<img width="904" alt="image"
src="https://user-images.githubusercontent.com/229881/197424839-67dac580-1e1d-4c31-b769-112f2f38b06e.png">

## dev error
<img width="957" alt="image"
src="https://user-images.githubusercontent.com/229881/197426784-9b5041d9-b6d0-48d5-8ce5-b759bd9e4438.png">

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-23 20:09:59 -07:00
Jiachi Liu
1fa0068610
Disable esm resolving for appDir and alias react (#41687)
When esm package that depending on react is used between `pages/` and
`app/`, it's loading the user installed react through esm loader which
doesn't go through require hook, so we cannot intercept it with
require-hook.

Disable esm resolving when `appDir` is enabled for now, prefering to
pick the cjs bundle so that react import is intercepted by require hook
and pointing to the built-in react

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-23 20:04:23 -07:00
Donny/강동윤
48c7a801c5
chore: Update swc_core to v0.40.13 (#41692)
This PR update swc crates to c025cd01ce

This PR applies

 - https://github.com/swc-project/swc/pull/6235

which fixes an issue of the minifier
2022-10-24 02:38:30 +00:00
Hannes Bornö
af395047d7
App dir sass (#41690)
sass & scss support for 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-23 19:05:55 -07:00
Javi Velasco
d5a682e6e8
Ensure AsyncLocalStorage for static generation is shared for client & server (#41695)
With this PR we make sure that `AsyncLocalStorage` for static generation
is shared for client and server in RSC
2022-10-23 18:57:29 -07:00
Tim Neutkens
4f9e3bf0c2
useSelectedLayoutSegment -> useSelectedLayoutSegments, add useSelectedLayoutSegment with previous behavior (#41693) 2022-10-23 18:48:01 -07:00
hiro
6687f280cf
Fix typos: code comment (#41691)
## 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 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-10-24 01:24:32 +00:00
Tim Neutkens
9c07993321
Revert "Add experimental warning note" (#41688)
Reverts vercel/next.js#41666

As discussed.
2022-10-23 22:38:58 +00:00
JJ Kasper
2c8d29570b
v12.3.2-canary.35 2022-10-23 13:28:49 -07:00
JJ Kasper
b6ed1a7e5f
Update to latest react experimental (#41671)
x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1666452328526929)
2022-10-23 13:10:44 -07:00
JJ Kasper
bed983c575
Update URL malformed edge error (#41685)
It seems we weren't showing the related URL in this error which makes
debugging this very hard.
2022-10-23 12:39:32 -07:00
JJ Kasper
0b921a6b66
Expose AsyncLocalStorage on global for react (#41683)
For compat this needs to be exposed on global in the Node.js runtime as
well as discussed cc @sebmarkbage
2022-10-23 11:34:53 -07:00
Jiachi Liu
374ca388d4
Update params of PageProps to string map (#41677)
x-ref: #41668

Update `PageProps` to `Record<string, string>`

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-23 17:48:20 +00:00
JJ Kasper
70a128e705
Ensure we properly normalize /index in minimal mode (#41678)
x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1666030147833759)
2022-10-23 09:06:03 -07:00
Hannes Bornö
a105515766
Create root layout (#41523)
Creates a root layout if it is missing in DEV when building the page in
`next-app-loader`. If the page is in a route group, the layout will be
created there. Otherwise it will create a layout directly under `/app`.

Breaks the build if a page is found that's missing a root layout.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-23 00:39:30 -07:00
Shu Ding
0a97d07802
Improve error messages (#41669)
Same as #41636 but with a new condition.

## 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 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: Jiachi Liu <inbox@huozhi.im>
2022-10-22 22:13:34 -07:00
Jiachi Liu
a1a26ca7ea v12.3.2-canary.34 2022-10-22 21:00:51 -07:00
Steven
9c7e8b661c
Remove deprecated webpack5 config option (#41667)
This option doesn't do anything except print an error since Next.js 12,
so we can remove it. See previous upgrade guide:


https://github.com/vercel/next.js/blob/canary/docs/upgrading.md#upgrade-nextjs-version-to-12
2022-10-22 18:11:56 -07:00
Shu Ding
aca3e989e7
Improve error message for wrong props (#41668)
This PR improves the type checking error message when you have unnecessary props:

```tsx
export default function Page({ whatIsThis }) {
  return <div>hello</div>
}
```

![CleanShot 2022-10-22 at 17 14 38@2x](https://user-images.githubusercontent.com/3676859/197367064-3aac325e-8756-4295-898c-adc52453d088.png)

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-23 01:01:39 +00:00
Jiachi Liu
b0f87fbc7c
Bundle ssr client layer excepts react externals (#41606)
Bundle the ssr client layer for RSC, this solves the problem when
there's an esm package is using on client components, but esm imports
the installed react instead of the built-in react version since esm
imports is not intercepted by require hook.

After bundling the ssr client layer and treating react as externals, now
react compiles as cjs externals and could be intercepted by require
hook, other code are bundled together which can also get optimized.

## 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`
- [x] 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`

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-22 16:33:51 -07:00
Shu Ding
73499e4bd8
Add experimental warning note (#41666)
## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-22 23:20:22 +00:00
Jiachi Liu
0b669a1fa7
Improve errors for invalid component export (#41657)
Checking if app dir exported components (page/layout/etc.) are valid components in dev mode, also update `react-is` to detect module reference properly

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-22 22:44:19 +00:00
Balázs Orbán
e0b04f22e3
feat(cna): add template (#41660)
Adds a new template for `app/` via `--experimental-app` flag.

## 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 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-10-22 14:18:39 -07:00
JJ Kasper
4ce259fa3e
Update to handle correct react version with app (#41658)
Add auto install handling for the correct react experimental version for
app
2022-10-22 13:29:00 -07:00
Donny/강동윤
78138af505
chore: Update swc_core to v0.40.7 (#41613) 2022-10-22 21:59:06 +02:00
Steven
d260ad2adf
Change data-nimg attribute on next/image (#41612)
For `next/legacy/image`, the `data-nimg` has the `layout` prop value. 

Since `next/image` doesn't have a `layout` prop, we can use `fill` when
the fill prop is used or fallback to `1`.
2022-10-22 11:58:08 -07:00
Javi Velasco
392c4d0b7c
Update @types/node to 14.14.31 (#41634)
This PR updates `@types/node` to `14.14.31`. The most important type is
that `ParsedUrlQuery` can hold `undefined` so we are updating the code
here to explicitly handle those cases. Aside from it we are adding a
global definition taken from NodeJS for `AsyncLocalStorage` that we
export in `server.d.ts`
2022-10-22 11:19:14 -07:00
Jimmy Lai
b5251604e0
layout: add build status for app routes (#41627)
Adds support for:
- outputting what kind of build we did for routes in the app folder:
SSR, SSG, static
- adds the list of SSG'd routes
- adds JS size for app routes

# before

<img width="512" alt="image"
src="https://user-images.githubusercontent.com/11064311/197346761-1f288648-f480-4f3e-97dc-c4eee10ecfbf.png">

# after

<img width="426" alt="image"
src="https://user-images.githubusercontent.com/11064311/197236400-2ba245ab-a7a0-4bbe-b8f7-c9ba6ff755f5.png">

Add build output status for routes for app routes. Unclear if the logic
I added is correct so please take double check (@ijjk maybe?)

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-22 10:04:53 -07:00
Tim Neutkens
9dae7a89d0
Enable ReactRefreshLogBox-builtins.test.ts, remove loader from import trace (#41645) 2022-10-22 14:26:57 +02:00
Tim Neutkens
b6cfeebf13
Refactor hot-reloader client for app (#41598)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-22 09:56:48 +02:00
JJ Kasper
c204552ce2
v12.3.2-canary.33 2022-10-21 23:57:02 -07:00
Jiachi Liu
3a87e816fc
Disable using prebundled of react for appDir (#41635)
reverting https://github.com/vercel/next.js/pull/41337

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-21 23:55:19 -07:00
Hannes Bornö
7796b1e50c
Font loader default config (#41628)
Adds default config if @next/font is a dependency. Warns instead of
errors when subsets is missing.

[slack
ref](https://vercel.slack.com/archives/C03KED0D4N7/p1666226599615489?thread_ts=1666225686.389179&cid=C03KED0D4N7)

## 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 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-10-21 18:08:37 -07:00
Steven
6fb9a192a7
Update next-image-experimental codemod to handle loaders (#41633)
As a follow up to #41585, this PR updates the `next-image-experimental`
codemod to change `loader` to `loaderFile`.
2022-10-21 15:26:42 -07:00
Tim Neutkens
14c9376899
BREAKING CHANGE: Remove React 17 (#41629)
Next.js 13 will require React 18.

In this PR I've only updated the peerDependency and removed the test runs in GH actions. Further cleanup will follow later, this allows us to remove the code supporting it later.



## 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 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: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-10-21 22:20:36 +00:00
Steven
7102050ec7
Add support for images.loaderFile config (#41585)
This PR adds a new configure property, `images.loaderFile` that allow
you to define a path to a file with an exported image loader function.

This is useful when migrating from `next/legacy/image` to `next/image`
because it lets you configure the loader for every instance of
`next/image` once, similar to the legacy "built-in loaders".
2022-10-21 12:31:53 -07:00
Damien Simonin Feugas
6f43c90b92
feat(edge): adds AsyncLocalStorage support to the edge function sandbox (#41622)
## 📖  Feature

Adds `AsyncLocalStorage` as a global variable to any edge function (middleware, Edge API routes).
Falls back to Node.js' implementation. 

## 🧪 How to test

1. `pnpm build`
2. `pnpm testheadless --testPathPattern async-local`
2022-10-21 12:17:58 +00:00
Hannes Bornö
bdc53ef651
Root layout head not required (#41621)
Remove head as required in root layout.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-21 02:12:27 -07:00
Shu Ding
6bd789dad3
Fix missing JSON.stringify in loader (#41599)
We can't directly put `filePath` in the generated code as it can contain in valid JavaScript string such as `"\2"` in `"C:\Users\foo\2022\bar.js"`. Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_octal

Reported issue in Next.js:

![image](https://user-images.githubusercontent.com/3676859/196962933-0a3bf4b4-9142-426f-9ac5-bdcfb3c5ebf0.png)

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 18:41:25 +00:00
Janicklas Ralph
56b097a8fb
Updating size-adjust calculation (#41406)
<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
-->

Updating size-adjust calc to use azAvgWidth instead of xAvgCharWidth

Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-20 10:58:26 -07:00
Hannes Bornö
77ba4a867a
Font loader types (#41591)
Make local and google font loaders more similar. Both should define `weight: string` and `style: string`.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 17:42:19 +00:00
Shu Ding
138a7bfda2
Add transpilePackages option (#41583)
This is a new experimental feature to specify a list of packages (or
subpaths in packages, like `pkg/src/index.ts`), to opt-in Next.js
transpilation in the server build.

cc @jescalan 

## 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`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 18:49:29 +02:00
Jimmy Lai
6d29713023
perf: refactor path logic in router + add LRU cache (#41365)
I'm investigating the runtime perf of the node server and this was one of the hot spot I stumbled upon.

This diff:
- refactors getPagePath to not throw when it doesn't find a path: this function is used to check if a path exists, we don't want that kind of overhead there
- adds a LRU cache to cache the result of the evaluation

Results:

before:
> 110k requests in 11.01s, 285 MB read

after
>135k requests in 11.01s, 348 MB read

on an autocannon run



## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 15:42:50 +00:00
Hannes Bornö
d7348c4ef4
Full remaining path in selected layout segment (#41562)
Make `useSelectedLayoutSegment` include the remaining segments from the current level to the leaf node.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 11:45:16 +00:00
Hannes Bornö
a5d53155cd
Check root layout change on client (#41475)
Moves the logic that checks if there's a new root layout to the client.
Adds test for static and dynamic catchall.

Related: #41457

## 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 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: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-19 18:38:00 -07:00
Seiya Nuta
765791a6d1
Support overriding request headers in middlewares (#41380)
This PR adds a feature in middleware to add, modify, or delete request headers. This feature is quite useful to pass data from middleware to Serverless/Edge API routes.

### Questions for Reviewers

- Should we deny modifying standard request headers like `Transfer-Encoding`?
- Should we throw an error if the header is too large? Real-world HTTP servers will accept up to only 8KB - 32KB.

### New APIs

Adds a new option `request.headers` to the `MiddlewareResponseInit` parameter in `NextResponse.next()` and `NextResponse.rewrite()`. It's a [`Header`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object holding *all* request headers. Specifically:

```ts
interface MiddlewareResponseInit extends ResponseInit {
  request?: {
    headers?: Headers
  }
}
```

### Example

```ts
// pages/api/hello.ts
export default (req, res) => {
  const valueFromMiddleware = req.headers['x-hello-from-middleware']
  return res.send(valueFromMiddleware)
}

// middleware.ts
import { NextRequest, NextResponse } from 'next/server'

export default function middleware(request: NextRequest) {
  // Clone request headers
  const headers = new Headers(request.headers);
  // Add a new request header
  headers.set('x-hello-from-middleware', 'foo');
  // Delete a request header from the client
  headers.delete('x-from-client');

  const resp = NextResponse.next({
    // New option `request.headers` which accepts a Headers object
    // overrides request headers with the specified new ones.
    request: {
      headers
    }
  });

  // You can still set *response* headers to the client, as before.
  resp.headers.set('x-hello-client', 'bar');
  return resp;
}
```

### New middleware headers

- `x-middleware-override-headers`: A comma separated list of *all* request header names. Headers not listed will be deleted.
- `x-middleware-request-<name>`: A new value for the header `<name>`.

## Related Discussions

- https://github.com/vercel/next.js/discussions/31188
- https://github.com/vercel/next.js/discussions/39300

## Bug

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

## 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] Integration 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`

## 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/examples/adding-examples.md)
2022-10-20 01:36:05 +00:00
Shu Ding
b0db95ffc6
Update error message for invalid react-dom/server imports (#41582)
Related discussion:
https://vercel.slack.com/archives/C043ANYDB24/p1666208186363099?thread_ts=1664676119.265829&cid=C043ANYDB24.

Tl;dr: RSC already renders and serializes things dynamically, there is
no need to manually do that in RSC and embed them via
dangerouslySetInnerHTML.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 17:56:14 -07:00
Shu Ding
4adab6a61e
Improve server bundling strategy (#41584)
This PR adds a list of popular packages that should always opt-out
bundling in the server layer.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 17:45:37 -07:00
Shu Ding
bad909e4d1
Update page config APIs (#41580)
This PR updates app configurations from `export const config = { ... }`
to be directly exported.

## 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 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-10-20 02:39:25 +02:00
Tim Neutkens
d261e7cd25
Add back() and forward() to new router (#41575)
Adds `router.back()` and `router.forward()`.
<!--
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`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 17:35:43 -07:00
JJ Kasper
d76d8270d6
Update RSC detection in minimal mode and fix config collection (#41541)
Updates our RSC detection for revalidation in minimal mode and also ensures we await import promises when collecting app dir config. 

x-ref: [slack thread](https://vercel.slack.com/archives/C035J346QQL/p1666202250144319)
x-ref: [slack thread](https://vercel.slack.com/archives/C035J346QQL/p1666125853222599?thread_ts=1666122861.189349&cid=C035J346QQL)
2022-10-19 21:38:54 +00:00
Shu Ding
f055b167a5
Add TypeScript plugin (#41569)
This PR implements the TypeScript plugin (only applied to the app directory), and it will be automatically added to tsconfig.json when running the CLI. Due to how TS plugins work (a package name is required to specify), hence we can't use a subpath import like `next/typescript` for the plugin. To avoid installing a separate dependency, here I propose to reuse the `next` package: if the default export is called with the TypeScript option, we can say it's being used as a plugin. There is also environment variables we can check here, however it's specifically for VS Code (`VSCODE_CLI=1`) where this plugin should be working with other editors too.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 20:59:39 +00:00
Steven
fe762d329f
Fix next/image svg blur placeholder with fill (#41573)
This PR fixes two bugs:

- Fixes #40419 
- Fixes #41393 

The first is when the aspect ratio of the `width` and `height` does not
match the aspect ratio of the `blurDataURL` provided. This can result in
artifacts around the edges. The solution is to add
`preserveAspectRatio="none"`.

The second is when there is no `width` or `height` provided (which is
normal when using `fill`) so the viewBox was undefined. This can also
cause artifacts around the edges. The solution is to change the blur
technique from gaussian to css filter, similar to `next/legacy/image`.

Note: css blur might be [slower in
firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=925025) which is
why we'll only use it for this corner case.
2022-10-19 13:21:41 -07:00
Balázs Orbán
422ccb98b8
fix: allow user directory with styled-jsx prefix in next dev (#41484)
Fixes #41476, ref #40679

## Bug

- [x] Related issues linked using `fixes #number`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 19:01:48 +00:00
Tim Neutkens
4ba1002175
Create hash digest for errors in app in production (#41559) 2022-10-19 19:56:55 +02:00
Shu Ding
fda355daa2
Improve type checking (#41427)
This PR implements the process of generating strict "type guard" files,
to ensure that all entrypoints have the correct export types. The type
checking process happens automatically during `next build`.

## 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 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: Tobias Koppers <tobias.koppers@googlemail.com>
2022-10-19 18:28:36 +02:00
Jiachi Liu
897af6238e
Upgrade react-server-dom-webpack and precompiled assets (#41547)
Upgrade `react-server-dom-webpack` for exports renaming purpose

x-ref: https://github.com/facebook/react/pull/25504
2022-10-19 15:09:49 +00:00
Tim Neutkens
d27185bb9a v12.3.2-canary.32 2022-10-19 13:29:32 +02:00
Tim Neutkens
4e40ba8488
Fix case where dispatch was missing (#41553) 2022-10-19 13:28:24 +02:00
Jiachi Liu
2d1f72995b v12.3.2-canary.31 2022-10-18 21:19:01 -07:00
Jiachi Liu
5d532afa71
Mark styled-jsx as client-only package (#41414)
For css-in-js libs like styled-jsx we don't recommend to use on server side since it will blow up the rsc payload during navigation. This upgration of styled-jsx includes `client-only` as dependency so that it will throw when it's been used on serevr layer

x-ref: https://github.com/vercel/styled-jsx/pull/816
2022-10-19 03:52:33 +00:00
Donny/강동윤
7bde099a43
chore: Update swc_core to v0.39.7 (#41544)
This PR updates swc crates to 287c2f2941


- Closes https://github.com/vercel/next.js/issues/41527.
2022-10-19 03:04:32 +00:00
Steven
cff9fc9d74
BREAKING CHANGE: Remove browsersListForSwc and change default to legacyBrowsers: false (#41529)
Remove `browsersListForSwc` since it is enabled by default now, and disable `legacyBrowsers` by default.

This PR also bumps the default browserslist to the following:

- Chrome 64+
- Edge 79+
- Firefox 67+
- Opera 51+
- Safari 12+

See related RFC:
- Closes #33227 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-19 01:38:39 +00:00
Jiachi Liu
bc335d7ef7
Prebundle react for appDir (#41337)
Inline a react and react-dom for app dir, when `appDir` flag is enabled
opt into the built-in version for all.

For server layer react, use the react share subset for server
components.
For all server side of react-dom usage, use the server-rendering-stub.

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-18 16:32:23 -07:00
JJ Kasper
cf1c0b6075
v12.3.2-canary.30 2022-10-18 09:54:31 -07:00
Shu Ding
761d7646cc
Fix next-app-loader bug in windows (#41520)
There is this `createAbsolutePath` function that concatenates a virtual
route and a dir path. The virtual route uses the posix separator `/` but
the dir path uses `\` in Windows.

Here's an example of the error:

```
error - ./node_modules/.pnpm/next@12.3.2-canary.29_ikefsjgelhtr3cq7h24gohqzbe/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fpage&appPaths=%2Fpage&pagePath=private-next-app-dir%
2Fpage.tsx&appDir=E%3A%5CWorkSpace%5C2022%5Csongbook.studio%5Capp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js!
Module parse failed: Octal literal in strict mode (9:41)
```

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-18 09:53:08 -07:00
Steven
9c5bb5bfe9
BREAKING CHANGE: Remove target: serverless (#41495)
The `target: serverless` config was deprecated a year ago starting in
[Next.js 12](https://nextjs.org/blog/next-12).

Tests were disabled in #41252 so we can now remove `target: serverless`
and all usage of `target` in `next.config.js`.

Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-18 09:47:13 -07:00
Kiko Beats
ebae05eeed
Update edge runtime to 1.1.0-beta.40 (#41513)
changes: https://github.com/vercel/edge-runtime/compare/edge-runtime@1.1.0-beta.39...edge-runtime@1.1.0-beta.40
2022-10-18 13:57:11 +00:00
Balázs Orbán
a36798968f
fix(ts): Cookies -> NextCookies (#41491) 2022-10-18 15:13:42 +02:00
JJ Kasper
df0e61b023
Fix app sc_client componet HMR server-side (#41510)
This ensures we properly clear the `sc_client` component cache from
`react-server-dom-webpack` in development so that HMR works properly
after a refresh.

## Bug

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

Fixes: [slack
thread](https://vercel.slack.com/archives/C043ANYDB24/p1666051202574509)
2022-10-18 00:48:27 -07:00
Jiachi Liu
fcac2e2b8a
Move fetch revalidate config under next options (#41505)
x-ref:
[slack-thread](https://vercel.slack.com/archives/C035J346QQL/p1665425741387879)
2022-10-18 00:44:30 -07:00
JJ Kasper
45c36e66d8
Enable swcMinify by default (#41506)
x-ref: [slack
thread](https://vercel.slack.com/archives/CGU8HUTUH/p1666067928896099?thread_ts=1666066448.770739&cid=CGU8HUTUH)
2022-10-17 23:33:04 -07:00
Tim Neutkens
c5896f2850
Add vary header to fix incorrectly caching RSC as HTML response (#41479)
Add failing test for the back button download bug. Created it as a new
app given that adding it to the existing `app` suite did not reproduce
the issue for some reason.

The underlying reason is that we need to add `Vary: __rsc__,
__next_router_prefetch__` to ensure Chrome does not cache the response
and serve it on back button.

The download was caused by the `application/octet-stream` content type,
but that was just a consequence of serving the wrong response.

<!--
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`

## 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 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-10-17 22:34:29 -07:00
Seiya Nuta
366da263df
Append the fragment in NextUrl.toString() (#41501)
<!--
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:
-->

Consider the following middleware which redirects to
`/path/to#fragment`.

```ts
import { NextResponse } from 'next/server';

export async function middleware(request) {
  const url = new URL('/path/to#fragment', request.url);
  return NextResponse.redirect(url);
}
```

However, it actually redirects to `/path/to`, namely it discards the
fragment part in the destination URL `#fragment`. This is because
`NextURL.toString()` does not append that part. This PR fixes the bug.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-17 21:56:28 -07:00
Shu Ding
c5c2c9d38b
Fix global css being marked as side effect free (#41481)
It’s possible that global CSS imports, that come from node_modules, are
marked as side effect free because of possible `sideEffects: false` in
the external package's package.json. In that case, we still need to
handle global CSS imports as side effects on the server because we need
to collect them and avoid tree-shaking for these modules.

You can take a look at the test case to see what exactly happened.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-17 21:34:47 -07:00
Shu Ding
0c2c48e536
Avoid using the CSS href as the link tag key (#41493)
There is no need to use the href as key in our case because it's pure
during SSR and it won't re-order on the client. By using `index` we can
avoid some duplicate bytes here:

![CleanShot 2022-10-18 at 00 21
20@2x](https://user-images.githubusercontent.com/3676859/196295175-c5b437f7-0ae9-4d89-9d96-9594686168ae.png)

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-17 21:30:23 -07:00
Tim Neutkens
f260328900
BREAKING CHANGE: Enable newNextLinkBehavior (#41459)
- Enable newNextLinkBehavior. See #36436 
- Run next/link codemod on test suite

Note that from when this lands on apps trying canary will need to run
the new-link codemod in order to upgrade.
Ideally we have to detect `<a>` while rendering the new link and warn
for it.

Co-authored-by: Steven <steven@ceriously.com>
2022-10-17 21:20:28 -04:00
Alexander Sviridov
f5cb7bd829
fix(41456): check src/app folder too in getHasAppDir (#41458)
fixes https://github.com/vercel/next.js/issues/41456

When we check if app folder exists, check for src/app path too

## Bug

- [x] Related issues linked using `fixes #number`
- [x] 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 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: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-17 15:32:44 -07:00
Felipe Barso
6249307b75
fix(stream): Allows body larger than 16 KiB with middleware (#41270)
Fixes #39262

The solution is to call `stream.push(null)` to trigger the `end` event
which allows `getRawBody` to run completely.

<!--
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

- [x] Related issues linked using `fixes #number`
- [x] 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

- [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/examples/adding-examples.md)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-17 15:26:16 -07:00
Tim Neutkens
ce60157b1b
Fix useSearchParams comment (#41483)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-17 19:07:07 +02:00
Donny/강동윤
7a8c58fedd
chore: Update swc_core to v0.38.22 (#41477) 2022-10-17 17:08:14 +02:00
Steven
e2f16f96c2
Update next/image docs and examples (#41434)
This PR updates the docs for the following code change:

- #41399

There are a few updates here:

- [x] Update docs
- [x] Update links to docs inside component
- [x] Update examples
- [x] Fix corner cases in codemod
2022-10-17 10:41:35 -04:00
Steven
e61820e04d
Fix typo and add comment to next/image SyntheticEvent (#41480)
- Fix typo 
- Add comment
- Link back to react docs
- Remove unnecessary variable
2022-10-17 10:40:40 -04:00
Shu Ding
a75b323877
Include frameworks in main-app (#41465)
There is no need to have a separate `framework` chunk for React and React DOM, as they're already included in the `main-app` entry. With this PR, React and React DOM will be included in `main-app` directly and app is no longer depending on the `framework` chunk.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-17 13:48:52 +00:00
Tim Neutkens
7be2ef0fcf
Ignore serverComponentChanges in pages (#41464)
Slightly different version of #41020 where it does not end up being an unknown event.



## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-16 21:34:33 +00:00
Sukka
7c2fd34510
fix(app-render): make css and font respect assetPrefix (#41455)
Add missing `assetPrefix` for link tags (`@next/font` and CSS).
The PR also merges multiple duplicated `renderOpt.assetPrefix || ''`.
2022-10-16 19:56:15 +00:00
Tim Neutkens
1d37afb351
Disable isNavigatingToNewRootLayout (#41457)
Hannes is going to change the approach to be compatible with static.



## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-16 15:41:13 +00:00
Tim Neutkens
bc3d8be4ee v12.3.2-canary.29 2022-10-16 11:49:30 +02:00
Tim Neutkens
fb30be485d
Rename reload to refresh in new router (#41448)
Renames `router.reload` to `router.refresh` to better reflect that it refreshes the rendered page instead of being a blank slate.


## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-15 20:29:09 +00:00
Sukka
85f7d4b396
perf(#41392): improve cache busting inject performance (#41443)
The PR continues from #41392.

In #41392 the `dev ? cache-busting : empty` is executed per stylesheet instead of per page rendering. Since rendering link tags would be a hot path at the server, it might have accidentally introduced a performance overhead. The PR fixes that.

Note, this change also makes `Date.now()` only execute once instead of per stylesheets, however, this will most likely not cause any issues.
2022-10-15 19:42:48 +00:00
Tim Neutkens
482e3fbffa
Change useSearchParams to URLSearchParams (#40978)
Similar to #40872 `useSearchParams` now returns a `URLSearchParams` instance instead of a plain object.


## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-15 19:16:50 +00:00
Tim Neutkens
1b8478270c
Don't show error overlay for not found and redirect (#41438)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-15 18:46:36 +02:00
Donny/강동윤
59eefb2aba
chore: Update swc_core to v0.38.4 (#41401)
This PR updates swc crates to 3ff55caa38

This PR applies various improvements, and more importantly https://github.com/swc-project/swc/pull/6142
2022-10-15 02:18:38 +00:00
JJ Kasper
8c3366a9f4
Fix middleware dynamic route param on query hydration (#41436)
Ensures query params aren't included when parsing dynamic route params
during query hydration for a middleware matched path.

## Bug

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

Fixes: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1665692236623799)
2022-10-14 18:46:28 -07:00
Sukka
ff70562e8d
chore: bump server pre-compiled target to Node.js 14 (#41424)
Follows #41150, bump the server-side code pre-compile target to Node.js
14.0.0.

This could also potentially reduce the size of the server bundle and
increase the performance (less transformation and fewer inlined swc
helpers).

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-14 18:40:57 -07:00
Hannes Bornö
974e8b61c7
Move root layout validation (#41338)
Moves where the validation is made to make sure the error reaches the
client. Tests that an error overlay is shown on the client.

## 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 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-10-14 13:55:09 -07:00
Justin Ridgewell
af066d9679
Add new diagnostics (#41429)
## 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 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-10-14 13:38:27 -07:00
JJ Kasper
0d376b3684
Update flakey dev AMP tests (#41428)
These tests have been flakey for a quite a while and this blocks changes
that are unrelated so this skips them for now.

x-ref:
https://github.com/vercel/next.js/actions/runs/3250190671/jobs/5333599972
x-ref:
https://github.com/vercel/next.js/actions/runs/3219413821/jobs/5264815514
2022-10-14 12:04:55 -07:00
Kiko Beats
8c4ef5cbc7
Update edge runtime to 1.1.0-beta.39 (#41418)
https://github.com/vercel/edge-runtime/compare/edge-runtime%401.1.0-beta.37...edge-runtime%401.1.0-beta.39
2022-10-14 09:48:32 -07:00
Jiachi Liu
7297942cfb
Remove edge shared deps (#41413)
Since we have already bundled dependencies for server layer, so the
shared deps chunk group is not needed anymore.
Also changing to esm assets import with next internals for edge function
and middleware build.

The changes are originally from #41337, try to land them separately.
2022-10-14 06:08:48 -07:00
JJ Kasper
889af9fd2c
Fix edge workers being re-used unexpectedly (#41402)
This ensures we don't re-use edge workers locally as they are meant to
be isolated.

## Bug

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

Fixes: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1665708744315109)
2022-10-13 22:56:42 -07:00
Steven
241195ddd6
BREAKING CHANGE: Rename next/image to next/legacy/image & rename next/future/image to next/image (#41399)
This PR introduces breaking changes by renaming components.

- Rename `next/image` to `next/legacy/image`
- Rename `next/future/image` to `next/image`

The diff is very confusing because both components are very similar so git got confused.
2022-10-14 01:59:22 +00:00
JJ Kasper
560e93ef77
v12.3.2-canary.28 2022-10-13 15:30:56 -07:00
Jimmy Lai
70d7d68337
perf: lazy evaluate more modules (#41354)
In this PR, I'm inlining the require for some of the modules that I
noticed take a bit of time to evaluate on a cold boot and are not needed
most of the time.

With this, it's an extra ~15ms win on cold boots (tested locally) and we
are now at around 68ms (started from 110+).

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-13 14:59:46 -07:00
JJ Kasper
a1d830eec8
Fix prefetching for static app paths (#41398)
Ensures we delete the prefetch header when the path is static as it
can't be honored and the full tree must be sent instead.

## Bug

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

x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1665610012952039?thread_ts=1665582783.184029&cid=C035J346QQL)
2022-10-13 14:44:54 -07:00
Néstor
5cd31e41ca
Add npm to create-next-app environment package manager parser (#41279)
Gracefully parse the environment package manager when calling
`create-next-app` instead of passing extra arguments.

Reference: #41090

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

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-13 14:34:55 -07:00
LongYinan
e505e7545b
Upgrade next-swc-napi to NAPI-RS v2 (#40094)
Build succeed https://github.com/vercel/next.js/actions/runs/3243091429
2022-10-13 13:07:14 -07:00
Sukka
e1cb7f74c5
fix: disable css cache busting in production (#41392)
Continuation of #39664 The PR removes `?ts=` in the production mode.
The corresponding e2e test case is also added.

cc @shuding
2022-10-13 16:28:29 +00:00
Jimmy Lai
86050df666
perf: lazy eval headers from the requestStore (#41353)
The `ReadOnlyHeaders` class extends the `Headers` class that is provided
via a polyfill. This incurs some costs the first time it's created
because we need to load that polyfill. This saves approximately 10ms on
my machine on a cold request.

This is only useful when a user does not access headers during the
request of course and when the runtime does not support fetch naitvely.

## 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 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-10-13 17:19:10 +02:00
Tim Neutkens
4ff348cbd4 v12.3.2-canary.27 2022-10-13 15:13:48 +02:00
Hannes Bornö
928ad97984
App font loader tree shaking (#41384)
Fixes tree shaking for font loaders in server components.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-13 11:26:12 +00:00
Tim Neutkens
562b5a380e
Add exports for new router (#41368)
Adds `next/navigation` and `next/headers` APIs. Docs will follow later..



## 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 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-10-13 09:13:39 +00:00
Steven
7fc301d0b5
Fix onLoad prop in next/future/image (#41374)
Fixes a bug in `next/future/image` where `onLoad` might not be called.
This is the same workaround we added for `onError`.
2022-10-12 20:36:33 -07:00
Sukka
054393421a
refactor(#41164): polyfill-module should block hydration (#41352)
The PR continues from #41164.

`next/script` with `beforeInteractive` should not block the hydration,
**but the `polyfill-nomodule` *should* block the hydration** (and should
be loaded before other scripts), as `polyfill-nomodule` includes
multiple polyfills to even execute `main-app.[hash].js` properly on old
browsers (`Array.prototype.includes`, `String.prototype.startsWith`,
etc.).

Without `polyfill-nomodule` being loaded first, the entire
bootstrap/hydration process might not even work on old browsers. So it
should not be loaded through `__next_s`.

cc @shuding

Co-authored-by: Shu Ding <g@shud.in>
2022-10-12 14:08:36 -07:00
JJ Kasper
629fa8afa3
v12.3.2-canary.26 2022-10-12 08:45:51 -07:00
Tim Neutkens
3f1a61b18f
Ensure content is kept rendered below the error overlay on build errors in new router (#41360)
- Remove unused code
- Keep rendering underlying component tree when there is a build error
- Move error catch up one level



## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 14:36:24 +00:00
Shu Ding
b96ff8de2f
Fix CSS imports tree-shaking (#41357)
The way we currently track server CSS imports is to collect CSS files that each **module** depends on. This happens on the module graph level which is a global thing and cannot be tree-shaken properly (check the enabled test for more details).

In this PR we collect another information, of CSS files that each **entrypoint** depends on. This is the CSS list after tree-shaken on the entry level. By intersecting these CSS imports with the module-level CSS imports, we can get the final used CSS imports for each _layout_.

cc @hanneslund 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 13:41:19 +00:00
Meno Abels
6652d783e4
proper error if middleware or api/route not return a Response (#41336)
## Bug

The error which is thrown if the fetch method returns not a falsy or
Response value
is misleading.

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-12 14:02:25 +02:00
Jimmy Lai
7b7fae5a8c
inline httpproxy usage (#41330)
Same as https://github.com/vercel/next.js/pull/41322 we inline the usage of this module because it's heavy and not always used on regular servers + not used at all on minimal mode

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 09:03:45 +00:00
Jiachi Liu
8db5991714
Update rsc error message (#41351)
Follow up for #41333, updating the error message with `"use client"` directives in suggestion
2022-10-12 08:35:50 +00:00
Tim Neutkens
bf630e8e57
Refactor error overlay for new router (#41343)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-12 09:40:44 +02:00
JJ Kasper
e0bb25806b
Ensure RSC paths are normalized in minimal mode (#41348)
This ensures we probably remove RSC from the path/URL when in minimal mode. 

## Bug

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

Fixes: [slack thread](https://vercel.slack.com/archives/C043ANYDB24/p1665517894397169?thread_ts=1664913868.516049&cid=C043ANYDB24)
2022-10-12 07:17:17 +00:00
Steven
5d7d7391e0
Update next/image codemod to handle require() (#41345)
Follow up to a comment here:

-
https://github.com/vercel/next.js/pull/41004#pullrequestreview-1137492624
2022-10-11 18:12:02 -07:00
JJ Kasper
5162b64c21
v12.3.2-canary.25 2022-10-11 14:28:59 -07:00
JJ Kasper
7777130324
Fix middleware URL normalize case (#41342)
Follow-up to https://github.com/vercel/next.js/pull/41341 this fixes a
related issue with the URL normalizing in middleware and updates the
regression tests.

x-ref: [slack
thread](https://vercel.slack.com/archives/C01224Q5M99/p1665161421775079?thread_ts=1664536480.045539&cid=C01224Q5M99)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-11 14:27:31 -07:00
Steven
c1de0c0ce6
Add codemods for next/image (#41004)
This adds two codemods for `next/image`.

The first codemod a safe solution to upgrade from 12 to 13 by swapping
to `next/legacy/image`.

The second codemod is an experimental solution that attempts to automate
the [migration
guide](https://nextjs.org/docs/api-reference/next/future/image#migration).
2022-10-11 13:44:36 -07:00
Hannes Bornö
66a3028a3b
Reduce remote requests in google fonts (#41306)
Reduce remote request by reusing response between server and client
compilation. Once reused it can be removed, will be cached by webpack
after that.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 13:38:29 -07:00
Hannes Bornö
310b99902f
Reduce local font loader options (#41332)
Reduces the amount of options for local fonts. Adds additional regression tests.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 19:52:10 +00:00
JJ Kasper
31886589a0
Fix middleware rewrite for _next/data (#41341)
x-ref: [slack
thread](https://vercel.slack.com/archives/C01224Q5M99/p1665161421775079?thread_ts=1664536480.045539&cid=C01224Q5M99)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-11 12:23:22 -07:00
Jiachi Liu
2b99db07f7
Client component directive: use client (#41333)
Replace `'client'` with `'use client'` as client directive for client
components in RSC

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-11 10:26:45 -07:00
Donny/강동윤
6c2a0f36a6
chore: Update swc_core to v0.32.8 (#41304)
This PR updates swc crates to 018ca946e7
2022-10-11 17:12:22 +00:00
Steven
9e1d04dd93
Add pretty error when image import is invalid format (#41267)
This PR improves the error message when an invalid image is imported. It
also ensures the page that imported the image is displayed.

### Before

<img width="1062" alt="image"
src="https://user-images.githubusercontent.com/229881/194674177-70f4ae73-64c9-497f-8e20-098f949a4219.png">


### After

<img width="1002" alt="image"
src="https://user-images.githubusercontent.com/229881/194716285-27dd3455-60a9-440f-a50e-eff8d49e764b.png">

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-11 18:22:13 +02:00
Jimmy Lai
ba08576e4a
perf: lazyload the edge runtime in NextServer (#41322)
## Context

I'm investigating cold boot perf

## This PR

Did some manual analysis on next cold boot for the "regular" node target
and found out that we are spending a good 10ms evaluating the edge
runtime module when we shouldn't be in most cases.

This is a quick fix to only load it when actually required.

## Test plan

I have a simple script which I'll push in a separate PR to measure the
cold boot.

Results:


before:
<img width="230" alt="image"
src="https://user-images.githubusercontent.com/11064311/195073994-c3d28961-5d22-401f-a4b0-026c791ff2bd.png">

after:
<img width="275" alt="image"
src="https://user-images.githubusercontent.com/11064311/195073941-a0897532-6e9f-482d-a1f0-8b9c9231c6b0.png">

it appears to be a 10~15ms win on cold boot 

## Following up

We probably want a separate NextMinimalServer type of build?

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 17:29:08 +02:00
Balázs Orbán
701e8d2c0f
fix(standalone): support type: "module" (#41268)
Fixes #41258

When we detect `type: "module"` in `package.json`:

~1. generate `server.mjs`~ Not necessary when `type: "module"` is set.
2. use `import` instead of `require`
3. replace `__dirname` with [ESM compatible
alternative](https://blog.logrocket.com/alternatives-dirname-node-js-es-modules/)

In this PR, I also moved some tests (those using `output: "standalone"`)
to a new `test/production/standalone-mode` directory for easier
discoverability in the future.

Run the related test with `pnpm test
test/production/standalone-mode/type-module/index.test.ts`

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 17:04:37 +02:00
Tim Neutkens
e3df5909cb
Handle error overlay for new router (#41325) 2022-10-11 16:11:57 +02:00
Balázs Orbán
2060d0e3e9
fix(image): don't show placeholder warning in Jest (#41329)
In Jest, we were mocking the `next/image` imports with a width and
height of `24`. If the developer set `placeholder="blur"` on their
images though, this triggered the warning:

> Image with src "/img.jpg" is smaller than 40x40. Consider removing the
"placeholder='blur'" property to improve performance.

Since we cannot reliably hide this warning without knowing the actual
image dimensions, and we also provide a `blurDataURL` by default, we
should increase the mock image size to suppress the warning.

Note that using `moduleNameMapper` in `jest.config.js`, the developer
can already tweak the mock behavior:


a78163dc61/packages/next/build/jest/jest.ts (L111-L121)

Fixes #41248
2022-10-11 16:06:54 +02:00
Jiachi Liu
a78163dc61
Global layouts error boundary (#41305) 2022-10-11 11:17:10 +02:00
JJ Kasper
3c8727dcab
v12.3.2-canary.24 2022-10-10 17:05:15 -07:00
JJ Kasper
acb46e1090
Fix NextUrl trailing slash normalize for data route (#41311)
x-ref: [slack
thread](https://vercel.slack.com/archives/C045FKE5P51/p1665074590321179)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-10 16:50:31 -07:00
JJ Kasper
35308c668e
Update middleware query hydration handling (#41243)
This updates to skip the data request done during query hydration when
middleware is present as it was mainly to gather query params from any
potential rewrites in middleware although this is usually not needed for
static pages and the context can be gathered in different ways on the
client.

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

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-10 12:58:18 -07:00
Hannes Bornö
05498a0988
Local font files adjust fallbacks (#41180)
When using `@next/font/local` we can't have pre calculated metrics for the font. This PR uses fontkit to read metadata about the imported local font in order to generate a fallback.

Also removes some props from the api that's better done automatically in the future.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-10 18:54:34 +00:00
Tim Neutkens
3d499a627f
Add test for link back to original page (#41297)
- Implements failing test
- Implemented handling for the case where the router tree does not match up with the segment path being navigated to. This is what caused the underlying error. 



## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-10 12:42:46 +00:00
Shu Ding
e933e1d211
Load beforeInteractive scripts properly without blocking hydration (#41164)
This PR ensures that for the app directory, `beforeInteractive`, `afterInteractive` and `lazyOnload` scripts via `next/script` are properly supported.

For both `beforeInteractive` and `afterInteractive` scripts, a preload link tag needs to be injected by Float. For `beforeInteractive` scripts and Next.js' polyfills, they need to be manually executed in order before starting the Next.js' runtime, without blocking the downloading of HTML and other scripts.

This PR doesn't include the `worker` type of scripts yet.

Note: in this PR I changed the inlined flight data `__next_s` to `__next_f`, and use `__next_s` for scripts data, because I can't find a better name for `next/script` that is also short at the same time.

## 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`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-09 15:08:51 +00:00
Tim Neutkens
f7a7c3fafa
Handle as on next/link with new router (#41285)
Kudos @dferber90 who found this issue. Added a test and handled it gracefully for now. Keep in mind the behavior can't be 1-1 so it takes the `as` as the `href` value given that masking of parameters in this way is no longer supported, that will be superseded by parallel routes / route interception.



## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-08 17:42:55 +00:00
Tim Neutkens
52a69e6117 v12.3.2-canary.23 2022-10-08 19:11:53 +02:00
Hannes Bornö
be7b10dee5
Recover from font loader error in dev (#41251)
Check that the module has assets. This might not always be the case in
app dev if there was an error. Test added to make sure it recovers
correctly.

## 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 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-10-08 01:53:24 +02:00
Balázs Orbán
6eefc9de56
fix(ts): relax AppProps to not require generic (#41264)
It seems that #38867 made `AppProps` always require the `pageProps`
object shape to be passed as a generic since the default `{}` will throw
a TS error if you try accessing any property:

Before:

![image](https://user-images.githubusercontent.com/18369201/194639573-aa8a97f8-2c6a-413c-96f2-5e99e4a17c66.png)

After:

![image](https://user-images.githubusercontent.com/18369201/194639630-03d1a669-722f-4822-b0db-3b8dd88b2959.png)


Technically, it would be more correct since accessing `pageProps`
properties would otherwise be unsafe, but this seems to break the
current behavior.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-07 14:59:32 -07:00
Damien Simonin Feugas
bef709bc74
fix(middleware): 'instanceof Function' is dynamic code false-positive (#41249)
## 🐛 What's in there?

`foo instanceof Function` is wrongly considered as Dynamic code evaluation by our static analyzer.
This PR fixes it.

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

## 🧪 How to reproduce?

1. Create a simple repro in `examples` folder:
   ```js
   // examples/instance-of-function/pages/index.js
   export default function Home() {
     return <h1>home</h1>
   }
   
   // examples/instance-of-function/middleware.js
   import { NextResponse } from 'next/server'
   
   export default async function handler() {
     console.log('is arrow a function?', (() => {}) instanceof Function)
     return NextResponse.next()
   }
   ```
1. build with next `pnpm next build examples/instance-of-function`
   > the build fails
1. rebuild next to include PR's fix `pnpm build`
1. build with new next `pnpm next build examples/instance-of-function`
   > the build works

## 📔 Notes to reviewers

`hooks.expression.for(`${prefix}Function`).tap(NAME, handleExpression)` is actually legacy code from the original implementation. It's used when finding `Function` regardless of how it is used. We only want to find `new Function()` or `Function()`, which `hooks.calls` and `hooks.new` are covering.

`eval instanceof Function` is perfectly legit code on the edge, despite its uselessness :lol-think: 

Because we got multiple people asking "how do I relax this error when my code contains unreachable dynamic code evaluation", I've copy-pasted details about `config.unstable_allowDynamic` into the error page. Because users do not always click links :blob_shrug:
2022-10-07 14:14:11 +00:00
Jiachi Liu
a415f34adf
refactor dev overlay into hot reloader (#41231)
Move react-dev-overlay into hot reloader client components, and let it imported by app router. So then we don't need to have hot reloader and react tree as adjacent sibilings but the overlay with error boundary is wrapping the react tree


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-10-07 13:25:22 +00:00
Hannes Bornö
b5590022b6
Font loaders next config shape (#41219)
Changes how font loaders are configured in next config, makes more sense since options can be optional. Also adds error for when font loaders are used from within node_modules.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-07 09:15:57 +00:00
Jiachi Liu
f83cc0cbed
Enabel appDir when flag and dir existed at the same time (#41233)
If there's an existing folder named `app/` but `appDir` flag is not
enabled, do not enabled server components
2022-10-07 00:16:42 +02:00
Tim Neutkens
5e25bd2141 v12.3.2-canary.22 2022-10-06 21:44:28 +02:00
JJ Kasper
4e0731fbbe
Fix app static generation cases (#41172)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-06 21:43:23 +02:00
Hannes Bornö
dd3e005c93
App font file preload (#41158)
Finds the font files connected to font loader modules and adds them to
the font loader manifest. They're then collected and rendered similarly
to CSS links in app-render.
2022-10-06 12:24:42 -07:00
Meno Abels
27fe5c8c28
Add response stream errorhandling in edge-function-runtime (#41102)
The behaviour of edge-function-runtime in the case of an error was not
identical to the edge-runtime.
If a type other than "Uint8Array" is written to the Response stream a
unhandledreject is raised and logged.
The current implementations(nodejs) accepts also Buffers and Strings
which causes that a Application
Developer things our stream implementation is broken if it is executed
as worker.
We introduced a helper function to consume the response stream and write
the "Uint8Array" stream chunks
to the server implementation. Due to the complication that the error
side effect is emitted via the unhandledrejection
handler it is almost impossible to test --- jest does not allow testing
of the unhandlerejections.
We tested extendsiveliy the helper in the edge-runtime so that this PR
integrates just the consuming function.

## 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 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-10-06 11:56:13 -07:00
Shu Ding
24b600303f
Do not bundle react-dom in the SSR build (#41227)
Currently `react-dom` isn't handled as an external dependency in SSR,
unlike `react`. This means that the ReactDOM imported by client
components isn't the same instance as the ReactDOM that does SSR.

This PR also upgrades React experimental to the latest version.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-06 20:27:24 +02:00
Jiachi Liu
6352257dd3
Alias next/dynamic to lazy impl for appDir (#41216)
Since `next/dynamic` has client hooks that not compatible with server
components, and app renderer doesn't provide context (such as
`LoadableContext`) for it to use. Previously we provided a simple
replacement using `React.lazy` for `next/dynamic` if you want to use it
in appDir.

This PR always alias it to the `React.lazy ` implementation for appDir
so that user won't need to worry about the dynamic options. They can
only use `dynamic()` without 2nd options arg

```js
import dynamic from 'next/dynamic'

const Dynamic = dynamic(() => import('./dynamic-component'))
```
2022-10-06 17:41:27 +02:00
Meno Abels
374ab4bf66
Update edge runtime to 1.1.0-beta.37 (#41211)
update of the edge-runtime to 1.1.0-beta.37.



Co-authored-by: Kiko Beats <2096101+Kikobeats@users.noreply.github.com>
2022-10-06 11:45:16 +00:00
Donny/강동윤
1418e4db22
chore: Update swc_core to v0.29.5 (#41181)
This updates swc crates to
d8fc0298e2
2022-10-06 13:07:32 +02:00
Justin Ridgewell
22ef969b7b
Remove hook_optimizer transform (#41203)
Fixes an issue where `const […foo] = useState(0)` is improperly transformed into `const { 0: …foo } = useState(0)`.

The hook optimizer was useful when hooks first came out, primarily because browsers had never optimized array destructuring. But current browsers have, and the optimization doesn't help anymore.



## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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

- [x] 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/examples/adding-examples.md)
2022-10-06 08:12:34 +00:00
JJ Kasper
e8c760f7d4
v12.3.2-canary.21 2022-10-05 22:20:38 -07:00
Hannes Bornö
e5be49eec1
Font loader with babel error (#41151)
Adds build error when using font loaders with babel. Otherwise you'll
get other unrelated errors.

## 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 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-10-05 22:14:31 -07:00
Josh Story
cee656238a
Fix latest experimental react and experimental-edge and unpin test versions (#41200)
This ensures we don't stub `react-dom` with the `experimental-edge` runtime and also unpins our tests to use the latest experimental release. 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-05 21:27:47 +00:00
Balázs Orbán
cbda3b52dc
docs(image): improve error message when sharp is missing in standalone mode (#41133)
Partially addresses #41111

## 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 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-10-05 17:28:29 +00:00
Jiachi Liu
99d88f2a58
Disable built-in css-in-js transform on server layer (#41040)
We're supposed not to use css-in-js in server components since it will
increase the rsc response for navigation. Also adding `styledJsx` option
for next-swc for controlling styled-jsx transform.

Test case: using styled-jsx transform in server components will not be
transformed to `styled-jsx/style` imports.
2022-10-05 18:28:55 +02:00
Tim Neutkens
45bed96714 v12.3.2-canary.20 2022-10-05 16:35:59 +02:00
Tim Neutkens
81b818515a
Fix prefetch for new router (#41119)
- Add a failing test for navigating between many levels of dynamic routes
- Create router tree during prefetch action so that it can be reused across multiple urls
- Ensure segmentPath is correct when rendering a subtree. Previously it would generate a segmentPath that starts at the level it renders at which causes the layout-router fetchServerResponse to inject `refetch` at the wrong level.
- Fixed a case where Segment was compared using `===` which is no longer valid as dynamic parameters are expressed as arrays. Used `matchSegment` helper instead.



## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-05 13:45:46 +00:00
Jiachi Liu
5f2e44d451
Refactor app dir related flags (#41166)
simplify the `appDir` passing down
2022-10-04 22:16:44 +00:00
Adarsh Konchady
d2efbc8819
Fix warning messages for next export (#41165)
## Bug
Noticed the warning messages don't have spaces. Just adding spaces for better messaging. 
<img width="1714" alt="image" src="https://user-images.githubusercontent.com/1635852/193907658-f3c7d90b-1b91-44bf-b93b-915ab4a635f1.png">

- [ ] 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-04 20:34:35 +00:00
JJ Kasper
328c3a765a
Fix reading edge info for app paths (#41163)
This fixes the build failing due to attempting to read `edgeInfo` that
wasn't present from using the wrong key to look up the manifest entry.
Regression test added by enabling `experimental-edge` on a page that was
failing to be looked up.

Fixes: 
```sh
TypeError: Cannot read properties of undefined (reading 'files')
    at /Users/jj/dev/vercel/layouts-playground/node_modules/next/dist/build/utils.js:786:33
    at Span.traceAsyncFn (/Users/jj/dev/vercel/layouts-playground/node_modules/next/dist/trace/trace.js:79:26)
    at Object.isPageStatic (/Users/jj/dev/vercel/layouts-playground/node_modules/next/dist/build/utils.js:771:29)
```

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-04 11:46:11 -07:00
JJ Kasper
0d5886f20b
v12.3.2-canary.19 2022-10-04 10:15:01 -07:00
JJ Kasper
8d4840b15a
Apply experimental configs for middleware (#41142)
This applies the experimental configs for testing and also fixes
`set-cookie` headers from middleware/edge functions being merged
unexpectedly.

x-ref: [slack
thread](https://vercel.slack.com/archives/CGU8HUTUH/p1664313529422279)
Fixes: https://github.com/vercel/next.js/issues/40820

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-04 10:08:17 -07:00
Shu Ding
d192047a34
Remove unnecessary moduleId option (#41160)
`deterministic` should be already the default option here.
2022-10-04 10:03:42 -07:00
Donny/강동윤
0768f7d1d0
chore: Update swc_core to v0.28.20 (#41153)
This PR updates swc crates to
6749e6948e
2022-10-04 16:16:11 +02:00
Jiachi Liu
34b78dc7c5
Handle hmr for edge ssr in app dir (#41156)
Include the edge server changes that starting in app dir into server components changes. Most changes are merging condition `isAppPath && this.appDir` into `isAppPath`.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-04 14:03:20 +00:00
JJ Kasper
51552c1a02
Update minimum required Node.js version to v14 (#41150)
As discussed this updates our required minimum Node.js version to `v14` as `v12` is no longer being maintained. Since our targets for babel and swc already target the actively used Node.js version no change has been made there.
2022-10-04 08:59:35 +00:00