Updating the URL to a place customers can learn about the capabilities available within Amplify (vs the docs).
Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Fun! This depends on https://github.com/vercel/turbo/pull/4251 to
implement streamed Node evaluations, giving us the ability to support
streamed middleware responses.
This is just the first step to supporting RSC streaming in Turbopack. I
chose to start with this because it requires all the same base logic,
and I understand the full router->middleware->HTTP server code path, so
it's a lot easier to work on.
Fixes WEB-738
This PR refactors the types plugin a bit and adds support for optional match groups in rewrites and redirects:
```js
source: '/redirect(/v1)?/guides/:param/page'
```
Which will be created as two rules:
```ts
| `/redirect/guides/${SafeSlug<T>}/page`
| `/redirect/v1/guides/${SafeSlug<T>}/page`
```
fix NEXT-875 ([link](https://linear.app/vercel/issue/NEXT-875))
This PR continues the work of #45867, that treats the root-level `not-found.js` file inside app dir as the global 404 page, if it exists. Previously, it fallbacks to the /404 route inside pages (and the default one if `404.js` isn't specified).
In the implementation, we include `/not-found` in `appPaths` during the build, and treat it as the special `/404` path during pre-rendering. In the renderer, if the `/404` pathname is being handled, we always render the not found boundary.
And finally inside the server, we check if `/not-found` exists before picking up the `/404` component.
A deployed example: https://not-found-shuding1.vercel.app/balasdkjfaklsdf
fix NEXT-463 ([link](https://linear.app/vercel/issue/NEXT-463))
Default tags of `charset` and `viewport` should also be rendered in app
router error pages like not found pages.
Closes NEXT-869
This PR:
* Extract not found boundary to single component
* Add the default tags to `NotFoundErrorBoundary` rendering
* Fix duplicated `noindex` tag for streaming error rendering
This ensures the build spinner is correctly stopped in a TTY environment
and also adds regression tests for `app` and `pages` to ensure this
behaves as expected.
This updates our docker image to use the `jammy` tag instead of `focal`
to match the Ubuntu version to our CI.
Reverts vercel/next.js#47372
```
Error occurred prerendering page "/apple-icon". Read more: https://nextjs.org/docs/messages/prerender-error
Error: The `ImageResponse` API is not supported in this runtime, use the `unstable_createNodejsStream` API instead or switch to the Vercel Edge Runtime.
at new ImageResponse (/tmp/next-install-db63e2a2f25e9feda48affa69456fcbdde8d89bf94645e42abd2aa522224f432/.next/server/chunks/558.js:26416:19)
at appleIcon (/tmp/next-install-db63e2a2f25e9feda48affa69456fcbdde8d89bf94645e42abd2aa522224f432/.next/server/app/apple-icon/route.js:127:12)
```
https://github.com/vercel/next.js/actions/runs/4490842502/jobs/7899302486#step:6:305
Allow image responses returning from dynamic image routes for og/twitter
images, and icon/apple-icon images. This PR supports the basic
functionalities for nodejs runtime of image routes. `@vercel/og` is able
to be leveraged for generating dynamic image responses.
Close NEXT-264
Close NEXT-266
---------
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Move span wrapping rendering closer to the user code and don't add
span when we have cache-hit
- Add `getStaticProps` span
- Add spans around API handlers (pages and app)
- Add `generateMetadata` span
- Clarify naming that we use `page` for entrypoints like
`/path/[param]/page` or `/path/[param]/layout`. And `route` for
`/path/[param]`
fix NEXT-857 ([link](https://linear.app/vercel/issue/NEXT-857))
### What?
Adds `useParams` to read the canonical parameters.
```tsx
'use client'
import { useParams } from 'next/navigation'
export default function Page() {
const { id } = useParams()
return (
<div>
<div id="param-id">{id}</div>
</div>
)
}
```
### Why?
Allows for accessing segment parameters for the entire page.
### How?
It uses a similar resolving of `useSelectedLayoutSegments` which resolve `children` and if `children` is not available the first available parallel route instead.
Closes NEXT-99
### What?
Adds the error boundary used to catch `redirect()` above the root
layout.
### Why?
Currently calling `redirect()` in the root layout causes `NEXT_REDIRECT`
to bubble up to the error boundary because we didn't have a
redirect-boundary above the place where the root layout is rendered
client-side.
### How?
- Moved redirect-boundary into a separate file
- Added redirect-boundary around the `cache.subTreeData` in app-router
(around the root layout)
fix NEXT-315 ([link](https://linear.app/vercel/issue/NEXT-315))
Fixes#42556
I've verified the reproduction shown in #42556 has been fixed earlier,
there was another report about calling `redirect()` in the root layout
and that's what this PR fixes.
Since that issue has many comments here's some additional context:
- `redirect()` can only be called during React component rendering.
- This means you can't run `redirect()` in `onClick` or `useEffect()`
handlers.
- Calling `redirect()` in a server component or during prerendering of
client components it will add the right meta tag to trigger a redirect
- `<meta httpEquiv="refresh" content={`0;url=${redirectUrl}`}>`
- Because of streaming rendering by the time your code runs the browser
will have already received the start of the stream and headers will have
been sent, as such you can't modify the headers, hence why the meta tag
is used instead of `location`.
- Calling `redirect()` in client components is supported while
rendering, e.g. if you have a condition:
```tsx
'use client'
import { useState } from 'react'
import { redirect } from 'next/navigation'
export function ClientComponent() {
const [clicked, setClicked] = useState()
if(clicked) {
redirect('/another-page')
}
return <>
<button onClick={() => setClicked(true)}>Click to redirect</button>
</>
}
```
<!-- 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 or adding/fixing 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 #
-->
---------
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Skips pages directory warning if there is app directory in the root for `no-html-link-for-pages` lint rule.
Fixes#42448.
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`
## Documentation / Examples
- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
Currently, the client entry loader creates the code of `import {
createProxy } from "private-next-rsc-mod-ref-proxy"` and then we alias
it to the target file. This process is redundant and risky. If the
loader-created code is somehow marked as external (due to the effect of
both our complex external handling and `transpilePackages`), that alias
can't be correctly resolved.
Hence this PR simplifies it by creating the target import path directly
from the loader.
**Note that in the future we should change it directly on the SWC side,
and convert this loader to Rust.**
This reverts #31408, as it also sets the git config value
`index.skipHash` which breaks cargo at the moment:
https://github.com/rust-lang/cargo/issues/11857
Contributors docs have been updated to recommend a shallow clone in
#44158, which should alleviate some of the issues that manyFiles
addresses.
The `exportPathMap` feature has been unofficially deprecated for a long time since introducing `getStaticPaths()`.
For the `app` dir, the same can be accomplished with `generateStaticParams()`.
This PR adds a pretty error when using `exportPathMap` with `app` and updates documentation to reflect the current status.
fix NEXT-836 ([link](https://linear.app/vercel/issue/NEXT-836))
This marks all pages in development as supporting dynamic HTML. Detection for runtime violations of dynamic generation is completed during the production build.
Fixes#46356
fix NEXT-644 ([link](https://linear.app/vercel/issue/NEXT-644))
Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
When using a "use server" module, only exporting async functions is
permitted. However, since we cannot perform static analysis on all
exported value types (e.g., `export const foo = condition ? A : B`), we
have added a runtime ensure function to validate that these are indeed
valid functions.
By implementing this, we can prevent any strange errors like "Can't
access $$typeof of undefined or null" that may arise when exporting
`undefined` or `null` from a server entry. Moreover, this measure helps
avoid any potential mistakes that may occur.
fix NEXT-865 ([link](https://linear.app/vercel/issue/NEXT-865))
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
We shouldn't detect icon/og/etc. metadata image convention as image dynamic routes under `pages/` dir, they should be only apply in `app/` dir. This PR changed the normalization rule that we only apply them when page is from `app/`. So when you're using `icon.js` under `pages/` it won't get effected.
We introduced static route `robots.txt` and dynamic route `robots.js` for metadata, it should still allow users to create their own customized version. This issue is caused by a route conflicts. Only append `/route` to page path when there's not ending with `/route`
Fixes#47198
Closes NEXT-850
- I noticed that on parallel routes, we kept refetching all the time the tree
- this was caused by the HMR ping interval + a mismatch on how we recreated the entrypoint path from the router state, causing the server to always invalidate the parallel route
- this fixes it to respect the format
fix NEXT-860 ([link](https://linear.app/vercel/issue/NEXT-860))
### What?
A fork of https://github.com/github/issue-labeler that we pull in and
maintain.
### Why?
The official issue labeler had some issues which I tried to fix in PRs
and eventually got merged upstream, but the release cycle was a bit
slow, and that GitHub action had many parts we did not really need
anyway. So it makes sense to maintain it ourselves.
### How?
This PR removes the
https://github.com/vercel/next.js/blob/canary/.github/issue-labeler.yml
config file, which in our case is just a sublist of
https://github.com/vercel/next.js/labels anyway. Instead, we can pull in
the labels from GitHub directly and filter out those that we want to
apply to issues. This will keep things more in sync.
fix NEXT-750 ([link](https://linear.app/vercel/issue/NEXT-750))
---------
In preparation for improvements for the runtime support, this changes
the handle signature to _always_ return a response object.
fix NEXT-679 ([link](https://linear.app/vercel/issue/NEXT-679))
When a user exports a default function from a `route.ts` file, they may
think that this would be handled in the same way that our `pages/api/`
routes handled it. App Routes require an exported function for each HTTP
method instead.
This adds warnings to the development console when a user provides a
default export (or no HTTP method at all).
Future ideas:
- Error during production build when these conditions are met
fix#46375
fix NEXT-660 ([link](https://linear.app/vercel/issue/NEXT-660))
---------
Co-authored-by: JJ Kasper <jj@jjsweb.site>
### What?
Async functions can just be return without await.
### Why?
Is just cleaner. Not important and not crucial.
Co-authored-by: JJ Kasper <jj@jjsweb.site>
### What?
- [x] fixes a bug in the CLI with the combination of `--tailwind` and
`--src-dir` flags.
- [x] fixes Tailwind CSS config when `--src-dir` is set
- [x] respect `NEXT_TEST_SKIP_CLEANUP` in test utils
### Why?
`pnpm create next-app@canary --tailwind --src-dir` should not fail.
### How?
We introduced the `app-tw` and `default-tw` templates, so we need to
respect them when working with files (in this case, the CLI was
erroneously assuming that if `template !== "app"` it must be a pages
template.)
I also noticed that the `tailwind.config.js` file need to also respect
`--src-dir` by prefixing the paths in `content`
Fixes#47236
fix NEXT-838 ([link](https://linear.app/vercel/issue/NEXT-838))
Related: #46927, #47276
---------
Co-authored-by: JJ Kasper <jj@jjsweb.site>
### What?
There was a bug with supporting nested routes in the parallel routes
with named slots that made the request hang
### Why?
The request was hanging suspended on the router because the
`next-app-loader` was not finding the layout component and thus, it was
falling back to a component that returned null, tripping a bit of code
in the app router that suspended.
### How?
The fix was to fix the next-app-loader loader tree generation to account
for parallel routes
Closes NEXT-
Fixes #
<!-- 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 or adding/fixing 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 #
-->
fix NEXT-854 ([link](https://linear.app/vercel/issue/NEXT-854))
---------
Co-authored-by: Tim Neutkens <timneutkens@users.noreply.github.com>