- 17 Dec, 2024 40 commits
-
-
vercel-release-bot authored
-
Maciej Kasprzyk authored
### What? Typo in code comment Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
Jiachi Liu authored
Co-authored-by:Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
JJ Kasper authored
This ensures we install Vercel CLI before we start running tests so they aren't attempted to be installed during each test run which are done in parallel so could have issues from trying to do multiple installs at the same time. x-ref: https://github.com/vercel/next.js/actions/runs/12381595565/job/34560897615
-
Will Binns-Smith authored
This: - Changes `ChunkItem`’s `references` implementation to only allow items to reference `OutputAssets` - Implements a default `references` that returns an empty set of output assets - Updates logic for using these output assets in `make_chunk_group` - [x] Moves logic for using the inner module’s references into areas that need it --------- Co-authored-by:
Tobias Koppers <tobias.koppers@googlemail.com> Co-authored-by:
Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
Hendrik Liebau authored
> [!NOTE] > This PR is best reviewed with hidden whitespace changes. Support for setting [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) attributes on app router scripts was added in https://github.com/vercel/next.js/pull/39729. But this only covered pages using the Edge Runtime. With this PR, we're adding support for app pages using the Node.js Runtime. The only change that's needed for that, and which was probably just an oversight in the original PR, is reading the generated manifest file in `loadComponents`. In a follow-up we should also add support for adding the `integrity` attribute to client component chunks that are injected into the head during server-side rendering, but that needs a change in React first. fixes #66901
-
Wyatt Johnson authored
This improves the locale normalization method used in several looping functions. This caches the lowercasing of locales so the operation is only performed once. It also duplicates the logic from the `I18nProvider` for the more efficient locale handling. <!-- 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 # --> --------- Co-authored-by:
Hendrik Liebau <mail@hendrik-liebau.de>
-
Jam Balaya authored
## Description Follow up #72465. Update [`next-config-js` document](https://nextjs.org/docs/canary/app/api-reference/config/next-config-js) URL. ### Before https://nextjs.org/docs/api-reference/next-config-js ### After https://nextjs.org/docs/api-reference/config/next-config-js ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md CC: @samcx Co-authored-by:
Sam Ko <sam@vercel.com>
-
vercel-release-bot authored
-
Benjamin Woodruff authored
Fixes: ``` error: environment variable `CI` not defined at compile time --> crates/napi/src/next_api/utils.rs:130:59 | 130 | let dirty_suffix = if crate::build::GIT_CLEAN || !env!("CI").is_empty() { | ^^^^^^^^^^ | = help: use `std::env::var("CI")` to read the variable at run time = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) error: could not compile `next-swc-napi` (lib) due to 1 previous error ``` -
Wyatt Johnson authored
To improve memory efficiency, this marks all the locale arrays as readonly. This ensures that there's no undefined behaviour from accidentally mutating the array, and allows us to use the locales array as a stable reference for a future optimization PR.
-
vercel-release-bot authored
-
Wyatt Johnson authored
Routes that contain dynamic root segments (those where the root parameter is not known at build time) should not have shells generated. This is because today there's no way to revalidate the shell for that page and it would cause cache posioning.
-
vercel-release-bot authored
-
Tobias Koppers authored
### What? crate level caching caused a Persisting Caching bug when upgrading the next.js version. This moves the version info to the top-level crate to avoid this issue.
-
Wyatt Johnson authored
In order for the root parameters to be added to the cache key within Vercel, we need to include the `rootParams` in the `prerender-manfest.json`. <!-- 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 # -->
-
Andrew Clark authored
Originally I gated per-segment prefetch generation on the PPR flag, because I thought the client Segment Cache would require PPR to be enabled on the server. However, since then the strategy has evolved and I do think we can roll out the Segment Cache independently of PPR. Dynamic pages without PPR won't be able to take full advantage of the Segment Cache, but if the page is fully static then there's no reason we can't implement all the same behavior. So during per-segment prerendering, I've changed the feature condition to check for the `clientSegmentCache` flag instead of the PPR one. --- Additionally, when I broadened the feature check, a failing test revealed that I neglected to set up error digest decoding correctly, so the first commit in this stack fixes that.
-
Andrew Clark authored
It doesn't look like this argument is logically needed. No callers pass it as an option except for the recursive call, and the recursive call will never set it to `true` because of the `renderComponentsOnThisLevel` branch that happens earlier in the function. I'm guessing it was needed at one point but then the logic changed.
-
Wyatt Johnson authored
When partial prerendering is enabled, this enables a build time error that prints when there are no root params provided using `generateStaticParams`. This ensures that we're able to test the code around invocations of `rootParams()` for other dynamic usage. <!-- 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 # -->
-
Wyatt Johnson authored
This enables the generation of partial shells when using with partial prerendering, aided by the new `rootParams()` API. Essentially, when your application only returns partial routes (where not all the route parameters are known), Next.js will now build route shells for these pages. We call these shells, fallback shells. They represent the partial state of the page that once served to the user, will provide a more complete loading experience as fast as possible. We'll also take every permutation of the provided root params and generate a shell just for them to ensure that any future calls to those routes will be able to use the more specific fallback shell that's generated rather than having to rely on a blank shell by default.
-
Andrew Clark authored
When I originally set up the Segment Cache transport types, I had the notion that the client should never have to compute the request key that is sent to the server. That way we could, say, encrypt the keys on the server to make them unguessable. But once we added the concept of access tokens for that purpose, this motivation was gone. The remaining motivation was to keep the contract as simple as possible. However, there's a lot of existing code that relies on manipulating the "decoded" form of the segment values. Since we're sending the full segment value anyway, it's wasteful to also send the encoded form, given that it can be trivially re-derived by the client. My immediate motivation is that, I need to be able to construct a cache key from a FlightRouterState. As a bonus, this will also get us closer to being able to remove the dynamic param values from the server response, a separate goal that we're currently working on. We can revisit this once if/when we're able to remove the existing cases where the full segment is needed by the client.
-
Jiwon Choi authored
Following of https://github.com/vercel/next.js/pull/74017#discussion_r1888652701. This PR removed unused file from dev overlay: `GroupedStackFrames.tsx`.
-
Wyatt Johnson authored
Modifies no code, just moving files around to simplify the upstream review. <!-- 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 # -->
-
Andrew Clark authored
This is a small refactor to allow creating a cache empty entry without also triggering a server request. Currently these are combined into the same phase, because there's no case where one operation happens without the other. However, I need to implement additional prefetching strategies. For example, sometimes a segment's data will already be available as part of a different server response. To support this, I've split the Pending CacheStatus into two separate fields: - Empty: The cache entry has no data, and there's no pending request to fetch it. - Pending: The cache entry has no data, and there _is_ a pending request to fetch it. This is a refactor only, so there should be no change to external behavior.
-
Sebastian "Sebbie" Silbermann authored
-
Niklas Mischkulnig authored
The client reference manifest has to contain all client references for all layout segments. Currently it just contains all client references but they are attributed to the first server component that uses it. Reverts the approach of https://github.com/vercel/next.js/pull/73322 and use the old implementation again
-
Vercel Release Bot authored
-
Rich Haines authored
-
Steven authored
We currently bypass svg and animated images because vector doesn't need to be rasterized and animated will turn to still. However, there are other image types that we implicitly bypass once sharp throws an error message and we catch it here: https://github.com/vercel/next.js/blob/7d1ee4ff209d369d8cfce9ec2d00252cc1b8876f/packages/next/src/server/image-optimizer.ts#L798-L815 We already have existing tests for this behavior here: https://github.com/vercel/next.js/blob/9435b7b9602136aeac77f5ff55bb553dcaa2b01a/test/integration/image-optimizer/test/util.ts#L201 This PR bypasses early so we can avoid sending the buffer, waiting for it to throw the error, and then catching the error. Also note this uncovered some discrepancies in how we handle the max age cache-control so this unifies the behavior.
-
Janka Uryga authored
excludes: - entrypoint templates: it never makes sense to import from these (they're not even complete modules!) but they reexport many things, so they keep popping up as a suggested source - `some-async-storage-instance`: we should always use `some-async-storage.external` instead
-
Jiwon Choi authored
Clean up `react-dev-overlay/` before forking for new UI. - Ported `pages/ReactDevOverlay/tsx` logic to a hook. - Moved `client-entry.tsx` to `app/` as it's only used in app router. Closes NDX-590
-
Abhishek Y authored
### What? Change 1: At line 107, the regex code is now fixed to replace all "-" with "+", which wasn't as expected with previous code, window.atob() would throw an error saying the string is not encoded properly. The variable base64 will now have a URL safe base64String. Change 2: At line 177 and 178, the function is now updated to call the server action subscribeUser() with a serialized object instead of a PushSubscription object, as server actions can only be called with serialized objects. ### Why? I followed to docs to setup a PWA project with next, and I encountered issues with the code mentioned in the documentation. ### How? The fixed code snippets will work as expected, and anyone following the docs later can find them helpful. --------- Co-authored-by:
Lee Robinson <me@leerob.io> Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Jam Balaya authored
## Description The page which provided [link](https://nextjs.link/with-turbopack) goes to has [a different URL](https://nextjs.org/docs/architecture/turbopack). It's inconvenience and I update the path. Co-authored-by:
Sam Ko <sam@vercel.com>
-
マルコメ authored
## What? Remove below 2 lines from [`with-orbit-components` README.md](https://github.com/vercel/next.js/blob/canary/examples/with-orbit-components/README.md). ```md For this purpose we are extending `<App />` of injected `<ThemeProvider/>`, and also adding `@kiwicom/babel-plugin-orbit-components`. This fork comes from [styled-components-example](https://github.com/vercel/next.js/tree/canary/examples/with-styled-components). ``` ## Why? At #73266, Both `<ThemeProvider/>` and `@kiwicom/babel-plugin-orbit-components` were deleted. In addition, [styled-components](https://styled-components.com/) isn't used anymore. ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md
-
Sahil authored
There was small typo issues in the doc which is now fixed Co-authored-by:Sam Ko <sam@vercel.com>
-
Jam Balaya authored
## What? Delete Notes on `next/link` in the [`with-styled-components`](https://github.com/vercel/next.js/tree/canary/examples/with-styled-components) example. ## Why? [`as`](https://github.com/vercel/next.js/blob/v9.5.2/docs/api-reference/next/link.md#dynamic-routes) prop of `next/link` is no longer required at [v10.0.0](https://nextjs.org/docs/app/api-reference/components/link#version-history) Next.js. Therefore, the [as](https://styled-components.com/docs/api#as-polymorphic-prop) prop provided by `styled` doesn't collide with the `next/Link`'s `as` prop. CC: @samcx ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.mdCo-authored-by:
Sam Ko <sam@vercel.com>
-
PapatMayuri authored
This PR updates the with-orbit-components example for using the App Router. Here are the changes that have been made: - I renamed the `pages` folder and moved it to the `app` folder. - Added the layout.tsx file as part of the App Router. - Updated the package.json file. CC: @samcx --------- Co-authored-by:Sam Ko <sam@vercel.com>
-
マルコメ authored
## What? Update examples `.gitignore` files for parity with [Yarn's official recommendations](https://v3.yarnpkg.com/getting-started/qa#which-files-should-be-gitignored), accounting for Yarn's modern Plug-n-Play functionality. ## Why? New projects initialized with `create-next-app` presently add various extraneous files from the Yarn cache to the initial commit. This is most notable in the case of the Next SWC binary, which may exceed 100M in some environments (empirically, 64-bit Darwin and WSL2 Ubuntu, and very probably other unix/linux environments), and prevent users from pushing their new projects to free GitHub repositories without rewriting the commit history to exclude the extraneous files, or unnecessarily setting up Git LFS to include them. ## How? I have errored on the side of exclusion to enable users to push their CNA projects to GitHub as-is and for parity with other package managers, while still providing the opportunity to opt in to additional functionality provided by modern Yarn. These changes follow the recommendations for **non**-[Zero-Install](https://yarnpkg.com/features/caching#zero-installs) configurations, as Zero-Install functionality is an extension on top of the base package manager experience, and may necessitate additional configuration and present additional complications for unsuspecting users, so I think it's best left up to the user to opt-in. On account of the majority of publicly available Next.js-based projects comprising general consumer-facing websites, it is my belief that the majority of Next projects would not benefit from Yarn's Zero-Install functionality, and that explicitly facilitating it by default would break status quo with all other non-Yarn CNA projects. Contrary to the example `.gitignore`s provided by Yarn, I've excluded the `.yarn/sdks` directory as it contains IDE-specific tooling; I feel it would be presumptuous for an environmentally-agnostic tool to target and provide package-manager-specific tooling for specific editors. This too should be left to the user to opt-in to and provide for their project if they deem necessary. I have retained the current `.gitignore`'s exclusion of the `/.pnp` directory for backwards compatibility with older versions of Yarn (the files therein have since been reallocated to the `.yarn` directory addressed by these changes, but I am not clear on when that delineation occurred or the prevalence of Yarn installations which depend on the former convention). Maintaining the exclusion here, in the worst case, implies additional downloads (on an order of magnitude merely similar to using npm from the outset) rather than failure. CC: @samcx ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.mdCo-authored-by:
Sam Ko <sam@vercel.com>
-
suu3 authored
<!-- 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 Closes NEXT- Fixes # --> ### What? - `with-google-maps-embed` example - `with-google-tag-manager` example - `with-youtube-embed` example ### Why? The examples are written in JavaScript. ### How? Converted JavaScript examples to TypeScript. --------- Co-authored-by:
samcx <sam@vercel.com>
-
Jude Gao authored
-