Minor Changes
-
#7071
e186ecc5e
Thanks @johannesspohr! - Render sibling components in parallel -
#6850
c6d7ebefd
Thanks @bholmesdev! - Content collections now support data formats including JSON and YAML. You can also create relationships, or references, between collections to pull information from one collection entry into another. Learn more on our updated Content Collections docs. -
#6991
719002ca5
Thanks @MoustaphaDev! - Enable experimental support for hybrid SSR with pre-rendering enabled by defaultastro.config.mjs
import { defineConfig } from 'astro/config'; export defaultdefineConfig({ output: 'hybrid', experimental: { hybridOutput: true, }, })
Then add
export const prerender = false
to any page or endpoint you want to opt-out of pre-rendering.src/pages/contact.astro
--- export const prerender = false; if (Astro.request.method === 'POST') { // handle form submission } --- <form method="POST"> <input type="text" name="name" /> <input type="email" name="email" /> <button type="submit">Submit</button> </form>
-
#7074
73ec6f6c1
Thanks @bluwy! - Integrations can add newclient:
directives through theastro:config:setup
hook'saddClientDirective()
API. To enable this API, the user needs to setexperimental.customClientDirectives
totrue
in their config.import { defineConfig } from 'astro/config'; import onClickDirective from 'astro-click-directive'; export default defineConfig({ integrations: [onClickDirective()], experimental: { customClientDirectives: true, }, });
export default function onClickDirective() { return { hooks: { 'astro:config:setup': ({ addClientDirective }) => { addClientDirective({ name: 'click', entrypoint: 'astro-click-directive/click.js', }); }, }, }; }
<Counter client:click />
The client directive file (e.g.
astro-click-directive/click.js
) should export a function of typeClientDirective
:import type { ClientDirective } from 'astro'; const clickDirective: ClientDirective = (load, opts, el) => { window.addEventListener( 'click', async () => { const hydrate = await load(); await hydrate(); }, { once: true } ); }; export default clickDirective;
-
#6706
763ff2d1e
Thanks @wulinsheng123! - Adds an opt-in way to minify the HTML output.Using the
compressHTML
option Astro will remove whitespace from Astro components. This only applies to components written in.astro
format and happens in the compiler to maximize performance. You can enable with:import { defineConfig } from 'astro/config'; export default defineConfig({ compressHTML: true, });
Compression occurs both in development mode and in the final build.
-
#7069
c1669c001
Thanks @Princesseuh! - AddedPolymorphic
type helper toastro/types
to easily create polymorphic components:--- import { HTMLTag, Polymorphic } from 'astro/types'; type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }>; const { as: Tag, ...props } = Astro.props; --- <Tag {...props} />
-
#7093
3d525efc9
Thanks @matthewp! - Prevent removal of nested slots within islandsThis change introduces a new flag that renderers can add called
supportsAstroStaticSlot
. What this does is let Astro know that the render is sending<astro-static-slot>
as placeholder values for static (non-hydrated) slots which Astro will then remove.This change is completely backwards compatible, but fixes bugs caused by combining ssr-only and client-side framework components like so:
<Component> <div> <Component client:load> <span>Nested</span> </Component> </div> </Component>
Patch Changes
-
#7102
4516d7b22
Thanks @Princesseuh! - Fix image services not being usable on Edge runtimes -
#7044
914c439bc
Thanks @Steffan153! - Escape closing script tag withdefine:vars
-
#6851
e9fc2c221
Thanks @timozander! - Added warning message when using unsupported file extensions in pages/ -
#7106
075eee08f
Thanks @ematipico! - Fix middleware for API endpoints that useResponse
, and log a warning for endpoints that don't useResponse
. -
#7110
fc52681ba
Thanks @delucis! - Fix formatting in theNoMatchingRenderer
error message. -
#7095
fb84622af
Thanks @bholmesdev! - Generate headingid
s and populate theheadings
property for all Markdoc files -
#7011
cada10a46
Thanks @TheOtterlord! - Throw an error when unknown experimental keys are present -
#7091
cd410c5eb
Thanks @MoustaphaDev! - Fix double prepended forward slash in SSR -
#7108
410428672
Thanks @Princesseuh! - Fix imports using ?raw and ?url not working whenexperimental.assets
is enabled -
Updated dependencies [
826e02890
]:- @astrojs/[email protected]