astro 3.0.0-beta.0
Major Changes
-
1eae2e3f7Thanks @Princesseuh! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. -
76ddef19cThanks @Princesseuh! - Removed automatic flattening ofgetStaticPathsresult..flatMapand.flatshould now be used to ensure that you're returning a flat array. -
3fdf509b2Thanks @ematipico! - Thebuild.splitandbuild.excludeMiddlewareconfiguration options are deprecated and have been replaced by options in the adapter config.If your config includes the
build.excludeMiddlewareoption, replace it withedgeMiddlewarein your adapter options:import { defineConfig } from "astro/config"; import netlify from "@astrojs/netlify/functions"; export default defineConfig({ build: { - excludeMiddleware: true }, adapter: netlify({ + edgeMiddleware: true }), });If your config includes the
build.splitoption, replace it withfunctionPerRoutein your adapter options:import { defineConfig } from "astro/config"; import netlify from "@astrojs/netlify/functions"; export default defineConfig({ build: { - split: true }, adapter: netlify({ + functionPerRoute: true }), }); -
2f951cd40Thanks @Princesseuh! - Sharp is now the default image service used forastro:assets. If you would prefer to still use Squoosh, you can update your config with the following:import { defineConfig, squooshImageService } from 'astro/config'; // https://astro.build/config export default defineConfig({ image: { service: squooshImageService(), }, });However, not only do we recommend using Sharp as it is faster and more reliable, it is also highly likely that the Squoosh service will be removed in a future release.
-
c022a4217Thanks @Princesseuh! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits ofastro:assetssuch as enforcingalt, no CLS etc to users -
67becaa58Thanks @ematipico! - Removed support for old syntax of the API routes. -
dfc2d93e3Thanks @bluwy! - Remove MDX plugin re-ordering hack -
3dc1ca2faThanks @Princesseuh! - Reduced the amount of polyfills provided by Astro. Astro will no longer provide (no-op) polyfills for several web apis such as HTMLElement, Image or Document. If you need access to those APIs on the server, we recommend using more proper polyfills available on npm. -
1be84dfeeThanks @Princesseuh! - Updatetsconfig.jsonpresets withmoduleResolution: 'bundler'and other new options from TypeScript 5.0. Astro now assumes that you use TypeScript 5.0 (March 2023), or that your editor includes it, ex: VS Code 1.77 -
35f01df79Thanks @Princesseuh! - Theastro checkcommand now requires an external package@astrojs/checkand an install oftypescriptin your project. This was done in order to make the mainastropackage smaller and give more flexibility to users in regard to the version of TypeScript they use. -
3fdf509b2Thanks @ematipico! - Thebuild.splitandbuild.excludeMiddlewareconfiguration options are deprecated and have been replaced by options in the adapter config.If your config includes the
build.excludeMiddlewareoption, replace it withedgeMiddlewarein your adapter options:import { defineConfig } from "astro/config"; import vercel from "@astrojs/vercel/serverless"; export default defineConfig({ build: { - excludeMiddleware: true }, adapter: vercel({ + edgeMiddleware: true }), });If your config includes the
build.splitoption, replace it withfunctionPerRoutein your adapter options:import { defineConfig } from "astro/config"; import vercel from "@astrojs/vercel/serverless"; export default defineConfig({ build: { - split: true }, adapter: vercel({ + functionPerRoute: true }), }); -
78de801f2Thanks @ematipico! - Lowercase names for endpoint functions are now deprecated.Rename functions to their uppercase equivalent:
- export function get() { + export function GET() { return new Response(JSON.stringify({ "title": "Bob's blog" })); } - export function post() { + export function POST() { return new Response(JSON.stringify({ "title": "Bob's blog" })); } - export function put() { + export function PUT() { return new Response(JSON.stringify({ "title": "Bob's blog" })); } - export function all() { + export function ALL() { return new Response(JSON.stringify({ "title": "Bob's blog" })); } // you can use the whole word "DELETE" - export function del() { + export function DELETE() { return new Response(JSON.stringify({ "title": "Bob's blog" })); } -
59d6e569fThanks @matthewp! - Astro.cookies.get(key) returns undefined if cookie doesn't existWith this change, Astro.cookies.get(key) no longer always returns a
AstroCookieobject. Instead it now returnsundefinedif the cookie does not exist.You should update your code if you assume that all calls to
get()return a value. When using withhas()you still need to assert the value, like so:--- if (Astro.cookies.has(id)) { const id = Astro.cookies.get(id)!; } --- -
7723c4cc9Thanks @ematipico! - The propertycompressHTMLis nowtrueby default. Setting this value totrueis no longer required.If you do not want to minify your HTML output, you must set this value to
falseinastro.config.mjs.import {defineConfig} from "astro/config"; export default defineConfig({ + compressHTML: false }) -
fb5cd6b56Thanks @ematipico! - Astro's default port when running the dev or preview server is now4321.This will reduce conflicts with ports used by other tools.
-
631b9c410Thanks @bluwy! - Remove MDX specialcomponentsexport handling
Minor Changes
-
9b4f70a62Thanks @ematipico! - Introduced the concept of feature map. A feature map is a list of features that are built-in in Astro, and an Adapter can tell Astro if it can support it.import { AstroIntegration } from './astro'; function myIntegration(): AstroIntegration { return { name: 'astro-awesome-list', // new feature map supportedAstroFeatures: { hybridOutput: 'experimental', staticOutput: 'stable', serverOutput: 'stable', assets: { supportKind: 'stable', isSharpCompatible: false, isSquooshCompatible: false, }, }, }; } -
bc37331d8Thanks @ematipico! - Integrations can now log messages using Astro’s built-in logger.The logger is available to all hooks as an additional parameter:
import { AstroIntegration } from './astro'; // integration.js export function myIntegration(): AstroIntegration { return { name: 'my-integration', hooks: { 'astro:config:done': ({ logger }) => { logger.info('Configure integration...'); }, }, }; }
Patch Changes
- Updated dependencies [
1eae2e3f7]:- @astrojs/telemetry@3.0.0-beta.0
- @astrojs/internal-helpers@0.2.0-beta.0
- @astrojs/markdown-remark@3.0.0-beta.0