Commit graph

12880 commits

Author SHA1 Message Date
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
Saullo Almeida
5223d66abd
Bump version tailwindcss example to 3.2 (#41681)
## 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: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2022-10-24 19:12:27 +00:00
Charly POLY
792c661264
examples(with-typescript-graphql): migrate to Yoga v3 and codegen new preset: client (#41597)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-24 12:03:08 -07:00
Hugo
fedcae42d0
Update custom-error-page for getServerSideProps (#41723)
`fetch` output type has `status` but no `statusCode`, see MDN https://developer.mozilla.org/en-US/docs/Web/API/Response/status


## 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)
2022-10-24 19:00:14 +00: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
LongYinan
13f6eff4cc
Pin build image version (#41704)
https://github.com/vercel/next.js/actions/runs/3310071458
2022-10-23 22:22:28 -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
Ikko Ashimine
2e2cc5597a
chore(examples): fix typo in [videoId].tsx (#41655)
bellow -> below



## 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`
- [x] 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 19:10:37 +00: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