Commit graph

10737 commits

Author SHA1 Message Date
vercel-release-bot
38758cb631 v14.0.5-canary.19 2023-12-19 23:19:49 +00:00
Donny/강동윤
a65fb16298
fix: Allow start turbopack dev server for a project using middleware (#59759)
### What?

Configures `scoped_tls` (in `swc_common`) correctly.

### Why?

One of the company websites fails to **start**.

https://vercel.slack.com/archives/C03EWR7LGEN/p1702970892605989

### How?

Closes PACK-2165
2023-12-19 20:35:42 +09:00
Andrew Clark
63825de4d5
LayoutRouter: Support segment value of Promise<null> to asynchronously bail out and trigger a server patch (#59724)
If the data for a segment is missing when LayoutRouter renders, it
initiates a lazy fetch to patch the cache. This is how all dynamic data
fetching works in the pre-PPR implementation.

For PPR, we won't use this mechanism anymore for regular navigations,
but (at least for now) we will still use it as a fallback behavior if
the server response does not match what we expected to receive.

This commit adds support for asynchronously triggering a lazy fetch, by
unwrapping the segment data promise inside LayoutRouter to check if it's
missing. If so, it will trigger the lazy fetch mechanism.

When PPR is not enabled this should not observably impact behavior.

Closes NEXT-1893
2023-12-18 20:26:34 -05:00
vercel-release-bot
5308a3d25c v14.0.5-canary.18 2023-12-18 23:22:18 +00:00
mknichel
f8864fd20c
Remove path normalization logic when uploading .next/trace traces (#59305)
When uploading traces from `.next/trace`, target paths that trigger
compilations were being normalized to paths like
`[project]/../../../../../middleware`. This PR removes the normalization
logic so that the triggers appear as `/middleware` which is easier to
understand.
2023-12-18 13:15:02 -08:00
Vercel Release Bot
bef5234225
Update font data (#59722)
This auto-generated PR updates font data with latest available
2023-12-18 09:46:22 -08:00
vercel-release-bot
3951c7be4f v14.0.5-canary.17 2023-12-17 23:22:07 +00:00
vercel-release-bot
1f798f4647 v14.0.5-canary.16 2023-12-16 23:21:32 +00:00
vercel-release-bot
2e14537fc1 v14.0.5-canary.15 2023-12-15 23:22:05 +00:00
Zack Tanner
1fa7a74a5c
Update React from 2c338b16f to 0cdfef19b (#59666)
Updates React from 2c338b16f to 0cdfef19b.

### React upstream changes

- https://github.com/facebook/react/pull/27821
- https://github.com/facebook/react/pull/27820
- https://github.com/facebook/react/pull/27818
- https://github.com/facebook/react/pull/27819
- https://github.com/facebook/react/pull/27817
- https://github.com/facebook/react/pull/27703
- https://github.com/facebook/react/pull/27796
- https://github.com/facebook/react/pull/27811
- https://github.com/facebook/react/pull/27804
- https://github.com/facebook/react/pull/27807
- https://github.com/facebook/react/pull/27805
- https://github.com/facebook/react/pull/27792
- https://github.com/facebook/react/pull/27788
- https://github.com/facebook/react/pull/26852
- https://github.com/facebook/react/pull/27790
- https://github.com/facebook/react/pull/27786
- https://github.com/facebook/react/pull/27785
- https://github.com/facebook/react/pull/27783
- https://github.com/facebook/react/pull/27784
- https://github.com/facebook/react/pull/27769
- https://github.com/facebook/react/pull/27766
- https://github.com/facebook/react/pull/27701
- https://github.com/facebook/react/pull/27732
- https://github.com/facebook/react/pull/27740
- https://github.com/facebook/react/pull/27767
- https://github.com/facebook/react/pull/27768
- https://github.com/facebook/react/pull/27765
- https://github.com/facebook/react/pull/27759
- https://github.com/facebook/react/pull/27579
- https://github.com/facebook/react/pull/27709
- https://github.com/facebook/react/pull/27734
- https://github.com/facebook/react/pull/27739
- https://github.com/facebook/react/pull/27717
- https://github.com/facebook/react/pull/27583
- https://github.com/facebook/react/pull/27713

Closes NEXT-1887
2023-12-15 08:51:45 -08:00
Tim Neutkens
dff1cd5b6a
Move changeSubscription for _document to finally to mirror page handling in Turbopack (#59664)
## What?

Moves the changeSubscription for _document into the finally block,
similar to how the page itself is handled there as well.
This should allow moving the rest of the try block into a separate
function that can be reused for builds too.


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

-->


Closes NEXT-1885
2023-12-15 17:21:34 +01:00
Tim Neutkens
8c4649e781
Consolidate manifest writing for Turbopack in a single function (#59663)
## What?

I'm working on consolidating a bunch of the file writing related pieces
in the Turbopack handling in the dev server so that it can be abstracted
out as it's needed for `next build` too.

These changes make sure that there is a single `writeManifests()`
instead of picking specific manifests to write.

We can optimize this later but for now the overhead of writing them to
disk separately is negligible.


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

-->


Closes NEXT-1884
2023-12-15 17:21:19 +01:00
Zack Tanner
dd57054647
Fix parallel routes with server actions / revalidating router cache (#59585)
### What?
There are a bunch of different bugs caused by the same underlying issue,
but the common thread is that performing any sort of router cache update
(either through `router.refresh()`, `revalidatePath()`, or `redirect()`)
inside of a parallel route would break the router preventing subsequent
actions, and not resolve any pending state such as from `useFormState`.

### Why?
`applyPatch` is responsible for taking an update response from the
server and merging it into the client router cache. However, there's
specific bailout logic to skip over applying the patch to a
`__DEFAULT__` segment (which corresponds with a `default.tsx` page).
When the router detects a cache node that is expected to be rendered on
the page but contains no data, the router will trigger a lazy fetch to
retrieve the data that's expected to be there
([ref](5adacb6912/packages/next/src/client/components/layout-router.tsx (L359-L370)))
and then update the router cache once the data resolves
([ref](5adacb6912/packages/next/src/client/components/layout-router.tsx (L399-L404))).

This is causing the router to get stuck in a loop: it'll fetch the data
for the cache node, send the data to the router reducer to merge it into
the existing cache nodes, skip merging that data in for `__DEFAULT__`
segments, and repeat.

### How?
We currently assign `__DEFAULT__` to have `notFound()` behavior when
there isn't a `default.tsx` component for a particular segment. This
makes it so that when loading a page that renders a slot without slot
content / a `default`, it 404s. But when performing a client-side
navigation, the intended behavior is different: we keep whatever was in
the `default` slots place, until the user refreshes the page, which
would then 404.

However, this logic is incorrect when triggering any of the above
mentioned cache node revalidation strategies: if we always skip applying
to the `__DEFAULT__` segment, slots will never properly handle reducer
actions that rely on making changes to their cache nodes.

This splits these different `applyPatch` functions: one that will apply
to the full tree, and another that'll apply to everything except the
default segments with the existing bailout condition.

Fixes #54173
Fixes #58772
Fixes #54723
Fixes #57665

Closes NEXT-1706
Closes NEXT-1815
Closes NEXT-1812
2023-12-15 15:51:14 +00:00
vercel-release-bot
65634bea54 v14.0.5-canary.14 2023-12-15 15:31:03 +00:00
Tim Neutkens
a0c68c5d02
Fix issue with outputFileTracingExcludes and pages/api edge runtime (#59157)
## What?

Ensures `Object.entries` is not called on the `Map`. Seems this only
fails in a very particular case but potentially this fixes other issues
than the one I added in the tests too.

## How?

`Object.entries()` results in an empty array when called on a `Map`.
Created a shared type declaration for the value and removed the
`Object.entries`. Benefit of this is that we can skip the loop as well.


<!-- 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-12-15 16:27:03 +01:00
Tim Neutkens
5d091ed9f9
Change manifestPath to pagesManifestPath (#59657)
## What?

Small clarification on the variable 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(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 #

-->


Closes NEXT-1882
2023-12-15 16:03:50 +01:00
Jiachi Liu
d3205561d2
refactor and simplify app dynamic components (#59658) 2023-12-15 15:33:46 +01:00
Tim Neutkens
98e0a56caf
Refactor setup-dev-bundler to make Turbopack/Webpack split clearer (#59650)
## What?

Small refactor to move Turbopack hotreloader interface creation to a
separate function: `createHotReloaderTurbopack`.
Renamed `HotReloader` to `HotReloaderWebpack`. 

Initially wanted to move `createHotReloaderTurbopack` to a separate file
but it relies on a bunch of in-scope variables so that is not
straightforward. Will do that later.


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

-->


Closes NEXT-1881
2023-12-15 13:32:58 +01:00
vercel-release-bot
05eb8114f9 v14.0.5-canary.13 2023-12-14 23:22:14 +00:00
Wyatt Johnson
2da04af2e8
Partial Pre Rendering Headers (#59447)
This fixes some of headers (and adds associated tests) for pages when
PPR is enabled. Namely, the `Cache-Control` headers are now returning
correctly, reflecting the non-cachability of some requests:

- Requests that postpone (dynamic data is streamed after the initial
static shell is streamed)
- Requests for the Dynamic RSC payload

Additionally, the `X-NextJS-Cache` header has been updated for better
support for PPR:

- Requests that postpone no longer return this header as it doesn't
reflect the cache state of the request (because it streams)
- Requests for the Prefetch RSC now returns the correct cache headers
depending on the segment and pre-postpone state

This also enables the other pathnames in the test suites 🙌🏻 

Closes NEXT-1840
2023-12-14 13:14:06 -07:00
Tim Neutkens
42d6e3092e
Fix useOptimistic in server components bug. Add tests for invalid React server APIs (#59621)
## What?

Fixes a bug where `useOptimistic` wouldn't trigger a compiler error when
imported in Server Components.

Adds tests for the following `import { x } from 'react'` in Server
Components, where `x` is the value:

- Component
- createContext
- createFactory
- PureComponent
- useDeferredValue
- useEffect
- useImperativeHandle
- useInsertionEffect
- useLayoutEffect
- useReducer
- useRef
- useState
- useSyncExternalStore
- useTransition
- useOptimistic

These show a particular error explaining how to add `"use client"`:

![CleanShot 2023-12-14 at 14 49
37@2x](https://github.com/vercel/next.js/assets/6324199/e47eab71-b2a2-4c14-bec0-0d5cdd720e80)





<!-- Thanks for opening a PR! Your contribution is much appreciated.i:
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-12-14 21:09:41 +01:00
vercel-release-bot
5f1e90960d v14.0.5-canary.12 2023-12-13 23:22:15 +00:00
vercel-release-bot
e3b0294c9e v14.0.5-canary.11 2023-12-13 18:58:07 +00:00
Zack Tanner
b345e1b01e
Revert "Page Info Cleanup (#59430)" (#59592)
This appears to be causing a build issue and requires deeper
investigation. Reverting for now.

- Reverts #59430 

[slack
x-ref](https://vercel.slack.com/archives/C06AARWFZFB/p1702491612961359)

Closes NEXT-1870
2023-12-13 10:54:58 -08:00
Zack Tanner
b99e8f5ad0
move segment constants to separate file (#59587)
Moved this to prevent a bundle regression when these constants are used
on both client/server.

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

-->


Closes NEXT-1867
2023-12-13 10:25:54 -08:00
vercel-release-bot
f51ee191da v14.0.5-canary.10 2023-12-13 18:08:37 +00:00
Dima Voytenko
96cc789f7d
transpilePackages should override default settings for external packages (#59385)
See related https://github.com/vercel/next.js/issues/51969. It should no
longer apply.
2023-12-13 19:04:57 +01:00
Andrew Clark
c964e9a481
Make CacheNodeSeedData match FlightRouterState more closely (#59590)
When PPR is enabled, the CacheNodeSeedData and FlightRouterState
contained in an RSC payload (whether it's static or dynamic) should
always have the same tree structure.

The only reason the two trees would ever be different is if the server
partially renders with `loading.tsx`, but that behavior doesn't exist
when PPR is enabled. (In that case, the CacheNodeSeedData would describe
only a subset of FlightRouterState.)

The behavior is already correct but to make the types a bit closer, this
changes the `parallelRoutes` slot of CacheNodeSeedData to be
non-nullable; if there are no children, it should be an empty object.

It's not semantically important, I'm only changing it to make the types
more consistent, since we typically traverse both trees in parallel.

Eventually we will probably merge these into a single transport type.

Closes NEXT-1868
2023-12-13 12:59:21 -05:00
Andrew Clark
79e82d42c6
Fix another magic segment string constant (#59591)
Follow-up to #59552, I think this one was missed because it landed
around the same time as #59538.

Closes NEXT-1869
2023-12-13 17:36:19 +00:00
Leah
e9ac616414
chore: update Turbopack (#59589)
### Changes

* https://github.com/vercel/turbo/pull/6777 <!-- Leah -
fix(turbopack-ecmascript-runtime): handle non encoded CSS paths -->
* https://github.com/vercel/turbo/pull/6785 <!-- Tim Neutkens - Ensure
turbopack-trace-server doesn't send message in a loop -->



Closes PACK-2147
2023-12-13 18:25:37 +01:00
Zack Tanner
855139b239
cleanup magic segment strings (#59552)
This uses the existing PAGE_SEGMENT constant in places where we had
`__PAGE__` and introduces a similar constant for `__DEFAULT__`.
<!-- 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 #

-->


Closes NEXT-1860
2023-12-13 07:03:40 -08:00
Andrew Clark
9dfeced234
Fork navigateReducer into PPR and non-PPR versions (#59538)
The PPR implementation of navigateReducer is expected to diverge
significantly from the existing, non-PPR implementation. So this forks
them into two separate functions. This will be easier to maintain than
two different implementations inside the same function, especially
considering we don't expect any more changes to the non-PPR
implementation.

This also reduces the chances we'll introduce an accidental regression
into the non-PPR version, which is the stable one that all users (except
for the ones dogfooding PPR) are currently using.

For now, the two implementations are identical. I'll start making
changes in subsequent PRs.

Only one implementation will be included in the final build; the other
one will be dead code eliminated because the feature check is statically
inlined at build time:

```js
export const navigateReducer = process.env.__NEXT_PPR
  ? navigateReducer_PPR
  : navigateReducer_noPPR
```

Closes NEXT-1856
2023-12-13 10:02:27 -05:00
Jiachi Liu
5f7fd46906
Enable build worker by default (#59405) 2023-12-13 13:36:56 +00:00
Jiachi Liu
572a6bce35
Should not show no index for client rendering bailout (#59531) 2023-12-13 11:03:11 +01:00
vercel-release-bot
32759b48b7 v14.0.5-canary.9 2023-12-13 00:24:16 +00:00
Rahul Mishra
9973770b43
chore(create-next-app): bump prompts to v2.4.2 (#59006)
<!-- 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 #

-->
This PR updates `prompts` to `v2.4.2`, it fixes a bug I found and I
haven't seen any reports about it.
## The Bug
[Screencast from 2023-11-28
17-58-41.webm](https://github.com/vercel/next.js/assets/130567419/cf17f0d8-39f3-4ced-80ca-9fb5962587d8)

There was a bug in `prompts` where it didn't handle <kbd>Home</kbd> and
<kbd>End</kbd> button correctly. It has been fixed in later version. I
have updated `prompts` along with `@types/prompts` to latest available
version which is `v2.4.2`.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-12 16:16:13 -08:00
JJ Kasper
95fe24f61d
Fix force-static and fetch no-store cases (#59549)
This ensures that `export const dynamic = 'force-static'` is properly
honored when a page contains fetches with `cache: 'no-store'`, `cache:
'no-cache'` or `next: { revalidate: 0 }`.

Closes NEXT-1858
2023-12-12 16:08:03 -08:00
vercel-release-bot
e9757175bc v14.0.5-canary.8 2023-12-12 23:22:00 +00:00
Wyatt Johnson
ed12b552de
Page Info Cleanup (#59430)
This updates the some of the logic around updating `PageInfo` entries in
the `pageInfos` map. This is a followup to #59420.

Closes NEXT-1838
2023-12-12 14:37:00 -07:00
akawalsky
6fbff29a2e
allow passing wildcard domains in serverActions.allowedDomains (#59428)
Implementation of feature request opened here -
https://github.com/vercel/next.js/discussions/59427

Approach:

~~We are using micromatch in the csrf protection step of actionHandler
to allow for wildcard domains passed in allowedDomains. This is the same
library used for matching domains for remote images.~~

If any of the allowed domains match the origin of the request, we skip
the downstream error thrown for csrf protection.

Edit:

Micromatch is not available in this context as it is only compatible
with Node. This codepath can be run from the edge, so we need to rely on
vanilla js compatible code only.

Instead of falling back to allowing the user to pass in a regex, which
can be somewhat insecure, we opt into continuing to use a wildcard
pattern from a configuration standpoint and instead use a simple
function that matches on wildcards using string comparison and
iteration.

Ideally, Micromatch can be retrofitted to work in non-Node settings and
this piece of code can be replaced in the future, without deprecating or
changing the next.config interface.

---------

Co-authored-by: Josh Story <story@hey.com>
2023-12-12 11:08:36 -08:00
Andrew Clark
5adacb6912
Add CacheNode.prefetchRsc field (#59537)
Adds a new field `prefetchRsc` to CacheNode that will be used by the PPR
implementation. It represents a static version of the segment that can
be showed immediately, and may or may not contain dynamic holes. It's
prefetched before a navigation occurs. During rendering, we will choose
whether to render `rsc` or `prefetchRsc` with `useDeferredValue`.

As with the `rsc` field, a value of `null` means no value was provided.
In this case, the LayoutRouter will go straight to rendering the `rsc`
value; if that one is also missing, it will suspend and trigger a lazy
fetch.

The non-PPR implementation will never set this value.

This PR adds the field to the CacheNode type but doesn't implement any
of the behavior yet. Mostly this involves updating the router reducer
unit tests.

Closes NEXT-1855
2023-12-12 13:28:05 -05:00
Zack Tanner
b441cff7a9
fix NODE_OPTIONS=inspect (#59530)
Passing `NODE_OPTIONS='--inspect'` was failing because a sub-process was
getting created (`getRegistry()`) which would trigger a "address already
in use" error when the process inherited the same debugger port from the
parent process.

I had to disable this test in
https://github.com/vercel/next.js/pull/59508 because it wasn't passing,
CI was just skipping it. This PR fixes the behavior and re-enables the
test.

Fixes #55862

Closes NEXT-1854
2023-12-12 07:03:13 -08:00
Andrew Clark
9663d78bf9
Rename CacheNode.subTreeData -> .rsc (#59491)
I want to give this field a name that's bit less generic and
distinguishes it from `lazyData` (because that one has a different type
and is a special case we want to eventually remove).

I'm also about to add an optional `prefetchRsc` field that represents a
prefetched version of the same value. The common suffix is meant to
communicate how they are related.

Doing this rename in its own PR because it's a pure find-and-replace,
whereas the later steps are not.

Closes NEXT-1846
2023-12-11 21:41:03 -05:00
John Pham
d96a7e56a6
Add text-wrap: balance to CNA template for card descriptions (#59384)
### What?
This prevents the descriptions from having orphans at different viewport
widths.

### Why?

| Default | Pretty | Balance |
|--------|-------| --- |
|
![image](https://github.com/vercel/next.js/assets/16027268/66c8eac4-b995-4c30-9bdc-fd44a4a7fdda)
|
![image](https://github.com/vercel/next.js/assets/16027268/07a2e45a-728b-438f-a4e5-98f7c1c5c33a)
|
![image](https://github.com/vercel/next.js/assets/16027268/153fe94a-2b10-4e39-bb19-b1ca702bcea8)
|
2023-12-11 17:41:01 -08:00
Jiachi Liu
95168bf136
Fix third party typings (#59503) 2023-12-12 01:07:17 +01:00
vercel-release-bot
ba6b8fdee4 v14.0.5-canary.7 2023-12-11 20:43:59 +00:00
JJ Kasper
c7a29bd13e
Fix webpack chunks handling in traces (#59498)
This ensures we don't include all chunks in `nft` traces un-necessarily
as our webpack plugin already tracks which are needed per-entry.

x-ref: [slack
thread](https://vercel.slack.com/archives/C0591D8EN4C/p1702318184832319?thread_ts=1701815919.923639&cid=C0591D8EN4C)

Closes NEXT-1847
2023-12-11 11:35:35 -08:00
Wyatt Johnson
7dd7f5131b
Generate Params Cleanup (#59431)
This updates the `collectGenerateParams` method to use a loop rather
than being recursive as well as updating some of the Typescript types.
This is a follow up of #59420.

Closes NEXT-1839
2023-12-11 11:41:46 -07:00
Janicklas Ralph
ce92cea18d
Adding Google analytics to next/third-parties (#58418)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-12-11 18:21:32 +00:00
Andrew Clark
c2ab5f704a
Rename CacheNode.data → .lazyData (#59473)
`CacheNode.data` is used to lazily kick off a request during render, and
represents the result of the entire Flight response. It doesn't
correspond directly to the RSC data of the cache node itself — that's
`subTreeData`. To complicate things further, I'm about to add another
field to CacheNode that represents prefetched RSC data.

To make it a little less confusing, I've renamed the `data` field to
`lazyData`. Still not perfectly clear on first glance, but it's at least
more specific. With PPR, the goal is to remove the lazy data fetching
mechanism in favor of initiating the request immediately upon
navigation. So this field will eventually go away.

In the next PR, I will rename `subTreeData`, too. Perhaps something with
"rsc" in the name so it's less generic than "data".

Closes NEXT-1843
2023-12-11 11:33:12 -05:00