Commit graph

10458 commits

Author SHA1 Message Date
vercel-release-bot
a794e1f32e v14.0.3-canary.4 2023-11-12 08:17:33 +00:00
Andrew Clark
b425b40aac
Replace custom Thenable type with native Promises (#58337)
Next.js's implementation includes a custom Thenable type based on a
similar one used in React's codebase. It was used to implement a
userspace equivalent of the React.use API before that API became stable,
by throwing a promise-like object and tracking the status on an expando
field. However, it didn't cover all the same cases and behaviors that
React.use does, which led to some subtle bugs like the one fixed by
@ztanner in https://github.com/vercel/next.js/pull/55690.

Now that React.use is stable, and we use that for suspending instead of
throwing a promise, we no longer need our custom Thenable type. I've
removed the type and associated functions, and updated our types to use
Promise instead.

Even in cases where a function does return a thenable-object rather than
a native promise, like React Flight's createFromFetch, we should use
TypeScript's built-in PromiseLike utility. Currently, though, we always
await these objects anyway (in fetch-server-response.ts), which turns
them into promises. So Promise is almost always sufficient.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-12 08:45:43 +01:00
vercel-release-bot
00f5b5e789 v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
Vercel Release Bot
bd2d8a3b23
Update font data (#58317)
This auto-generated PR updates font data with latest available
2023-11-11 00:21:04 +00:00
vercel-release-bot
c74f023b88 v14.0.3-canary.2 2023-11-10 23:21:25 +00:00
Leah
b2c926f7c2
fix(turbopack): support middleware in src (#58218)
### What?

We previously marked `/src/middleware` as a missing page

Fixes #42921

Closes PACK-1926

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-10 14:48:20 +01:00
vercel-release-bot
7966eaf0f2 v14.0.3-canary.1 2023-11-10 04:31:01 +00:00
Josh Story
37a1342712
Update React from 746890329 to 0e352ea01 (#58279)
Updates React from 746890329 to 0e352ea01.

- https://github.com/facebook/react/pull/27684
- https://github.com/facebook/react/pull/27665
- https://github.com/facebook/react/pull/27671
- https://github.com/facebook/react/pull/27680
2023-11-10 04:25:07 +00:00
vercel-release-bot
52123ccdbc v14.0.3-canary.0 2023-11-09 23:22:17 +00:00
vercel-release-bot
8eba72f30b v14.0.2 2023-11-09 18:32:59 +00:00
vercel-release-bot
fdd6eb990a v14.0.2-canary.27 2023-11-09 17:45:04 +00:00
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
OJ Kwon
51fec997f7
refactor(next-core): apply correct url rewrite behavior (#58237)
### What

Apply correct url rewrite behavior in the specific context (pages/api). 

This won't change anything yet, but it will prevent breaking changes when turbopack makes future changes.
2023-11-09 06:30:37 +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
OJ Kwon
f7b979c9cf
refactor(next-api): remove unused distDir (#57789)
### What

recent define_env refactoring removed usage of separate distDir from project config.
2023-11-08 08:12:34 +00: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
OJ Kwon
0563fa7749
refactor(next-core): separate options context for pages/api (#58148)
### What

I want to mimic webpack config's behavior (9b4b0847ed/packages/next/src/build/webpack-config.ts (L1381-L1385)) to the pages/api in turbopack. PR attempt to create a new context corresponding to pages/api, and use it to create api chunks.

Currently it just creates a new context, there is no new behavior's being introduced yet. I'm hoping to connect dots with https://github.com/vercel/turbo/pull/6376 later.
2023-11-08 07:39:09 +00: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
OJ Kwon
503e1a8c5f
build(package): clean up next-swc* pkg properties (#57908)
### What

Minor updates to the pkg manifest to remove duplicated property definition.
2023-11-07 17:27:21 +00:00
OJ Kwon
e65d4a1be3
fix(next-core): correct assets url reference condition (#58101)
### What

Corrects how urlassetreference reads its assets path to allow to resolve image assets correctly.

There is a test failure in the integration/url still, that involves probably larger refactoring so making this PR first to enable baseline, ensure further refactoring does not breaks anything.
2023-11-07 16:12:41 +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
Tim Neutkens
b091869f29
Revert "Revert "Add retry for fetching subsetted Google Fonts"" (#58075)
Reverts vercel/next.js#57154

Brings back the changes but uses the compiled version of async-retry instead. Previously these changes causes an error as async-retry wasn't installed.
2023-11-07 11:54:11 +00:00
Tobias Koppers
a84710bc9e
put app client modules into a separate layer (#58130)
### What?

app client context has different resolve options, so it need to be in a
separate layer from pages client modules.
2023-11-07 12:33:58 +01:00
vercel-release-bot
ded28edeae v14.0.2-canary.18 2023-11-07 04:46:46 +00:00