Commit graph

8890 commits

Author SHA1 Message Date
Tobias Koppers
a628e6344e
avoid key conflict (#58249)
### What?

gives all elements in the array unique keys

should fix #57709 and fix #57743
2023-11-09 16:44:06 +00:00
Jimmy Lai
4024b25e8c
parallel routes: fix catch all route support (#58215)
This PR fixes a bug where parallel routes would not apply appropriately on navigation when used within slots.

The following scenarios:
```
/foo
   /bar
   /@slot
     /[...catchAll]
```

or 

```
/foo
  /[...catchAll]
  /@slot
     /bar
```

will now function correctly when accessing /foo/bar, and Next.js will render both /bar and the catchall slots.

The issue was that the tree constructed by `next-app-loader` for a given path, /foo/bar in the example, would not include the paths for the catch-all files at build time. The routing was done 1-1 when compiling files, where a path would only match one file, with parallel routes, a path could hit a defined path but also a catch all route at the same time in a different slot.

The fix consists of adding another normalisation layer that will look for all catch-all in `appPaths` and iterate over the other paths and add the relevant information when needed.

The tricky part was making sure that we only included the relevant paths to the loader: we don't want to overwrite a slot with a catch all if there's already a more specific subpath in that slot, i.e. if there's /foo/@slot/bar/page.js, no need to inject /foo/@slot/bar/[...catchAll]. 

One thing that is not supported right now is optional catch all routes, will add later.

fixes #48719
fixes #49662
2023-11-09 10:11:06 +00:00
vercel-release-bot
b740fe8fa4 v14.0.2-canary.26 2023-11-09 09:56:42 +00:00
Tobias Koppers
bf966e370e
update turbopack (#58243)
* https://github.com/vercel/turbo/pull/6399 
* https://github.com/vercel/turbo/pull/6393 
* https://github.com/vercel/turbo/pull/6403 
* https://github.com/vercel/turbo/pull/6404 
* https://github.com/vercel/turbo/pull/6394 
* https://github.com/vercel/turbo/pull/6405 
* https://github.com/vercel/turbo/pull/6351
2023-11-09 09:52:22 +00:00
Rich Haines
bbb730e5ef
[Docs]: Fix CLI link to server actions size limit docs (#58174)
This PR fixes the terminal link to server actions size limitations for body size limit. The link is wrong and sending people to a 404
2023-11-09 02:51:14 +00:00
vercel-release-bot
fd7ea115b5 v14.0.2-canary.25 2023-11-09 02:36:39 +00:00
Josh Story
eb79555827
Updated React from 7508dcd5c to 746890329 (#58233)
Updated React from 7508dcd5c to 746890329.

- https://github.com/facebook/react/pull/27674
2023-11-08 18:30:45 -08:00
Zack Tanner
db275073d4
pass postpone through staticGenerationStore (#58229)
Instead of requiring React in `maybePostpone` (which is susceptible to referencing the wrong version of React during build time, such as in the case where the static worker patches fetch within an app-route, which doesn't have an experimental runtime), this provides the postpone API to the `staticGenerationStore`. That way we know the API is available in render which is when we'd expect to postpone.
2023-11-09 00:59:05 +00:00
vercel-release-bot
b50090bf96 v14.0.2-canary.24 2023-11-08 23:21:44 +00:00
Sebastian Markbåge
2f68e62d30
Reword PPR caught bail out to avoid "postpone" terminology (#58223)
The "postpone" terminology is internal to React and can be used for more
things than just this. It's also a mechanism we may or may not rely on.

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-11-08 17:08:24 -05:00
Sebastian Markbåge
d68bbd7af7
Add helpful context to postpone reason if it's caught and logged or escapes (#58222)
Other ways such as on the client.
2023-11-08 16:16:40 -05:00
Zack Tanner
d422aeb5dc
tweak postpone error copy & fix link (#58219)
Fixes a broken link, shortens the title, and adds another possible way
to resolve the error.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-08 16:13:21 -05:00
vercel-release-bot
67656c3fec v14.0.2-canary.23 2023-11-08 20:21:15 +00:00
Josh Story
1b5e307f6b
Update React from 2983249dd to 7508dcd5c (#58216)
Updated React from 2983249dd to 7508dcd5c.

- https://github.com/facebook/react/pull/27672
- https://github.com/facebook/react/pull/27132
- https://github.com/facebook/react/pull/27646
- https://github.com/facebook/react/pull/26446
2023-11-08 19:36:54 +00:00
Jimmy Lai
536d2dbc44
interception routes: fix interception for dynamic routes (#58198)
This PR fixes the bug in which interception routes of the form `(.)[param]` would not intercept navigations.

The bug happened because we would not create a dynamic route matcher for the intercepted route, so we would never match the correct dynamic route when hitting the server, falling back to the base one. 

The fix consists of fixing the logic that checks for a dynamic route so that it checks the correct path when handling an interception route.

There's probably a better fix here, advice welcome

fixes #52533
2023-11-08 18:57:57 +00:00
Zack Tanner
76def31fb2
skip ppr throw for tests (#58208)
Follow up to #58203 to skip this in tests to avoid issues once we cut stable
2023-11-08 17:10:32 +00:00
vercel-release-bot
5dc2572dc7 v14.0.2-canary.22 2023-11-08 16:23:23 +00:00
Zack Tanner
fe0d947a66
ensure experimental warning shows up when using PPR (#58206)
Fixes a bug where when `config.experimental.ppr` was set, we didn't show
the proper warning indicator that the feature is experimental.
2023-11-08 17:20:02 +01:00
Sebastian Markbåge
c26c10f4c3
Reduce max header length emitted (#58204)
Seems like the default 2000 limit is getting hit. Start more
conservative while investigating why. Picked half to start.
2023-11-08 11:17:32 -05:00
Zack Tanner
2071880c8c
fail build if not using Next canary with PPR flag (#58203)
This is to ensure that folks experimenting with PPR are receiving the latest updates as the feature is actively being worked on.
2023-11-08 16:14:10 +00:00
vercel-release-bot
f206573f93 v14.0.2-canary.21 2023-11-08 10:25:06 +00:00
Shu Ding
24a617c24f
Change allowed forwarded hosts to be allowed origins for Server Actions (#58023)
The allowlist should be origin domains that are allowed to send the
requests, not the list of forwarded hosts (i.e. reverse proxies).
2023-11-08 11:20:32 +01:00
Tobias Koppers
9d3b94b449
update turbopack (#58172)
* https://github.com/vercel/turbo/pull/6376 <!-- OJ Kwon -
feat(turbopack): support url rewrite behavior options -->
* https://github.com/vercel/turbo/pull/6386 <!-- OJ Kwon -
feat(turbopack-ecmascript): support relative url asset ref -->
* https://github.com/vercel/turbo/pull/6382 <!-- Tobias Koppers -
refactor and fix CssEmbed for url() -->
2023-11-08 08:54:36 +01:00
Sebastian Markbåge
1063021160
Forward headers from React to static output and dynamic render (#58162)
React can emit a `Link:` header for preloads instead of `<link
rel="preload">` in certain scenarios when that can be useful. This works
by listening to the `onHeaders` event.

In particular it's interesting for PPR because if you have something
dynamic outside a Suspense boundary it generates an empty payload
without any preloads in it. That's because when we do render the real
shell we don't know what the document will look like. However, we can
emit the `Link` header for CSS, images and font preloads that we've
already discovered. In effect, even a dynamic page gets PPR benefits by
early fetching resources.

Custom headers is supported for static a ROUTE but not a PAGE. So I had
to add similar wiring to forward headers when it's a page being
rendered.

It's important that this works every where, including dynamic routes,
because otherwise we might miss out on preloads that we previously
would've had.
2023-11-08 01:02:45 -05:00
vercel-release-bot
3977f90fd0 v14.0.2-canary.20 2023-11-08 02:39:50 +00:00
JJ Kasper
ccd6c4b2df
Fix resume stream handling (#58159)
Ensures we don't await un-necessarily.
2023-11-07 18:36:11 -08:00
Wyatt Johnson
baf0b2419c
fix: rsc normalization fixes (#58145)
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2023-11-08 01:50:39 +00:00
Josh Story
fe99b53d7f
Update React from 08a39539f to 2983249dd. (#58154)
Updates React from 08a39539f to 2983249dd.

### React upstream changes

- https://github.com/facebook/react/pull/27641
- https://github.com/facebook/react/pull/27661
- https://github.com/facebook/react/pull/27640
- https://github.com/facebook/react/pull/27595
- https://github.com/facebook/react/pull/27600
- https://github.com/facebook/react/pull/27598
- https://github.com/facebook/react/pull/27590
- https://github.com/facebook/react/pull/27606
- https://github.com/facebook/react/pull/27608
- https://github.com/facebook/react/pull/27601
- https://github.com/facebook/react/pull/27616
- https://github.com/facebook/react/pull/27615
- https://github.com/facebook/react/pull/27614
- https://github.com/facebook/react/pull/27599
- https://github.com/facebook/react/pull/27597
- https://github.com/facebook/react/pull/27525
- https://github.com/facebook/react/pull/27571


Updates @types/react to 18.2.37
Updates @types/react-dom to 18.2.15
2023-11-07 23:55:06 +00:00
vercel-release-bot
0697be3b57 v14.0.2-canary.19 2023-11-07 23:24:29 +00:00
Zack Tanner
9aefe525bf
fix PPR build output logs (#58149)
Fixes two build output logs:

- A page that uses `generateStaticParams` & postpones should be marked as partially prerendered
- Assume pages that contain dynamic segments will postpone when PPR is enabled even though it won't be determined until request time
2023-11-07 22:09:55 +00:00
Donny/강동윤
c370c179b5
build: Update swc_core to v0.86.40 and update turbopack (#57904)
### What?

* https://github.com/vercel/turbo/pull/6286 
* https://github.com/vercel/turbo/pull/6367 
* https://github.com/vercel/turbo/pull/6354 
* https://github.com/vercel/turbo/pull/6343 

---

 - Update `swc_core` to `v0.86.40`

 - Revert #56281 and fix `node-fetch` by disabling inlining
   - Use `inline: 2` instead of `keep_fnames: true`

### Why?

`keep_fnames` increases the bundle size too much.

### How?

 - Fixes #56612

 - Fixes #57886 

 - Fixes #55682 (by https://github.com/swc-project/swc/pull/8205)

 - Reverts #56281


 - Closes PACK-1902
2023-11-07 15:26:28 +00:00
vercel-release-bot
ded28edeae v14.0.2-canary.18 2023-11-07 04:46:46 +00:00
JJ Kasper
5bba6224f9
Fix incorrect normalizing in minimal mode (#58116)
This reverts an extra change in 3fa9f31ce1 causing normalizing to be incorrect and route params to not parse properly with i18n. 

This unblocks https://github.com/vercel/vercel/pull/10799
2023-11-07 04:43:51 +00:00
vercel-release-bot
d95900c7b0 v14.0.2-canary.17 2023-11-07 00:44:19 +00:00
Zack Tanner
6e1eda72e1
ppr: fix fetch postpone not having correct React version (#58107)
When `patchFetch` is applied at during `buildAppStaticPaths` ([ref](030021234b/packages/next/src/build/utils.ts (L1253-L1256))), it's done so without any context of the bundled React runtime.

Since `patchFetch` will potentially postpone during static generation with PPR, it needs to be using the correct React version, otherwise `unstable_postpone` won't be available e.g. in the case of a page utilizing `generateStaticParams`.

This moves `patchFetch` into the bundled runtime so that it has the correct version of React when invoked.
2023-11-06 23:51:39 +00:00
vercel-release-bot
3eaa96fff6 v14.0.2-canary.16 2023-11-06 23:21:39 +00:00
vercel-release-bot
c29c039cf3 v14.0.2-canary.15 2023-11-06 20:56:03 +00:00
Wyatt Johnson
ffeaa8f366
fix: normalization and invariant fixes for ppr (#58105) 2023-11-06 20:51:06 +00:00
vercel-release-bot
38e8b523dc v14.0.2-canary.14 2023-11-06 17:08:35 +00:00
Tobias Koppers
883ab22157
update turbopack (#58080)
* https://github.com/vercel/turbo/pull/6325 <!-- OJ Kwon - build(cargo):
skip external build script with rust-analyzer -->
* https://github.com/vercel/turbo/pull/6318 <!-- OJ Kwon -
feat(turbopack-ecmascript): calculate import.meta.url as an absolute
path -->
* https://github.com/vercel/turbo/pull/6359 <!-- Will Binns-Smith -
Turbopack: Defer calculating source positions until needed -->
* https://github.com/vercel/turbo/pull/6274 <!-- Tobias Koppers - add
backtrace for trait calls -->
* https://github.com/vercel/turbo/pull/6305 <!-- Tobias Koppers - Triple
chunk size heuristic -->
* https://github.com/vercel/turbo/pull/6304 <!-- Tobias Koppers -
improve resolving performance -->
2023-11-06 18:05:13 +01:00
Dominic Elm
103ca04688
feat: always use SWC Wasm fallback when running in WebContainer (#58081)
<!-- 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(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

Since the Wasm fallback was re-introduced in
https://github.com/vercel/next.js/pull/57906 I am now also adding a
check for detecting WebContainers so that it would always use the SWC
Wasm fallback. That's because WebContainers can't execute native
binaries.

I decided to not account for `NEXT_DISABLE_SWC_WASM` because it doesn't
make much sense and if someone had this enabled, it would always fail.
But if ya all think it's better to take this flag into account then I am
happy to change it.
2023-11-06 11:38:26 -05:00
Tobias Koppers
8220976d29
fixes a problem with cache invalidation (#58079)
### What?

fixes a problem with cache invalidation when the next.js folder moves in node_modules, but the version stays equal

### Why?

This can happen when pnpm creates a new next.js copy with different peerDependencies.
2023-11-06 13:56:04 +00:00
Tobias Koppers
99e584c70e
use __NEXT_VERSION compile time replacement (#57512)
process.env.__NEXT_VERSION is replaced at with a static version

Closes WEB-1888
2023-11-06 08:55:33 +00:00
vercel-release-bot
31c2f976cd v14.0.2-canary.13 2023-11-05 23:23:20 +00:00
Tim Neutkens
734eeac613
Use distDir from webpack-config in createWebpackAliases (#57268)
distDir is available in the place where we'll call this function for
Turbopack so it can be passed in.

<!-- 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(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-11-05 16:36:13 +01:00
vercel-release-bot
8536ad98dd v14.0.2-canary.12 2023-11-04 23:21:06 +00:00
Wyatt Johnson
6c6ac700b2
fix: ensure that postponed requests can be resumed in minimal mode (#58011) 2023-11-04 00:21:18 +00:00
vercel-release-bot
d0ac7c2f45 v14.0.2-canary.11 2023-11-03 23:22:55 +00:00
Wyatt Johnson
3fa9f31ce1
fix: updates for resuming postponed in minimal mode (#57375)
Co-authored-by: Jimmy Lai <11064311+feedthejim@users.noreply.github.com>
2023-11-03 21:17:45 +00:00
vercel-release-bot
ffdfd33251 v14.0.2-canary.10 2023-11-03 12:13:32 +00:00