- 02 Oct, 2024 14 commits
-
-
vercel-release-bot authored
-
Steven authored
Since `images.localPatterns` config can be undefined, we need to support that when emitting `images-manifest.json`. - When `undefined`, all local images are allowed - When `[]`, no local images are allowed Note this is different than `remotePatterns` since it treats `undefined` and `[]` the same (the default being no remote images are allowed).
-
Joseph authored
### What? Small type tweak, asked for in https://github.com/vercel/next.js/discussions/70443 ### Why? The `alt` prop is required on the call to `getImgProps`, and the implementation, returns it back to the caller, however, the type signature of the return type for `getImgProps`, omits the `alt` prop, which means that users have to manually apply the `alt` prop. That is to say, that in this example, tweaked from the docs: ```jsx import { getImageProps } from 'next/image' export default function Page() { const common = { alt: 'Theme Example', width: 800, height: 400 } const { props: { srcSet: dark }, } = getImageProps({ ...common, src: '/dark.png' }) const { props: { srcSet: light, ...rest }, } = getImageProps({ ...common, src: '/light.png' }) return ( <picture> <source media="(prefers-color-scheme: dark)" srcSet={dark} /> <source media="(prefers-color-scheme: light)" srcSet={light} /> {/* the alt prop is here, but as far as TypeScript is concerned, it is not */} <SomeCustomImageComponent {...rest} /> </picture> ) } ``` So users have to do: ```jsx <SomeCustomImageComponent {...rest} alt={common.alt} /> ``` See more at, https://github.com/vercel/next.js/discussions/70443 ### How? Remove `alt` from the Omit union. ```tsx export type ImgProps = Omit<ImageProps, 'src' | 'alt' | 'loader'> & { /* other stuff */ } ``` Fixes https://github.com/vercel/next.js/discussions/70443
-
Sebastian Markbåge authored
This has long been a misnomer since it's not just used for static generation but it's the outer context of all the "Work" we're currently doing. A follow up will merge the other contexts into a "WorkUnitStore".
-
Jiachi Liu authored
-
Josh Story authored
viewport will never be streaming because is necessarily blocks important shell time rendering with things like themeColor and viewport size. Most other metadata can be streamed in if we're not serving an agent which doesn't construct a DOM. This change doesn't actually make metadata streaming but it does further separate the two so we can more easily alter the rendering characteristics of metadata without affecting viewport. The approach is to ensure the metadata component creation is in the react-server layer in the server module graph so it can access `React.cache`. then we construct a pair of functions that can produce the resolved metadata and viewport values, throwing if there is an encountered error. We suppress these errors in our top level metadata component (MetadataRoot) and and simultaneously expose a ready function which calls these (`React.cache()`'d) functions in the Metadata outlet where any errors will throw. This cleans up the layering quite a bit and makes some runtime error checks unecessary such as ensuring you rendered the MetadataRoot before attempting to determine if the metadata was resolved. The key thing achieved here though is that Metadata and Viewport now resolve in parallel but separately. We avoid double walking the module graph by again making use of `React.cache()`. In the future we can render each of these components differently without affecting each other. This work is motivated more immediately by some error tracking work I will land after this that needs to determine whether viewport or metadata were dynamic independently. There is one semantic difference worth calling out. Previously if you called `notFound()` in `generateMetadata()` or `generateViewport()` both would render the appropriate not found metadata/viewport. In this latest update only the one that called notFound will update to reflect the notFound metadata/viewport. I think fundamentally the approach to handling notFound needs to change here. Really we should be abandoning the render and starting over. This will be doubly important once metadata is streaming. I'm ok with the edge case as is given customizing viewport is not very common and calling notFound from within generateViewport is expected to be an edge case of an edge case. The workaround for now is to call notFound simultaneously from both generateViewport and generateMetadata
-
vercel-release-bot authored
-
Sebastian "Sebbie" Silbermann authored
-
Janka Uryga authored
Fixes some broken tests from #68333. They were skipped, but still crash in `start` mode, because they try to use `useActionState` and crash during prerendering (because 18 doesn't have that). We turn those pages into noops instead -- the tests that use them are skipped anyway.
-
Sebastian "Sebbie" Silbermann authored
-
Sebastian "Sebbie" Silbermann authored
-
Tobias Koppers authored
### What? * round chunk item sizes to cause less changes to chunking * pick individual values from compile time info to avoid invalidating on change * pick next config keys for more granular caching * split completions into a tree --------- Co-authored-by:Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
マルコメ authored
# Summary Remove redundant html element and css. Add alt text to images. Both old and new README.md have the same appearance. ## Description I changed some parts. ### 1. Insert `align="center"` into only top `<div>` tag The all of logo, title, and badges are center. Then it doesn't need to call at every element. ### 2. Move `<h1>` tag outside `<a>` tag The title doesn't have link even if inside `<a>` tag when it's wrapped heading element. So put it out for the readability. ### 3. Use image alt text instead of aria-label Alt text is displayed on the page if the images can't be loaded. That's why I prefer alt text to aria-label. In addition, the screen reader still reads the same words after updating. ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide x-ref: [\<img>: The Image Embed element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) | mdn web docs --------- Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Janka Uryga authored
This PR adds support for using Form with pages dir. The functionality is a bit limited: - in pages dir, Form doesn't prefetch, because there's no notion of an instant loading state that we could prefetch - No support for server actions - pending indicators from `useFormStatus` do not work while navigating to the target page (planning to address this in https://github.com/vercel/next.js/pull/70681) But other than those things, Form should work. Both of these patterns are supported: - `<Form action="/foo/bar">` - `<Form action={clientAction}>` (if using a react version with `useActionState`)
-
- 01 Oct, 2024 21 commits
-
-
vercel-release-bot authored
-
JJ Kasper authored
As previously discussed we've talked about ensuring this `stale-while-revalidate` can be consumed by CDNs by default which means we need to have a default SWR delta so this defaults to one year although it can still be customized via the `swrDelta` config. One gotcha with this is users when testing locally with `next start` or there is no CDN consuming the header browsers will consume the header. This gotcha is worth the change as it can be configured and most proper setups should be behind a CDN to consume this header.
-
Sebastian "Sebbie" Silbermann authored
-
Sam Ko authored
## Why? There is no mention of how App Router uses hover for prefetching (`null`, and `true`). There is only a mention of hover for the `false` state. --------- Co-authored-by:Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
Steven authored
This adds support for `images.localPatterns` config to allow specific local images to be optimized and (more importantly) block anything that doesn't match a pattern.
-
Jiachi Liu authored
-
Zack Tanner authored
This provides information to the initial SSR render that the client leverages when seeding the prefetch cache, to determine if a page was a fully static prerender. The side effect of not doing this is that if we seeded a static page during SSR, and then navigated to it, the router would make a request for data that it didn't need. In other words, it didn't honor the static staletime, like other navigations would.
-
マルコメ authored
# Summary Add `aria-label` to static indicator button for accessibility ## Description Some browser reports `Buttons must have discernible text: Element has no title attribute` for the static indicator button. Then insert `aria-label="Hide static indicator"` s-ref: [Buttons must have discernible text](https://dequeuniversity.com/rules/axe/4.4/button-name?application=axeAPI) Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
マルコメ authored
## Description [with-google-analytics example](https://github.com/vercel/next.js/tree/canary/examples/with-google-analytics) was updated for App Router at #66021. So remove an old pages path. ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide --------- Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
hrmny authored
### What? The normal file watcher doesn't work inside a docker container, the workaround is to enable a polling file watcher, which was supported in webpack but not turbopack so far. This PR adds support for a polling file watcher to turbopack and a `next.config.js` option to configure the polling file watcher for both webpack and turbopack. Unfortunately, the rust file watcher seems to be a lot slower than the poll interval. Closes PACK-3206 Fixes #68255
-
Sebastian "Sebbie" Silbermann authored
-
Zack Tanner authored
By default we are storing the seeded prefetch entry (from the SSR render) as an "auto" prefetch. The prefetch cache is used because every navigation checks against the prefetch cache to determine if it has the necessary data to render the requested segment(s). We have a router heuristic that will re-fetch a page that's already in the prefetch cache if the one that is stored is an "auto" prefetch, and the newly requested prefetch is a "full" prefetch. This is because the assumption is the "auto" prefetch would contain partial data (potentially only `loading.js` data) while the "full" prefetch has everything, so we'd want to replace the cache entry with the most up to date information. Currently when we seed the prefetch cache with the initially SSRed page, we set a cache status of "auto". This is because a "full" prefetch has staleTime implications: a full prefetch will be client cached for 5 minutes by default (the `static` staleTime), and since we have no prefetch intent during SSR, we should fallback to the automatic caching heuristics to avoid caching a page longer than what was intended. However, this will trigger the above mentioned logic to switch to a "full" prefetch if the page you're currently on has a link to itself, with `prefetch={true}`, resulting in a wasted request. This refactors the logic responsible for switching a prefetch entry to a "full" prefetch only once we confirm the response payload from the existing cache entry wasn't a response that started rendering from the root. If we started rendering from the root, we know that we have the full data already, so it'd be wasteful to fetch again. Fixes #70535 -
Hendrik Liebau authored
In a pathname for an intercepting route, a dynamic path param might occur multiple types, e.g. `'/[locale]/example/(...)[locale]/intercepted'` (for `[locale]/example/@modal/(...)[locale]/intercepted/page.tsx`). We need to make sure that each occurence is replaced with the actual value during interpolation. The handling of such pathnames is already done correctly in the Node.js runtime, but not in the Edge runtime. fixes #70654
-
Niaz Morshed Nayeem authored
Co-authored-by:
マルコメ <akio.muto@bnt.benextgroup.jp> Co-authored-by:
Jiachi Liu <inbox@huozhi.im>
-
Sebastian "Sebbie" Silbermann authored
We now ask for all input in a single phase at the beginning followed by a single phase of long running tasks that processes this input. Interleaving is unintuitive and may leave the process hanging if people tab out when the install takes more than a few seconds.
-
Niklas Mischkulnig authored
Closes PACK-3244 Closes https://github.com/vercel/next.js/issues/69562 Await the module in both environments (SSR/browser), if it's async in at least one of them. We can't and don't want to make the browser module async (artifically) if the SSR module is async (due to ESM externals). The only concern regarding `async` not always being true in the manifest was that we don't want to await in non TLA cases (e.g. CJS exporting a promise, etc...). But the SSR module being ESM with TLA and the browser module being CJS with a Promise export is exceedingly unlikely.
-
Tim Neutkens authored
The test assumed a certain path for chunks. Changed it to get the files from the served page, making sure that regardless of chunking it's checking the right files for the requested route. <!-- 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 # -->
-
Vaibhav Sharma authored
This PR updates the `environment-variables` example to use the App Router. Here are the changes that have been made: - Created an `app` folder and added `page.tsx` file. - Added `layout.tsx` file - Updated the `readme.md` file. - Updated the `package.json` file. cc : @samcx --------- Co-authored-by:samcx <sam@vercel.com>
-
Wyatt Johnson authored
This enhances the current parsing completed by Next.js of configuration from app segments. Previously a collection of fragile checks was used to parse the different segment configuration options which performed no validation on the inputs. This uses the `zod` library (which we already use internally) to perform validation on the configuration exported. A followup PR #70480 will add more verbose error logging around the validation errors.
-
Vercel Release Bot authored
This auto-generated PR updates font data with latest available
-
Wyatt Johnson authored
Updates some API's so that they aren't calling unsupported Node.js API's while in the Edge runtime.
-
- 30 Sep, 2024 5 commits
-
-
vercel-release-bot authored
-
Vercel Release Bot authored
-
Sebastian "Sebbie" Silbermann authored
next-upgrade: Allow choosing same codemods that are available in the currently used version (#70635)
-
Sebastian "Sebbie" Silbermann authored
-
Sebastian "Sebbie" Silbermann authored
-