From e02b54ad864ea25cb972f6196496b5aee36a47a3 Mon Sep 17 00:00:00 2001 From: Alexander Niebuhr Date: Thu, 29 Aug 2024 08:54:54 +0200 Subject: [PATCH] chore: fix type errors --- .changeset/blue-owls-peel.md | 21 +++++++++++++++++++++ .changeset/early-berries-rush.md | 21 +++++++++++++++++++++ packages/cloudflare/src/index.ts | 2 -- packages/netlify/src/index.ts | 28 +++++++++++++--------------- 4 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 .changeset/blue-owls-peel.md create mode 100644 .changeset/early-berries-rush.md diff --git a/.changeset/blue-owls-peel.md b/.changeset/blue-owls-peel.md new file mode 100644 index 000000000..03d7f8f94 --- /dev/null +++ b/.changeset/blue-owls-peel.md @@ -0,0 +1,21 @@ +--- +'@astrojs/cloudflare': major +'@astrojs/netlify': major +--- + +Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro. + +Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained. + +```diff +- import { squooshImageService } from "astro/config"; +import { defineConfig } from "astro/config"; + +export default defineConfig({ +- image: { +- service: squooshImageService() +- } +}); +``` + +If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh diff --git a/.changeset/early-berries-rush.md b/.changeset/early-berries-rush.md new file mode 100644 index 000000000..0dae1a687 --- /dev/null +++ b/.changeset/early-berries-rush.md @@ -0,0 +1,21 @@ +--- +'@astrojs/cloudflare': major +'@astrojs/netlify': major +--- + +Deprecates the `functionPerRoute` option + +This option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to: + +```diff +import { defineConfig } from 'astro/config'; +import vercel from '@astrojs/vercel/serverless'; + +export default defineConfig({ + // ... + output: 'server', + adapter: vercel({ +- functionPerRoute: true, + }), +}); +``` diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index 718fac020..8f0706093 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -155,7 +155,6 @@ export default function createIntegration(args?: Options): AstroIntegration { serverEntrypoint: '@astrojs/cloudflare/entrypoints/server.js', exports: ['default'], adapterFeatures: { - functionPerRoute: false, edgeMiddleware: false, }, supportedAstroFeatures: { @@ -166,7 +165,6 @@ export default function createIntegration(args?: Options): AstroIntegration { assets: { supportKind: 'stable', isSharpCompatible: false, - isSquooshCompatible: false, }, envGetSecret: 'experimental', }, diff --git a/packages/netlify/src/index.ts b/packages/netlify/src/index.ts index a2515dce8..b4d93b42a 100644 --- a/packages/netlify/src/index.ts +++ b/packages/netlify/src/index.ts @@ -115,13 +115,13 @@ async function writeNetlifyFrameworkConfig(config: AstroConfig, logger: AstroInt const headers = config.build.assetsPrefix ? undefined : [ - { - for: `${config.base}${config.base.endsWith('/') ? '' : '/'}${config.build.assets}/*`, - values: { - 'Cache-Control': 'public, max-age=31536000, immutable', - }, + { + for: `${config.base}${config.base.endsWith('/') ? '' : '/'}${config.build.assets}/*`, + values: { + 'Cache-Control': 'public, max-age=31536000, immutable', }, - ]; + }, + ]; // See https://docs.netlify.com/image-cdn/create-integration/ const deployConfigDir = new URL('.netlify/v1/', config.root); @@ -259,9 +259,9 @@ export default function netlifyIntegration( ` import createSSRHandler from './${handler}'; export default createSSRHandler(${JSON.stringify({ - cacheOnDemandPages: Boolean(integrationConfig?.cacheOnDemandPages), - notFoundContent, - })}); + cacheOnDemandPages: Boolean(integrationConfig?.cacheOnDemandPages), + notFoundContent, + })}); export const config = { includedFiles: ['**/*'], name: 'Astro SSR', @@ -343,7 +343,7 @@ export default function netlifyIntegration( if (typeof req.headers[header] === 'string') { try { return JSON.parse(Buffer.from(req.headers[header] as string, 'base64').toString('utf8')); - } catch {} + } catch { } } }; @@ -429,8 +429,8 @@ export default function netlifyIntegration( }, ...((await shouldExternalizeAstroEnvSetup()) ? { - ssr: { external: ['astro/env/setup'] }, - } + ssr: { external: ['astro/env/setup'] }, + } : {}), }, image: { @@ -453,7 +453,6 @@ export default function netlifyIntegration( serverEntrypoint: '@astrojs/netlify/ssr-function.js', exports: ['default'], adapterFeatures: { - functionPerRoute: false, edgeMiddleware, }, args: { middlewareSecret } satisfies Args, @@ -466,7 +465,6 @@ export default function netlifyIntegration( supportKind: 'experimental', // still using Netlify Image CDN instead isSharpCompatible: true, - isSquooshCompatible: true, }, envGetSecret: 'experimental', }, @@ -483,7 +481,7 @@ export default function netlifyIntegration( let notFoundContent = undefined; try { notFoundContent = await readFile(new URL('./404.html', dir), 'utf8'); - } catch {} + } catch { } await writeSSRFunction({ notFoundContent, logger }); logger.info('Generated SSR Function'); }