Fixes#48962Fixes#49009Fixes#49107
### Why
For standalone mode the `fs.readFile` is executed for `route.js` when
the module is loaded, then the fs operation aginst the wrong file path
will break the proper module loading, then it fallbacks to `/_error`
module.
### What
We move the fs read operation to the first get then cache the buffer in
the module level variable, so that `fs.readFile` won't be executed. As
we already have prerender cache, the meta/body fs cache will be HIT and
served
### What?
disable optimistic_updates
So it no longer does that:
> If Kodiak is merging an out-of-date pull request that has running
status checks, update the pull request's branch without waiting for the
running status checks to finish.
The problem with that is that it cancels running checks and restarts
them.
Instead it waits for all running status checks before updating the PR.
### Why?
This should avoid the case where a PR is updated again and again without
yielding a result.
It also saves some CI cost
And it allows CI to finish and fill up the turborepo cache, which can
potentially used for the next run.
### What?
RSC also needs a different next/dynamic on client side
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Reorganize the test cases a bit by separating server/client graphs. And
make sure that using `'use server'` inside a Client Component will
result in a compilation error.
Fixes#48392
When passing down `Array<IconDescriptor>`, it should allow overriding `rel` prop of icon instead of always picking the default one
fix NEXT-1085
We picked `VERCEL_URL` env for `metadataBase` in preview mode, but also picking that on production, this could potentially use the unique build url for social images if you didn't set `metadataBase`
We recommend to set the major/preferred domain to `metadataBase` if you're using social images, this PR help warn you in every env if you're missing that
[slack thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1683150633962539?thread_ts=1683144147.664059&cid=C03KAR5DCKC)
Currently we are always use an array for the `.$$bound` field of an action even if it's empty. This PR updates the transform to generate `null` in that case so we can do further optimizations. Note that `[]` and `null` are slightly different here similar to `f.bind`.
This uses the new built-in progressive enhancement features of React.
These always use `multipart/form-data` atm. When one comes in that's not
a fetch, we can use `decodeAction` to get a resolved function.
This also ensures that we can test this by passing disableJavaScript to
tests. This disables JS for the context.
Fixes#49055, fixes#48918.
App dir will always require the server to run in the workers mode, so it
can keep a separate Node.js process for pages. This PR updates the
standalone server to initialize a "standalone server" (which works
similar to `start-server`), and changes the tracked files to include
Jest worker.
A simple test case to ensure `cookies()` is usable inside App Routes,
based on a prior bug report.
Closes WEB-627
---------
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
### What?
removes the
```
event - startup 3.643ms
```
message
### Why?
no useful information in this message since it's just too fast
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Adds proper `multipart/form-data` handling in the Edge runtime and fixes a bug (previously we are always using `serverActionsManifest.node`). For the form data, we just use `await webRequest.request.formData()` for now and will handle streaming later.
Fixes#48948
([repro](https://github.com/vercel/next.js/issues/48948#issuecomment-1533542001)).
When running inside a custom server with app dir, we should always opt
into the prebundled React with correct channels.
Thanks @karlhorky for help testing it!
Fixes#49169 too.
---------
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
We have reports of users scrolling down the the bottom to copy/paste `domains` configuration, instead of using the safer `remotePatterns` configuration at the top.
This PR collapses the older `domains` configuration behind a details toggle since it is only needed for older versions of Next.js prior to 12.3.0
This makes sure that we are treating a module as in the server layer, if
it's under the client layer but with file-level `"use server"`. Also
makes sure we're catching errors like having both `"use server"` and
`"use client"` directives presented.
## For Contributors
I know it's an unstable api but this just makes it easier to test with.
This uses the type of the callback to `unstable_cache` as the return
type of `unstable_cache`.
See https://github.com/vercel/turbo/pull/4776
This adds support for:
* Default and custom global app 404 pages (`app/not-found`).
* Segment-level 404 pages (`app/segment/not-found`).
This also updates Turbopack:
* https://github.com/vercel/turbo/pull/4787 <!-- Tobias Koppers -
Bugfixes for free var and binding replacement -->
* https://github.com/vercel/turbo/pull/4789 <!-- Alex Kirszenberg -
Print a warning when importing Sass files -->
* https://github.com/vercel/turbo/pull/4776 <!-- Alex Kirszenberg -
Leave pathname formatting up to the caller -->
* https://github.com/vercel/turbo/pull/4790 <!-- Tobias Koppers - remove
inital compilation message by default -->
## TODO:
- [ ] ~~The dev overlay shows up when `notFound()` is called, it should
be hidden~~ (moved to WEB-980)
- [ ] ~~Navigating to the global 404 page doesn't work~~ (this is a bug
in Next.js, see NEXT-963)
- [x] Tests.
---------
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
There was a bug reported in https://github.com/vercel/next.js/issues/42991#issuecomment-1532967037 that would hang on load.
After investigation, I noticed that it was because the cache node never applied the flight payload. It was because the requested flight payload was too deep into the tree whereas it should have been fetched from higher up in the tree because we specifically discarded that branch of the tree because it was stale.
When using the `not-found.js` file to match missed routes, `serverCSSForEntries` will always be empty as the `ComponentMod.pages` itself doesn't contain any actual entry. We need to handle that as a special case.
Closes#48133.