From e21ffd29edd63d7f9d7024071f5e933f433a5686 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 08:16:11 +0100 Subject: [PATCH] [ci] release (#103) Co-authored-by: github-actions[bot] --- .changeset/ten-cougars-pretend.md | 69 ------------------------------ packages/netlify/CHANGELOG.md | 70 +++++++++++++++++++++++++++++++ packages/netlify/package.json | 2 +- 3 files changed, 71 insertions(+), 70 deletions(-) delete mode 100644 .changeset/ten-cougars-pretend.md diff --git a/.changeset/ten-cougars-pretend.md b/.changeset/ten-cougars-pretend.md deleted file mode 100644 index 8a3c4a0c..00000000 --- a/.changeset/ten-cougars-pretend.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -'@astrojs/netlify': major ---- - -# Netlify Adapter v4 simplifies static + SSR deployments - -This update is a complete overhaul of the Netlify adapter. -It simplifies the user-facing config, and resolves a number of bugs along the way. - -Here's what changes: - -## Netlify Context is automatically available via Locals - -In v3, you could use `netlify-edge-middleware.ts` to inject data from the Netlify context into your Astro locals. -In v4, this file is no longer needed because the Netlify context is automatically made available via `Astro.locals.netlify.context`. -You can use this context to access information about the user (like geolocation or IP address), your Netlify site (like deploy ID) or the request (like its request ID or the CDN region it's served from). - -**Action Required:** -Remove the `netlify-edge-middleware.ts` or `netlify-edge-middleware.js` file. -In your codebase, change all usage of locals injected through that file to use `Astro.locals.netlify.context` instead. - -### Image CDN - -v4 of this adapter integrates your Astro site with Netlify [Image CDN](https://docs.netlify.com/image-cdn/overview/). -This allows transforming images on-the-fly without impacting build times. -It's implemented using an [Astro Image Service](https://docs.astro.build/en/reference/image-service-reference/), and enabled by default. - -## Replacement for On-Demand Builders - -On-Demand Builders (ODB) allows SSR-Rendered pages to be cached using a Time to Live (TTL) strategy. -While the Netlify platform continues to support existing pages with ODBs, we now recommend using the much more powerful -[Fine-Grained Cache Control](https://www.netlify.com/blog/swr-and-fine-grained-cache-control) going forward. - -In v3, you could deploy your SSR-Rendered Astro pages to ODBs by enabling the `builders` config option, -and then specifying the TTL on a per-page basis. -In v4, a new `cacheOnDemandPages` option replaces this config option. Take a look at the README to learn more about this. - -**Action Required:** -Replace the `builders` config option with `cacheOnDemandPages`. - -```diff lang="ts" -// astro.config.mjs -export default defineConfig({ - // ... - adapter: netlify({ -- builders: true -+ cacheOnDemandPages: true - }), -}); -``` - -## `functionPerRoute` was removed - -In v3, the `functionPerRoute` option allowed the SSR routes to be split up into multiple Netlify Functions. -This reduced the bundle sizes of each individual function, with the intention of speeding up code parsing, and therefore the time of cold starts. -In practice, this benefit is often nullified by the increase in number of cold starts - more handlers means fewer requests per handler, means more cold starts. - -In v4, support for this deployment mode was removed. - -**Action Required:** -Remove the `functionPerRoute` field from your config. - -## `binaryMediaTypes` was removed - -`binaryMediaTypes` was a workaround required for some Astro endpoints, because v3 deployed those as "old" Netlify Functions (now referred to as ["Lambda Compatibility Mode"](https://docs.netlify.com/functions/lambda-compatibility)). -v4 uses the new [Netlify Functions 2.0](https://www.netlify.com/blog/introducing-netlify-functions-2-0/), which simply doesn't need this workaround anymore - so we're removing it 🎉 - -**Action Required:** -Remove the `binaryMediaTypes` field from your config. diff --git a/packages/netlify/CHANGELOG.md b/packages/netlify/CHANGELOG.md index 1b0e1171..24ccfe76 100644 --- a/packages/netlify/CHANGELOG.md +++ b/packages/netlify/CHANGELOG.md @@ -1,5 +1,75 @@ # @astrojs/netlify +## 4.0.0 + +### Major Changes + +- [#84](https://github.com/withastro/adapters/pull/84) [`ca64544`](https://github.com/withastro/adapters/commit/ca645447402316963bcc1181292baea58b8e3bff) Thanks [@Skn0tt](https://github.com/Skn0tt)! - # Netlify Adapter v4 simplifies static + SSR deployments + + This update is a complete overhaul of the Netlify adapter. + It simplifies the user-facing config, and resolves a number of bugs along the way. + + Here's what changes: + + ## Netlify Context is automatically available via Locals + + In v3, you could use `netlify-edge-middleware.ts` to inject data from the Netlify context into your Astro locals. + In v4, this file is no longer needed because the Netlify context is automatically made available via `Astro.locals.netlify.context`. + You can use this context to access information about the user (like geolocation or IP address), your Netlify site (like deploy ID) or the request (like its request ID or the CDN region it's served from). + + **Action Required:** + Remove the `netlify-edge-middleware.ts` or `netlify-edge-middleware.js` file. + In your codebase, change all usage of locals injected through that file to use `Astro.locals.netlify.context` instead. + + ### Image CDN + + v4 of this adapter integrates your Astro site with Netlify [Image CDN](https://docs.netlify.com/image-cdn/overview/). + This allows transforming images on-the-fly without impacting build times. + It's implemented using an [Astro Image Service](https://docs.astro.build/en/reference/image-service-reference/), and enabled by default. + + ## Replacement for On-Demand Builders + + On-Demand Builders (ODB) allows SSR-Rendered pages to be cached using a Time to Live (TTL) strategy. + While the Netlify platform continues to support existing pages with ODBs, we now recommend using the much more powerful + [Fine-Grained Cache Control](https://www.netlify.com/blog/swr-and-fine-grained-cache-control) going forward. + + In v3, you could deploy your SSR-Rendered Astro pages to ODBs by enabling the `builders` config option, + and then specifying the TTL on a per-page basis. + In v4, a new `cacheOnDemandPages` option replaces this config option. Take a look at the README to learn more about this. + + **Action Required:** + Replace the `builders` config option with `cacheOnDemandPages`. + + ```diff lang="ts" + // astro.config.mjs + export default defineConfig({ + // ... + adapter: netlify({ + - builders: true + + cacheOnDemandPages: true + }), + }); + ``` + + ## `functionPerRoute` was removed + + In v3, the `functionPerRoute` option allowed the SSR routes to be split up into multiple Netlify Functions. + This reduced the bundle sizes of each individual function, with the intention of speeding up code parsing, and therefore the time of cold starts. + In practice, this benefit is often nullified by the increase in number of cold starts - more handlers means fewer requests per handler, means more cold starts. + + In v4, support for this deployment mode was removed. + + **Action Required:** + Remove the `functionPerRoute` field from your config. + + ## `binaryMediaTypes` was removed + + `binaryMediaTypes` was a workaround required for some Astro endpoints, because v3 deployed those as "old" Netlify Functions (now referred to as ["Lambda Compatibility Mode"](https://docs.netlify.com/functions/lambda-compatibility)). + v4 uses the new [Netlify Functions 2.0](https://www.netlify.com/blog/introducing-netlify-functions-2-0/), which simply doesn't need this workaround anymore - so we're removing it 🎉 + + **Action Required:** + Remove the `binaryMediaTypes` field from your config. + ## 3.1.1 ### Patch Changes diff --git a/packages/netlify/package.json b/packages/netlify/package.json index 18cf16d6..30bc29a3 100644 --- a/packages/netlify/package.json +++ b/packages/netlify/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/netlify", "description": "Deploy your site to Netlify", - "version": "3.1.1", + "version": "4.0.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro",