Commit graph

17892 commits

Author SHA1 Message Date
Tim Neutkens
524b31513a
Fix logging level in actions test (#56473)
This test was using the old format and because of that failed in
Turbopack. This fixes that.

<!-- 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-10-05 12:30:39 +02:00
Wyatt Johnson
d9627df25b
Update .node-version (#56460)
Updates `.node-version` to allow any version of `18` which will allow development machines to update to newer minor releases without the need to update the repository each time.
2023-10-05 07:40:12 +00:00
Justin Ridgewell
feca3ce21c
Turbopack: Implement Server Actions (#53890)
### What?

This implements Server Actions inside the new Turbopack next-api bundles.

### How?

Server Actions requires:
1. A `.next/server/server-reference-manifest.json` manifest describing what loader module to import to invoke a server action
2. A "loader" entry point that then imports server actions from our internal chunk items
3. Importing the bundled `react-experimental` module instead of regular `react`
4. A little 🪄 pixie dust
5. A small change in the magic comment generated in modules that export server actions

I had to change the magic `__next_internal_action_entry_do_not_use__` comment generated by the server actions transformer. When I traverse the module graph to find all exported actions _after chunking_ has been performed, we no longer have access to the original file name needed to generate the server action's id hash. Adding the filename to comment allows me to recover this without overcomplicating our output pipeline.

Closes WEB-1279
Depends on https://github.com/vercel/turbo/pull/5705

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-04 23:33:21 +00:00
Jiachi Liu
ad42b610c2
Fix cli log next.js color (#56448)
The color of "Next.js <version>" in CLI was changed to `magenta` accidentally in #55992 , this PR added the original color back
2023-10-04 21:41:49 +00:00
Wyatt Johnson
ae1b89984d
Async Batcher (#56423)
There's lots of situations in Next.js where we want to ensure that only one operation is in progress at a time for a given task. An example of this is our response cache. The expectation is that for multiple requests for the same page should only result in a single invocation. This isn't new behavior, but this abstracts the batching interface away so we don't duplicate it.
2023-10-04 21:21:39 +00:00
Hamir Mahal
187df91438
fix: .../templates/*/app/layout.* import order (#56380)
- fixes #56379
2023-10-04 20:41:47 +00:00
Josh Story
65b0bb24af
Separate RSC and SSR jsx-runtime modules (#56438)
There should be no shared react packages in our server runtime. rsc should always be separate from ssr.

This update reconfigures the runtiem to eliminate shared react modules. the jsx runtime will now be separate for RSC and SSR. this is necessary because the implementations for the jsx runtime rely on React and they need to see the right versions.

Additionally I fixed an alias so that the shared subset react is used when using react-server condition.

I also fixed a bug in 2 tests related to class/className.

Note: this PR blocks upgrading React canary due to internal changes in how React state is managed in when using the `react-server` condition
2023-10-04 20:29:10 +00:00
vercel-release-bot
400c679791 v13.5.5-canary.2 2023-10-04 19:01:01 +00:00
Leah
e09e0f5e5b
chore: extract edge-app-route loader template (#56424)
Closes WEB-1705
2023-10-04 17:55:50 +00:00
Leah
00aea747c5
add cargo fmt to lint staged (#56430)
Keep forgetting to run `cargo fmt` before committing

Closes WEB-1707
2023-10-04 17:46:44 +00:00
Tobias Koppers
338f80b4fd
fix empty externals list, pnpm special case, and project path (#56402)
### What?

* node.js doesn't allow module requests starting with `.` since node.js
18, so we need to remove out .pnpm special case
* externals should be resolvable from the project dir instead of the
root dir
* fix a problem when the list of externals is empty

### Why?

### How?


Closes WEB-1703
2023-10-04 19:29:26 +02:00
Yagiz Nizipli
a278e94df5
fix: avoid creation of buffers for read ops (#56421)
Example usage of `readFileSync().toString()` first creates a `Buffer` instance and later does another C++ call to convert Buffer to UTF-8. This pull request reduces the C++ calls.
2023-10-04 16:40:59 +00:00
Yagiz Nizipli
f8308c9e39
fix: avoid unnecessary existSync call (#56419)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-04 17:44:26 +02:00
Ryan LaBarre
b436589ff8
Maintenance: minor example dep bumps to fix moderate vulns (#56375)
### What?
Merged a bunch of dependabot alerts in my own canary branch, mainly
postcss patch updates, and one graphql minor update, to fix moderate
security vulnerabilities in examples. Spot checked most and look good
still. EDIT: also one in scripts/send-trace-to-jaeger

### Why?
Because safety

### How?
Dependabot

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Steven <steven@ceriously.com>
2023-10-04 11:18:54 -04:00
vercel-release-bot
28767ad96a v13.5.5-canary.1 2023-10-04 13:17:50 +00:00
Shu Ding
bfee8eaa6e
Move Edge SSR event waitUntil into the handler (#56404)
Fixes the code added in #56381 where the event isn't passed to the outer function, but the adapter inside.
2023-10-04 13:13:18 +00:00
Viktor
2c5a8b1abb
Update redirect.mdx (#56414)
Add link to streaming doc
2023-10-04 13:01:10 +00:00
JJ Kasper
af04ef353b
Ensure loader generated export default has name (#56388)
When the function name is omitted webpack generates a name from the loader config which can be really long un-necessarily. Providing a name for the default function alleviates this. cc @shuding who found this
2023-10-04 09:28:07 +00:00
Yagiz Nizipli
a46c5afa60
fix: use fs.existsSync to avoid race condition (#56387)
Using `await fs.access` has couple of downsides. It creates unnecessary
async contexts where async scope can be removed. Also, it creates the
possibility of race conditions such as `Time-of-Check to Time-of-Use`.

It would be nice if someone can benchmark this. I'm rooting for a
performance improvement.

Some updates from Node.js land:

- There is an open pull request to add V8 Fast API to `existsSync`
method - https://github.com/nodejs/node/pull/49893
- Non-existing `existsSync` executions became 30% faster -
https://github.com/nodejs/node/pull/49593

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-04 00:19:10 +02:00
Josh Story
09b0ca42fb
App Router - preinitialize chunks during SSR (#54752)
Today when we hydrate an SSR'd RSC response on the client we encounter import chunks which initiate code loading for client components. However we only start fetching these chunks after hydration has begun which is necessarily after the initial chunks for the entrypoint have loaded.

React has upstream changes that need to land which will preinitialize the rendered chunks for all client components used during the SSR pass. This will cause a `<script async="" src... />` tag to be emitted in the head for each chunk we need to load during hydration which allows the browser to start fetching these resources even before the entrypoint has started to execute.

Additionally the implementation for webpack and turbopack is different enough that there will be a new `react-server-dom-turbopack` package in the React repo which should be used when using Turbopack with Next.

This PR also removes a number of patches to React src that proxy loading (`__next_chunk_load__`) and bundler requires (`__next_require__`) through the `globalThis` object. Now the react packages can be fully responsible for implementing chunk loading and all Next needs to do is supply the necessary information such as chunk prefix and crossOrigin attributes necessary for this loading. This information is produced as part of the client-manifest by either a Webpack plugin or Turbopack.

Additionally any modifications to the chunk filename that were previously done at runtime need to be made in the manifest itself now. This means we need to encode the deployment id for skew protection and encode the filename to make it match our static path matching (and resolutions on s3) when using `[` and `]` segment characters.

There are a few followup items to consider in later PRs
1. we currently bundle a node and edge version of react-server-dom-webpack/client. The node version has an implementation for busboy whereas the edge version does not. Next is currently configured to use busboy when handling a fetch action sent as multipart with a node runtime. Ideally we'd only bundle the one platform we are buliding for but some additional refactoring to support better forking is possibly required here

This PR also updates react from 09285d5a7 to d900fadbf.

### React upstream changes

- https://github.com/facebook/react/pull/27439
- https://github.com/facebook/react/pull/26763
- https://github.com/facebook/react/pull/27434
- https://github.com/facebook/react/pull/27433
- https://github.com/facebook/react/pull/27424
- https://github.com/facebook/react/pull/27428
- https://github.com/facebook/react/pull/27427
- https://github.com/facebook/react/pull/27315
- https://github.com/facebook/react/pull/27314
- https://github.com/facebook/react/pull/27400
- https://github.com/facebook/react/pull/27421
- https://github.com/facebook/react/pull/27419
- https://github.com/facebook/react/pull/27418
2023-10-03 21:40:25 +00:00
vercel-release-bot
e34fdf2890 v13.5.5-canary.0 2023-10-03 21:23:02 +00:00
Shu Ding
b7c85b8778
Expose util internally for debugging (#56381)
This PR exposes a temporary `__next_private_global_wait_until__` globally for Edge SSR's function context to do `waitUntil`.
2023-10-03 21:04:16 +00:00
Leah
515784c277
chore: pass defineEnv from next.js to rust directly (#56216)
### What?

Deduplicates our env var injection between the JS and rust side

Closes WEB-937

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-10-03 22:43:21 +02:00
Michael Novotny
f77f222d4f
Updates MDX docs (#56378)
When trying to update my own website to use App Router, I found the current Next.js Docs were missing specifics to get it working (most notably, no mention of `pageExtensions`). Coupled with community feedback, we decided to revisit and rework the entire page.

The page has been walked through and tested on brand new create-next-app projects for both App and Pages Routers to ensure completeness.

Closes [DX-2095](https://linear.app/vercel/issue/DX-2095/improve-nextjs-mdx-docs)

Rendered pages while running locally, in case they are more helpful in seeings the changes and different between routers.

### App Router 

![localhost_3332_docs_pages_building-your-application_configuring_mdx (1)](https://github.com/vercel/next.js/assets/446260/2a2b1a66-c794-4831-ab89-a6a61d02eb84)

### Pages Router

![localhost_3332_docs_pages_building-your-application_configuring_mdx](https://github.com/vercel/next.js/assets/446260/cc60a8a2-a931-4033-aaba-e989a719692d)
2023-10-03 19:32:58 +00:00
Syphini
ef440d40b6
add digest property to error prop (#56339)
Matching the conventions laid out in https://nextjs.org/docs/app/api-reference/file-conventions/error
2023-10-03 14:21:30 +00:00
Wyatt Johnson
0eb71b6f07
Misc Typescript and export updates (#55841)
This refactors a bit of the typescript types around the export and build pipelines. This does not introduce any new functionality.


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-03 14:11:09 +00:00
JJ Kasper
aa3377edec
Fix code freeze disable handling (#56340)
Fixes: https://github.com/vercel/next.js/actions/runs/6388368482
2023-10-03 13:54:46 +00:00
Shu Ding
8469d0ac27
Add test case for the permalink option of useFormState (#56329)
Ref: https://github.com/facebook/react/pull/27372.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-10-03 13:47:03 +02:00
Tim Neutkens
b79a11f6ad
Fix mjs import for Turbopack test (#56354)
Turbopack currently supports fully-specified `.mjs` imports. Double
check with @sokra to verify if this is correct.

<!-- 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-10-03 13:33:04 +02:00
JJ Kasper
11b01e06df
Update parallelizing tasks with webpackBuildWorker config (#56287)
This updates to make build/server tracing parallelized with our webpack
compilations so that it can start right after the server compilation is
finished instead of after all compilations are finished. This
parallelizing requires the `experimental.webpackBuildWorker` config be
enabled and doesn't change behavior without it.

Part of this also cleans up our plugin state restoring/handling to use
serializable structures instead of serializing/deserializing manually.
2023-10-02 20:49:36 -07:00
vercel-release-bot
1e8dca4a87 v13.5.4 2023-10-03 01:40:53 +00:00
vercel-release-bot
9e24d6ff3b v13.5.4-canary.11 2023-10-03 00:36:26 +00:00
Jiachi Liu
281ae41896
Fix build output logging order (#56335)
Closes NEXT-1671 

Move "Finalizing" to the bottom, and print tree view after file tracing
spinner

### After
```
 ✓ Generating static pages (5/5)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                              Size     First Load JS
┌ ○ /                                    133 B            80 kB
└ ○ /_not-found                          876 B          80.8 kB
+ First Load JS shared by all            79.9 kB
  ├ chunks/main-app-f7da6251716e8121.js  78.2 kB
  └ chunks/webpack-bf1a64d1eafd2816.js   1.66 kB
```

### Before

```
 ✓ Generating static pages (5/5)
 ✓ Finalizing page optimization

   Collecting build traces  .Route (app)                              Size     First Load JS
┌ ○ /                                    133 B            80 kB
└ ○ /_not-found                          876 B          80.8 kB
+ First Load JS shared by all            79.9 kB
  ├ chunks/main-app-f7da6251716e8121.js  78.2 kB
  └ chunks/webpack-bf1a64d1eafd2816.js   1.66 kB


○  (Static)  automatically rendered as static HTML (uses no initial props)

 ✓ Collecting build traces
 ```
2023-10-02 17:29:55 -07:00
JJ Kasper
d7626ffb79
Revert "misc: shortcut styled-jsx in external resolution (#56291)" (#56334)
We can't resolve the exact URL in externals otherwise when you move from
one path to another.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04KC8A53T7/p1696291412072799?thread_ts=1695906014.899719&cid=C04KC8A53T7)

This reverts commit dba978f4ba.

<!-- 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-10-02 17:22:22 -07:00
vercel-release-bot
db48052a5e v13.5.4-canary.10 2023-10-02 23:23:48 +00:00
Jiachi Liu
7df92b868a
test: add flaky turbopack integration tests to manifest (#56309) 2023-10-03 00:53:09 +02:00
Alexandre Baizeau
eeb9b3325d
fix: Invalid URL (404) provided on server actions error (#56323)
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-10-03 00:32:43 +02:00
Omar McIver
3172cfedc8
fix: support both decoded and encoded url requests of conventioned files (#56187)
Co-authored-by: Omar McIver <omar.mciver@mode3cloud.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-03 00:02:49 +02:00
Boris Besemer
a2f9ef5a34
fix(next/client): keep hash when navigating from app to pages router (#56223)
### What?

Fixes the pages router not receiving a hash when being linked from the
app router.

### Why?

The hash being removed breaks sites that rely on it for client side
features.

### How?

The hash gets omitted from the URL when used as a key for the
preflightCache. Once it's clear that it's an external URL and that it's
not empty we can use the initial href to send the hash as well.

Not completely sure if there's an edge case that might break, I added an
extra check for when the hash is only used to scroll the page.

This might need an additional test case just for
`navigate-reducer.test.tsx`.

Fixes #56212

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-10-02 14:43:04 -07:00
JJ Kasper
a970f28439
Add code freeze GitHub actions for releasing (#56325)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-10-02 23:10:40 +02:00
Jimmy Lai
5fbc23e7b2
misc: fix instrumentation with bundled server (#56318)
This PR fixes an issue with the instrumentation hook breaking with the
bundled server. I'll follow up with a better test setup for the bundled
server in a follow up (tomorrow).

<!-- 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-10-02 11:50:30 -07:00
Tim Neutkens
98432a4630
Remove buildId test as it's no longer relevant (#56316)
Follow-up to #56310.
2023-10-02 18:20:47 +00:00
Sukka
86274e68aa
fix(#53190): add missing crossOrigin to assetsPrefix resources (#56311)
Fixes #53190.

Next.js App Router comprises two categories of resources, same-origin ones (RSC payload, in the form of inline `<script />`) and possibly third-party ones (chunks that respect the `assetPrefix`). The latter should also respect the `crossOrigin` option from `next.config.js`.

Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-02 17:21:49 +00:00
Zack Tanner
e970e050a9
Reland static prefetches & fix prefetch bailout behavior (#56228)
Reland #54403

Also modifies the implementation of #55950 to not change the prefetch behavior when there is flight router state - we should only check the entire loader tree in the static prefetch case, otherwise we're inadvertently rendering the component tree for prefetches that match the current flight router state segment. ([slack x-ref](https://vercel.slack.com/archives/C03S8ED1DKM/p1695862974745849))

This includes a few other misc fixes for static prefetch generation:
- `next start` was not serving them (which also meant tests weren't catching a few small bugs)
- the router cache key casing can differ between build and runtime, resulting in a bad cache lookup which results suspending indefinitely during navigation
- We cannot generate static prefetches for pages that opt into `searchParams`, as the prefetch response won't have the right cache key in the RSC payload
- Layouts that use headers/cookies shouldn't use a static prefetch because it can result in unexpected behavior (ie, being redirected to a login page, if the prefetch contains redirect logic for unauthed users)

Closes NEXT-1665
Closes NEXT-1643
2023-10-02 17:12:55 +00:00
Hamir Mahal
be952fbb31
fix: typo in with-stripe-typescript example (#56274)
fixes #56273.
2023-10-02 16:47:23 +00:00
Tim Neutkens
7f60cc8b0f
Support serverRuntimeConfig and publicRuntimeConfig in Turbopack (#56310)
Allows `publicRuntimeConfig` / `serverRuntimeConfig` to be set.
2023-10-02 16:40:58 +00:00
Tobias Koppers
8d18ad60d7
update webp crate (#56307)
### What?

update dependencies

Closes WEB-1696
2023-10-02 16:16:26 +00:00
Jiachi Liu
ac95a20276
Fix flaky test for size output (#56303)
x-ref: https://github.com/vercel/next.js/actions/runs/6380869104/job/17316148085?pr=56187

Tune the regex that match the correct number but without leading zero
2023-10-02 15:47:09 +00:00
Jimmy Lai
dba978f4ba
misc: shortcut styled-jsx in external resolution (#56291)
This PR just shortcuts the styled-jsx resolution to tell webpack to
compile it immediately. I noticed this could cause an issue if
`config.experimental.bundlePagesExternals` was enabled.

<!-- 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-10-02 17:02:52 +02:00
Jimmy Lai
458dab83ca
misc: update code owners (#56290)
Adding myself to the build folder config

<!-- 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-10-02 17:02:28 +02:00