Commit graph

12171 commits

Author SHA1 Message Date
Sebastian Silbermann
fd0bc9466e
Update React from f994737d14 to 1df34bdf62 (19.0.0-rc.0) (#66533)
Co-authored-by: Hendrik Liebau <mail@hendrik-liebau.de>
2024-06-10 12:06:38 +00:00
vercel-release-bot
891a30cb5d v15.0.0-canary.22 2024-06-10 09:29:43 +00:00
Jiachi Liu
38ac71b993
Fix esm property def in flight loader (#66286)
### What

Remove creating client proxy for each ESM export, instead for ESM we
create a CJS module proxy for itself and access the property with export
name as the actual export.

### Why

`proxy` is the module proxy that we treat the module as a client
boundary.
For ESM, we access the property of the module proxy directly for each
export.
This is bit hacky that treating using a CJS like module proxy for ESM's
exports,
but this will avoid creating nested proxies for each export. It will be
improved in the future.

Notice that for `next/dynamic`, if you're doing a dynamic import of
client component in server component, and trying to access the named
export directly, it will error. Instead you need to align the dynamic
import resolved value wrapping with a `default:` property (e.g. `{
default: resolved }`) like what `React.lazy` accepted.

Revert #57301
Fixes #66212

x-ref:
[slack](https://vercel.slack.com/archives/C04DUD7EB1B/p1716897764858829)
2024-06-10 11:21:03 +02:00
Ivan Torres
1afdbb8722
Update devdependecies tar and type (#66580)
Update devdependecies tar and type.

I have only imported the necessary function, maybe it is a little
unverbose, we can use instead of ‘x’ => ‘extract’.

---------

Co-authored-by: torresgol10.itd <torresgol10.itd@gmail.com>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-09 22:21:28 -07:00
vercel-release-bot
4539e33d96 v15.0.0-canary.21 2024-06-09 17:41:40 +00:00
Zack Tanner
25d3581bc2
ensure router cache updates reference the latest cache values (#66681)
During navigations, the `FlightDataPath` property from the server
response can be an array if there are multiple parallel routes (eg,
`children` and `slot`). When we apply server response to the router
cache, we might call `applyFlightData` for each segment path, which will
copy existing cache values and insert new ones depending on what
changed.

However, the `existingCache` argument that we pass to this function is
the cache at the start of the navigation. That means subsequent calls to
`applyFlightData` will reference the cache _before_ updates are made to
it. This will cause it to erroneously think it needs to lazy fetch for
missing data.

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

-->
2024-06-09 10:38:30 -07:00
vercel-release-bot
3c99b8ca57 v15.0.0-canary.20 2024-06-08 23:23:47 +00:00
JJ Kasper
19f9692bc7
Update URL provided from unstable_cache (#66651)
As discussed this updates the URL value provided from `unstable_cache`
to include the current pathname and sorted search params so that it's
easier to identify where the call is being done for using debug metrics.

x-ref: [slack
thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1717012449080709?thread_ts=1716942410.700499&cid=C042LHPJ1NX)
2024-06-08 12:03:38 -07:00
Zack Tanner
a1f70ae2f3
prevent duplicate RSC fetch when action redirects (#66620)
When checking which segment(s) need to be refreshed, we currently
compare the current page URL with the segment's refresh marker.

We should inspect the `mutable.canonicalUrl` value first since that's
the URL we're changing to, followed by `state.canonicalUrl` as a
fallback (indicating that there's no URL change pending). This is
because the server action handler will receive a redirect URL prior to
`location.pathname` being updated, so the router will incorrectly think
it needs to refresh the data for the page we're going to.

Closes NEXT-3500
2024-06-08 10:56:38 -07:00
Zack Tanner
a9d842a24e
remove staticWorkerRequestDeduping flag & unused IPC code (#66655)
This flag remained experimental because the IPC implementation didn't
play nicely with requests containing large payloads, due to it being
stringified as GET parameters. This branching logic also poses
challenges for some upcoming work related to detecting IO.

This removes the handling for the
`experimental.staticWorkerRequestDeduping` flag which we can revisit in
the future with a sounder approach. This also cleans up some of the IPC
server utilities as it wasn't in use anywhere else.

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

-->
2024-06-07 16:42:44 -07:00
vercel-release-bot
676a3bad83 v15.0.0-canary.19 2024-06-07 16:26:41 +00:00
Tobias Koppers
98257314da
Revert "feat: Update swc_core to v0.92.10" (#66640)
Reverts vercel/next.js#66521
2024-06-07 18:23:30 +02:00
Zack Tanner
b2a651ffa9
revert app-render changes related to determining RSC/Prefetch requests (#66648)
This change introduced some unexpected behavior when prefetching pages
that were statically generated on-demand. We currently conditionally
strip flight headers in base-server to opt into special rendering
behavior
([ref](71153eaa3b/packages/next/src/server/base-server.ts (L2153)))
but this doesn't apply to "request meta" properties.

This reverts that change specifically and adds a comment clarifying why
it's there, and adds a test-case.

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

-->
2024-06-07 08:50:44 -07:00
vercel-release-bot
0cf0d43a48 v15.0.0-canary.18 2024-06-07 12:54:11 +00:00
vercel-release-bot
48396e80ae v15.0.0-canary.17 2024-06-07 08:38:55 +00:00
Tobias Koppers
c772c9f3d4
update turbopack (#66627)
* https://github.com/vercel/turbo/pull/8347 <!-- Tobias Koppers - Small
tree shaking fix and test case update -->
* https://github.com/vercel/turbo/pull/8348 <!-- Donny/강동윤 - fix: Apply
`paren-remover` while minifying -->
2024-06-07 08:11:36 +00:00
vercel-release-bot
004651b973 v15.0.0-canary.16 2024-06-06 23:23:52 +00:00
vercel-release-bot
f52f27896d v15.0.0-canary.15 2024-06-06 21:39:39 +00:00
Will Binns-Smith
9c7c92bcab
Update to turbopack-240606.2 (#66606)
Includes:
- https://github.com/vercel/turbo/pull/8346
- https://github.com/vercel/turbo/pull/8344
2024-06-06 21:31:48 +00:00
Shu Ding
04ce445105
Fix Server Actions closure idents tracking (#66601)
This PR fixes the same case mention in #66464. Instead of collecting all
values eagerly, here we merge fields (on any level of depth) of the same
value and skip methods. For example:

```ts
foo.bar
foo.bar.baz

qux.fn()
```

Previously we're (wrongly) collecting `[foo.bar, foo.bar.baz, qux.fn]`,
and now it will be just `[foo.bar, qux]`.

Merging of fields is critical for collecting methods correctly because
in theory we can't tell if an object member is a method or not:

```ts
data.push.call(data, 1)

// or inside a function that does the same:
doPush(data.push, data)
```

If we don't merge fields we'll collect `[data.push, data]` which still
fails.
2024-06-06 18:08:10 +02:00
Vercel Release Bot
6185444e0a
Update font data (#66582)
This auto-generated PR updates font data with latest available
2024-06-05 19:19:45 -07:00
vercel-release-bot
83e71c6cc8 v15.0.0-canary.14 2024-06-05 23:23:33 +00:00
Jiachi Liu
60ab8f6363
Fix loading navigation with metadata and prefetch (#66447)
### What & Why

Fixes NEXT-3498

Fixed loading shows up and disappear during client navigation, when you
defined `prefetch` is enabled and slow `generateMetadata` is defined. In
#64532, where in layout-router, we removed the place of infinite
suspense, adding it back so that the app can still remain suspensy
during navigation.

#### Behavior before fix

Prefetch -> Link Navigation -> Show `loading.js` -> RSC payload fetched
(no page content) -> the page content will display later when the
promise is resolved

#### Behavior after the fix

Prefetch -> Link Navigation -> Show `loading.js` -> RSC payload fetched
-> suspensy page content still triggering `loading.js` -> display the
resolved page content when the promise is resolved

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2024-06-05 15:48:11 -07:00
vercel-release-bot
b911485454 v15.0.0-canary.13 2024-06-05 20:50:56 +00:00
Tobias Koppers
d028fd1a48
update turbopack (#66575)
* https://github.com/vercel/turbo/pull/8336 <!-- Tobias Koppers - add
client disallowed transform -->
2024-06-05 20:41:27 +00:00
Will Binns-Smith
94d0a3cdb0
Update to turbopack-240605.2 (#66568)
Includes https://github.com/vercel/turbo/pull/8303
2024-06-05 18:12:30 +00:00
Paul Klein
82fe21f0a0
Add playwright-core to server-external-packages.json (#66549) 2024-06-05 17:10:47 +02:00
Shu Ding
106bac1d90
Remove unused state in Server Actions transform (#66547)
The `in_action_fn` state is never used and can be removed. Also renames
`action_cnt` to `reference_index` as it will be more general in the
future.
2024-06-05 16:11:46 +02:00
Donny/강동윤
3cf225c8ee
feat(turbopack): Introduce RcStr (#66262)
# Turbopack

* https://github.com/vercel/turbo/pull/8272 <!-- Donny/강동윤 - feat:
Update `swc_core` to `v0.92.8` -->
* https://github.com/vercel/turbo/pull/8262 <!-- Alexander Lyon - add
crate to calculate prehashes -->
* https://github.com/vercel/turbo/pull/8174 <!-- Tobias Koppers - use
prehash to avoid rehashing the key in the task cache -->
* https://github.com/vercel/turbo/pull/7674 <!-- Alexander Lyon - [turbo
trace] add ability to filter by value and occurences -->
* https://github.com/vercel/turbo/pull/8287 <!-- Donny/강동윤 - feat:
Update `swc_core` to `v0.92.10` -->
* https://github.com/vercel/turbo/pull/8037 <!-- Alexander Lyon - create
turbo-static for compile time graph analysis -->
* https://github.com/vercel/turbo/pull/8293 <!-- Will Binns-Smith - Sync
Cargo.lock with Next.js -->
* https://github.com/vercel/turbo/pull/8239 <!-- Benjamin Woodruff -
Reduce amount of code generated by ValueDebugFormat -->
* https://github.com/vercel/turbo/pull/8304 <!-- Benjamin Woodruff -
Minor optimizations to the codegen of TaskFnInputFunction -->
* https://github.com/vercel/turbo/pull/8221 <!-- Donny/강동윤 - perf:
Introduce `RcStr` -->


### What?

I tried using `Arc<String>` in
https://github.com/vercel/turbo/pull/7772, but a team member suggested
creating a new type so we can replace underlying implementation easily
in the future.

### Why?

To reduce memory usage.

### How?

Closes PACK-2776
2024-06-05 06:09:28 +00:00
JJ Kasper
e456acd854
Re-land Fix broken HTML inlining of non UTF-8 decodable binary data from Flight payload #65664 (#65988) 2024-06-04 20:25:59 -07:00
vercel-release-bot
8d71ac42fe v15.0.0-canary.12 2024-06-05 03:19:27 +00:00
Zack Tanner
14da561df2
fix NextRequest proxy in edge runtime (#66551)
Properties such as the native `Headers` / `Cookies` on the `NextRequest`
proxy make use of internal slots, so passing `receiver` (the proxy
object) which does not have the internal slots on it causes an issue in
the edge runtime. Instead, we want to make sure that the target is the
native object. This is similar to
https://github.com/vercel/next.js/pull/47088.

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

-->
2024-06-05 03:14:41 +00:00
vercel-release-bot
02e144d376 v15.0.0-canary.11 2024-06-04 20:20:55 +00:00
Ivan Torres
abff797e92
Update dev dependecies validate npm package name (#66536)
New PR

Update DevDependecies "validate-npm-package-name" and type

PR closed: #66420

---------

Co-authored-by: torresgol10.itd <torresgol10.itd@gmail.com>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-04 10:47:11 -07:00
Zack Tanner
855ea3af24
fix 'loading' segment not being copied into new CacheNode (#66538)
When `router.refresh` or a server action creates a new `CacheNode` tree,
we were erroneously not copying over the `loading` segment in the new
tree. This would cause the subtree to be remounted as the loading
segment switched from having a Suspense boundary to not having one.

Fixes #66029
Fixes #66499
2024-06-04 10:15:42 -07:00
Wyatt Johnson
8cb8edb686
refactor: deprecate future directory (#66432)
This removes the previous `server/future` directory and moves everything
into the `server` or `server/lib` directories. This is aimed to start to
flatten the server application structure.
2024-06-04 15:23:23 +00:00
Tobias Koppers
aacedcb417
add more tracing (#66528)
### What?

* add tracing for transforms
* add high level tracing
* add tracing for next/dynamic collection
2024-06-04 15:13:35 +00:00
Tobias Koppers
82df2a8d82
improve order of spans in tracing (#66516)
### What?

awaits generating the output before calling into emitting

### Why?

this improve the order of spans in the tracing
2024-06-04 15:12:11 +00:00
Tobias Koppers
a8221a0582
fixing next/dynamic transform for turbopack (#66527)
### What?

pass the correct prefer_esm value to the transform
2024-06-04 14:06:51 +00:00
vercel-release-bot
3ef03ff320 v15.0.0-canary.10 2024-06-04 12:05:01 +00:00
Tobias Koppers
e00f58e3ef
optimize server actions (#66523)
### What?

optimize allocations in server actions transform

In one edge case it reduces allocations from 30GB to 4.5MB and time from
760ms to 11ms.

### Why?

make it faster
2024-06-04 14:00:09 +02:00
Sebastian Silbermann
52689b5960
Fix fetch deduping in dev after reload (#66507) 2024-06-04 13:19:37 +02:00
Tobias Koppers
77e6b033c5
fix css order for some edge cases in App Dir (#66500)
### What?

* order of CSS between layout and page
* order of CSS between page and next/dynamic

### Why?

### How?

* overrides webpack CSS chunk loading to use react CSS loading to allow
them to share the order
2024-06-04 10:18:52 +02:00
Zack Tanner
ceef719459
fix missing stylesheets when parallel routes are present (#66300)
This takes the `layerAssets` property from the previous PR and actually
renders it, replacing the previous style handling. This ensures that
when multiple page segments are rendered on screen, all of their
associated CSS files are loaded. The existing `findHeadInCache` method
only ever returns a single head node, which means it’d miss stylesheets.


Fixes #59308
Fixes #63465
2024-06-03 16:35:31 -07:00
vercel-release-bot
786a703584 v15.0.0-canary.9 2024-06-03 23:23:25 +00:00
vercel-release-bot
f76563393a v15.0.0-canary.8 2024-06-03 20:42:41 +00:00
Zack Tanner
312eb61d24
add layerAssets property to FlightDataPath (#66354)
This adds a new `layerAssets` property (containing styles and script
tags) to `FlightDataPath`. Previously these were lumped in with the
`head` node, but we intentionally only ever render a single `head`, to
avoid duplicating metadata. This would mean `<AppRouter />` would only
ever render imported stylesheets for a single page in a racey way.
However, since Float handles hoisting and deduping these style tags,
we're safe to render them for each segment.

This PR introduces no change in behavior, aside from sending
`layerAssets` down from the server and storing it in the client router
cache. These nodes aren't rendered -- this is done in #66300.
2024-06-03 13:19:52 -07:00
Wyatt Johnson
be7d0c970e
fix: only generate prefetch rsc for ppr enabled routes (#66395)
This adds details for every ISR cache request if the page being
requested supports PPR. If it does, it'll attempt to load the
`.prefetch.rsc` payload instead of the `.rsc` payload. This corrects a
bug that was present in deployed environments.

This additionally refactors the `isAppPPREnabled` out of most of the
application, as it's only used to determine if we should add to the
`prefetchDataRoute` fields in the `prerender-manifest.json`. To support
loading the prefetch file or not, we pass the `isRoutePPREnabled`
through with the cache get/set operations instead.

x-slack-ref:
https://vercel.slack.com/archives/C075MSFK9ML/p1717094328986429
2024-06-03 12:55:05 -07:00
Hendrik Liebau
4f2e65ba96
Fix next/navigation type augmentation (#66489) 2024-06-03 17:53:37 +00:00
Tobias Koppers
7ea0337ad1
avoid filtering the error message (#65311)
### What?

If the error message contains a reference to `node_modules` it would
omit the error message, but actually we only want to omit the stack
frames

### Why?

### How?
2024-06-03 15:14:35 +00:00