- 04 Sep, 2024 2 commits
-
-
vercel-release-bot authored
-
Abhishek Mehandiratta authored
### What? Fixes #69456 which describes an issue with `next/image` component, where an external image containing `_next/image` in the URL fails with the error `"url" parameter cannot be recursive`. ### Why? The `next/image` component should be able to render images from configured hostnames without doing the recursive check. ### How? Before checking for the existence of `_next/image` substring in the image's path, we can simply check if the image is an external URL that comes from a preconfigured host in the `next.config.js` file. Example: <img width="1207" alt="image" src="https://github.com/user-attachments/assets/8d5c99cf-f050-40a9-b5a4-ba961b83f037"> --------- Co-authored-by:
Steven <steven@ceriously.com>
-
- 03 Sep, 2024 24 commits
-
-
hrmny authored
Writes the async flag to the client reference manifest to support ESM externals in app dir. The `app-ssr` context can't have esm externals as that might cause a module to be async in ssr but not on the client. Closes PACK-2967 Fixes #64525
-
Janka Uryga authored
-
Will Binns-Smith authored
This extends #64520 to cover cases where client components originate from node_modules (foreign code). Test Plan: Extended the integration test to cover this Closes #64412 Fixes PACK-3014 --------- Co-authored-by:OJ Kwon <1210596+kwonoj@users.noreply.github.com>
-
Shu Ding authored
This adds an extra `hash_salt` option to the Server Actions transform's `generate_action_id` method which defaults to empty for now (so no actual behavior changes). When set, the salt will be used to prefix the payload.
-
Jiachi Liu authored
-
Jiachi Liu authored
-
Tobias Koppers authored
### What? optimize allocations in server actions transform In one edge case it reduces allocations from 30GB to 4.5MB and time from 760ms to 11ms. ### Why? make it faster
-
JJ Kasper authored
Currently we are only strip all comments properly when `swcMinify: false` is set although the default is to use `swcMinify` which can cause confusion with these two modes not matching comments handling. This updates the default to match comment stripping between the two and also adds an experimental config to allow toggling this regardless of which minifier is being used. x-ref: [slack thread](https://vercel.slack.com/archives/C0676QZBWKS/p1722444791037279) x-ref: NEXT-3642
-
Janka Uryga authored
-
Jiachi Liu authored
Follow up for #67779 , we don't have to generate the edge preview manifest since it's mainly for rendering the preview props and now preview props can be accessed through process env by a util `getEdgePreviewProps()`
-
Janka Uryga authored
-
Janka Uryga authored
-
Jiachi Liu authored
Chnage the way of preview props injection to edge runtime, directly read from env vars of preview props instead of writing to and reading from prerender manifest.js Previously we're trying to make these preview props values become deterministic that we can replace in edge deployment pipeline in #64521 But the way of serializing process env vars in edge runtime is not correct. They'll remain as string "process.env.xxx" in the manifest and also after consumed. This PR fixes that behavior, instead of writing it into manifest, alwyas consuming from process.env.var directly. I created a shared util to access the preview props of edge runtime across all the templates. On draft provider side, we still need to handle dev mode case when preview id is `development-id`, but we already have the cookie, it cannot be aligned with the preview id. So we do a fallback check for dev mode if the cookie is present and preview id is `development-id` then we still treat it as draft mode is enabled. Fixes #52080 Fixes #67075 Closes NEXT-3541
-
Janka Uryga authored
-
JJ Kasper authored
When an application is running in multi-zone API endpoints can have differing draft mode IDs on the same domain so we need to avoid clearing the original when we see a mismatch as that can break the current applications draft mode. This is behind a flag initially to validate but it should be safe to make the default in the future as an invalid draft mode ID just gets ignored. x-ref: [slack thread](https://vercel.slack.com/archives/C052BQ8F9EJ/p1723844164102539)
-
Tim authored
### What? In draft mode, as of right now, `unstable_cache` does not read from the static store, but still write to it. This leads to the following scenario: 1. Content Editor enters draft mode to test his content 2. Content Editor skips cache and reads preview data 3. Preview data is written to store 4. Random user without draft mode receives preview data until cache is revalidated again ### Why? There's an early exit before reading from the cache - the new result is written to the cache nonetheless though. ### How? New result is only cached if draft mode is disabled. Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
* Extract `buildId` and server action encryption key into environment variables for edge to make code more deterministic * Fixed the legacy bad env names from #64108 * Always sort `routes` in prerender manifest for consistent output * Change `environments` to `env` in middleware manifest, confirmed with @javivelasco this is a fine change without need to bumping the version Dynamic variants like `buildId`, SA `encryptionKey` and preview props are different per build, which results to the non determinstic edge bundles. Once we extracted them into env vars then the bundles become deterministic which give us more space for optimization Closes NEXT-3117 Reverts vercel/next.js#65425 Co-authored-by:Jiachi Liu <inbox@huozhi.im>
-
JJ Kasper authored
This ensures we don't include the entire prerender-manifest in edge runtime as it's un-necesary and can be very large. We only need the preview field in this manifest so this ensures we just include that. x-ref: [slack thread](https://vercel.slack.com/archives/C0289CGVAR2/p1713904966662599?thread_ts=1713798297.067699&cid=C0289CGVAR2) Closes NEXT-3212
-
Wyatt Johnson authored
Manifests in the runtime should be treated as immutable objects to ensure that side effects aren't created that depend on the mutability of these shared objects. Instead, mutable references should be used in places where this is desirable. This also introduces the new `DeepReadonly` utility type, which when paired with existing manifest types, will modify every field to be read only, ensuring that the type system will help catch accidental modifications to these loaded manifest values as well. Future work could eliminate these types by modifying the manifest types themselves to be read only, only allowing code that generated them to be writable. Closes NEXT-3069
-
Wyatt Johnson 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 ### What? ### Why? ### How? Closes NEXT- Fixes # --> ### What? This creates a new `SharedRevalidateTimings` type that is safe to share amongst different points within the framework for sharing revalidation timings. This is a precursor to #64313 which freezes loaded manifests. ### Why? Using the `SharedRevalidateTimings` type, we no-longer have to modify the in-memory instance of the prerender manifest to share the revalidation timings for different routes. Closes NEXT-3083
-
Janka Uryga authored
-
Janka Uryga authored
-
Janka Uryga authored
-
Janka Uryga authored
-
- 02 Sep, 2024 14 commits
-
-
OJ Kwon authored
### What this was the way we run ci on turbopack's repo and to get the latest test results, which isn't required anymore.
-
JJ Kasper authored
Noticed while testing turbopack version of tests that we weren't loading the correct swc binary since this path wasn't absolute and was just the relative path in `node_modules`. --------- Co-authored-by:Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
Tim Neutkens authored
Before: 25.71s  After: 11.05s (-57%)  Currently the system for isolation looks like this: - Copy `packages` folder to an isolated directory - Run `pnpm pack` for all folders in `packages` - Collect the pack files, add them as `dependencies` in package.json of the isolated application - Run `pnpm install` Because the `next-swc` (Turbopack + SWC, yes we still need to rename the package) binary file is quite large in development (900MB+) it means we have to copy, then zip (pnpm pack), then unzip (pnpm install) that binary, which takes about 3+ seconds in each step. The change in this PR is to skip the copy/zip/unzip completely by providing the folder path for the binary directly to Next.js, as it's a binary we don't need the special isolation for this, it's already standalone so running it directly allows us to skip 14,6 seconds of work that is required for each isolated test in development. This will likely have little effect on CI times as we already do some tricks like only running the packing at the start of the CI process. Only thing that could be better and is probably worth doing is adopting this change for the time it saves for unzipping, that's almost 4 seconds per test still. <!-- 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: - 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 - 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 - 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 - 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 - 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 # --> Closes NEXT-3200 --------- Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Tim Neutkens authored
## What? In the past folks on the team have reported that anytime the SWC / Turbopack binary changes they had to suddenly run `pnpm build-native` in `packages/next-swc`, even though they didn't build from source before. While investigating optimizing packing for tests I found that it's copying the native binary into the original repository not the temporary repository, which then keeps the file there, even after the tests finish. This fixes the path to use the tmp repository instead. <!-- 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 # --> Closes NEXT-3157
-
Maikel authored
Add support for the `fb:app_id` & `fb:admins` meta tag in the generateMetaData function --------- Co-authored-by:
Sam Ko <sam@vercel.com> Co-authored-by:
Jiachi Liu <inbox@huozhi.im>
-
Jiachi Liu authored
### What Collect static metadata icons from the most leaf node in the component tree, and then add them into resolved metadata icons if there's no icons presented in exported metadata ### Why Previously we collected the icons from the last item from collected metadata items as last segment in the tree. But it doesn't act like that when there's parallel routes, so we collect the last presented static metadata icons from the metadata item list and then merge into the resolved metadata at the end. Fixes #68650
-
Jiachi Liu authored
### What Support merging the static metadata file conventions `favicon.ico` with other customized metadata icon from the module export. ### Why `favicon.ico` should be displayed everywhere as it's the icon representative of the website for all pages. Any customized `icon` in metadata export `export const metadata` or `export function generateMetadata()` shouldn't override the `favicon.ico` file convention. Fixes #55767 --------- Co-authored-by:hrmny <8845940+ForsakenHarmony@users.noreply.github.com>
-
Jiachi Liu authored
### What Change the metadataBase missing warning for all cases to only warn in standalone mode or the non-vercel deployment. ### Why In vercel deployments, previous concern was that you might not discover you missed that metadataBase when you deploy. But now we have sth fallback on production deployments. So we only need to warn in non-vercel deployment. Standalone is usually for self-hoist, we always warn users to set the `metadataBase` to make sure the domain can be properly resolved. [x-ref](https://vercel.slack.com/archives/C03S8ED1DKM/p1716926825853389?thread_ts=1716923373.484329&cid=C03S8ED1DKM)
-
Janka Uryga authored
-
Janka Uryga authored
-
Jiachi Liu authored
-
Zack Tanner authored
This is causing unexpected errors. Reverts vercel/next.js#66286
-
Jiachi Liu authored
Remove creating client proxy for each ESM export, instead for ESM we create a CJS module proxy for itself and access the property with export name as the actual export. `proxy` is the module proxy that we treat the module as a client boundary. For ESM, we access the property of the module proxy directly for each export. This is bit hacky that treating using a CJS like module proxy for ESM's exports, but this will avoid creating nested proxies for each export. It will be improved in the future. Notice that for `next/dynamic`, if you're doing a dynamic import of client component in server component, and trying to access the named export directly, it will error. Instead you need to align the dynamic import resolved value wrapping with a `default:` property (e.g. `{ default: resolved }`) like what `React.lazy` accepted. Revert #57301 Fixes #66212 x-ref: [slack](https://vercel.slack.com/archives/C04DUD7EB1B/p1716897764858829) -
Jiachi Liu authored
Remove the extra `__esModule` and `$$typeof` export for ESM client module For a client page reference, it changed on server side in renderer: Previous: `{ __esModule, $$typeof, default }` Now: `{ default }` The Module object itself appears as a client reference but it can't be rendered since it's not a real reference. I'm not sure why it was added but I think the right thing for an ESM module is to not treat the module itself as a client reference but only the objects inside of it. E.g. the "default" export. That's what React does upstream for ESM modules. Closes NEXT-3360
-