fix(deps): update astro monorepo (major)
This MR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
@astrojs/mdx (source) | dependencies | major | ^2.1.1 -> ^4.0.0 |
astro (source) | dependencies | major | ^4.4.1 -> ^5.0.0 |
Release Notes
withastro/astro (@astrojs/mdx)
v4.0.3
Patch Changes
-
#12799
739dbfb
Thanks @ascorbic! - Upgrades Vite to pin esbuild
v4.0.2
Patch Changes
v4.0.1
Patch Changes
-
#12594
4f2fd0a
Thanks @Princesseuh! - Fixes compatibility with Astro 5
v4.0.0
Major Changes
-
#12231
90ae100
Thanks @bluwy! - Handles the breaking change in Astro where content pages (including.mdx
pages located withinsrc/pages/
) no longer respond withcharset=utf-8
in theContent-Type
header.For MDX pages without layouts,
@astrojs/mdx
will automatically add the<meta charset="utf-8">
tag to the page by default. This reduces the boilerplate needed to write with non-ASCII characters. If your MDX pages have a layout, the layout component should include the<meta charset="utf-8">
tag.If you require
charset=utf-8
to render your page correctly, make sure that your layout components have the<meta charset="utf-8">
tag added. -
#12008
5608338
Thanks @Princesseuh! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.Starting from this release, no breaking changes will be introduced unless absolutely necessary.
To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.
Minor Changes
-
#11741
6617491
Thanks @bluwy! - Updates adapter server entrypoint to use@astrojs/mdx/server.js
This is an internal change. Handling JSX in your
.mdx
files has been moved from Astro internals and is now the responsibility of this integration. You should not notice a change in your project, and no update to your code is required.
Patch Changes
-
#12075
a19530e
Thanks @bluwy! - Parses frontmatter ourselves -
#11861
3ab3b4e
Thanks @bluwy! - Updates@astrojs/markdown-remark
and handle its breaking changes -
#12533
1b61fdf
Thanks @ematipico! - Fixes a case where the MDX renderer couldn't be loaded when used as a direct dependency of an Astro integration. -
Updated dependencies [
3ab3b4e
,5608338
,560ef15
,83a2a64
,3ab3b4e
,a19530e
]:
v3.1.9
Patch Changes
-
#12245
1d4f6a4
Thanks @bmenant! - Addcomponents
property to MDXInstance type definition (RenderResult and module import)
v3.1.8
Patch Changes
- Updated dependencies [
710a1a1
]:
v3.1.7
Patch Changes
v3.1.6
Patch Changes
v3.1.5
Patch Changes
-
#11818
88ef1d0
Thanks @bluwy! - Fixes CSS in the layout component to be ordered first before any other components in the MDX file
v3.1.4
Patch Changes
-
#11717
423614e
Thanks @bluwy! - Fixes stack trace location when failed to parse an MDX file with frontmatter
v3.1.3
Patch Changes
- Updated dependencies [
49b5145
]:
v3.1.2
Patch Changes
- Updated dependencies [
b6afe6a
]:
v3.1.1
Patch Changes
-
#11263
7d59750
Thanks @wackbyte! - Refactor to use Astro's integration logger for logging
v3.1.0
Minor Changes
-
#11144
803dd80
Thanks @ematipico! - The integration now exposes a function calledgetContainerRenderer
, that can be used inside the Container APIs to load the relative renderer.import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from 'astro:container'; import { getContainerRenderer } from '@​astrojs/react'; test('ReactWrapper with react renderer', async () => { const renderers = await loadRenderers([getContainerRenderer()]); const container = await AstroContainer.create({ renderers, }); const result = await container.renderToString(ReactWrapper); expect(result).toContain('Counter'); expect(result).toContain('Count: <!-- -->5'); });
v3.0.1
Patch Changes
-
#10813
3cc3e2c
Thanks @Xetera! - Omitting compiler-internal symbol from user components to fix breaking error messages
v3.0.0
Major Changes
-
#10935
ddd8e49
Thanks @bluwy! - Refactors the MDX transformation to rely only on the unified pipeline. Babel and esbuild transformations are removed, which should result in faster build times. The refactor requires using Astro v4.8.0 but no other changes are necessary. -
#10935
ddd8e49
Thanks @bluwy! - Allows integrations after the MDX integration to updatemarkdown.remarkPlugins
andmarkdown.rehypePlugins
, and have the plugins work in MDX too.If your integration relies on Astro's previous behavior that prevents integrations from adding remark/rehype plugins for MDX, you will now need to configure
@astrojs/mdx
withextendMarkdownConfig: false
and explicitly specify anyremarkPlugins
andrehypePlugins
options instead. -
#10935
ddd8e49
Thanks @bluwy! - Renames theoptimize.customComponentNames
option tooptimize.ignoreElementNames
to better reflect its usecase. Its behaviour is not changed and should continue to work as before. -
#10935
ddd8e49
Thanks @bluwy! - Replaces the internalremark-images-to-component
plugin withrehype-images-to-component
to let users use additional rehype plugins for images
Patch Changes
-
#10935
ddd8e49
Thanks @bluwy! - Simplifies plain MDX components as hast element nodes to further improve HTML string inlining for theoptimize
option -
#10935
ddd8e49
Thanks @bluwy! - Allows Vite plugins to transform.mdx
files before the MDX plugin transforms it -
#10935
ddd8e49
Thanks @bluwy! - Updates theoptimize
option to group static sibling nodes as a<Fragment />
. This reduces the number of AST nodes and simplifies runtime rendering of MDX pages. -
#10935
ddd8e49
Thanks @bluwy! - Tags the MDX component export for quicker component checks while rendering -
#10935
ddd8e49
Thanks @bluwy! - Fixesexport const components
keys detection for theoptimize
option -
#10935
ddd8e49
Thanks @bluwy! - Improvesoptimize
handling for MDX components with attributes and inline MDX components
v2.3.1
Patch Changes
-
#10754
3e7a12c8532411e580fcfdb8445cad8fc8499291
Thanks @rishi-raj-jain! - Fixes an issue where images in MDX required a relative specifier (e.g../
)Now, you can use the standard
![](img.png)
syntax in MDX files for images colocated in the same folder: no relative specifier required!There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these MDX images as they are no longer necessary:
- ![A cute dog](./dog.jpg) + ![A cute dog](dog.jpg) <!-- This dog lives in the same folder as my article! -->
-
#10770
88ee63a3ba4488c60348cb821034e6d4a057efd0
Thanks @bluwy! - Removes internal MDX processor onbuildEnd
to free up memory
v2.3.0
Minor Changes
-
#10689
683d51a5eecafbbfbfed3910a3f1fbf0b3531b99
Thanks @ematipico! - Deprecate support for versions of Node.js older thanv18.17.1
for Node.js 18, older thanv20.0.3
for Node.js 20, and the complete Node.js v19 release line.This change is in line with Astro's Node.js support policy.
Patch Changes
- Updated dependencies [
ccafa8d230f65c9302421a0ce0a0adc5824bfd55
]:
v2.2.4
Patch Changes
-
#10673
db7f9c87035a0de780536d95cdd9facff00c3c08
Thanks @bluwy! - Removes unnecessary internalrecmaInjectImportMetaEnv
plugin
v2.2.3
Patch Changes
- Updated dependencies [
2cf116f80cb5e421ab5cc5eb4a654e7b78c1b8de
,374efcdff9625ca43309d89e3b9cfc9174351512
]:
v2.2.2
Patch Changes
- Updated dependencies [
c585528f446ccca3d4c643f4af5d550b93c18902
]:
v2.2.1
Patch Changes
- Updated dependencies [
19e42c368184013fc30d1e46753b9e9383bb2bdf
]:
v2.2.0
Minor Changes
-
#10104
a31bbd7ff8f3ec62ee507f72d1d25140b82ffc18
Thanks @remcohaszing! - Changes Astro's internal syntax highlighting to use rehype plugins instead of remark plugins. This provides better interoperability with other rehype plugins that deal with code blocks, in particular with third party syntax highlighting plugins andrehype-mermaid
.This may be a breaking change if you are currently using:
- a remark plugin that relies on nodes of type
html
- a rehype plugin that depends on nodes of type
raw
.
Please review your rendered code samples carefully, and if necessary, consider using a rehype plugin that deals with the generated
element
nodes instead. You can transform the AST of raw HTML strings, or alternatively usehast-util-to-html
to get a string from araw
node. - a remark plugin that relies on nodes of type
Patch Changes
withastro/astro (astro)
v5.1.1
Patch Changes
-
#12782
f3d8385
Thanks @fhiromasa! - update comment in packages/astro/src/types/public/common.ts -
#12789
f632b94
Thanks @ascorbic! - Pass raw frontmatter to remark plugins in glob loader -
#12799
739dbfb
Thanks @ascorbic! - Upgrades Vite to pin esbuild
v5.1.0
Minor Changes
-
#12441
b4fec3c
Thanks @ascorbic! - Adds experimental session supportSessions are used to store user state between requests for server-rendered pages, such as login status, shopping cart contents, or other user-specific data.
v5.0.9
Patch Changes
-
#12756
95795f8
Thanks @matthewp! - Remove debug logging from build
v5.0.8
Patch Changes
-
#12749
039d022
Thanks @matthewp! - Clean server sourcemaps from static output
v5.0.7
Patch Changes
-
#12746
c879f50
Thanks @matthewp! - Remove all assets created from the server build
v5.0.6
Patch Changes
-
#12597
564ac6c
Thanks @florian-lefebvre! - Fixes an issue where image and server islands routes would not be passed to theastro:routes:resolved
hook during builds -
#12718
ccc5ad1
Thanks @ematipico! - Fixes an issue where Astro couldn't correctly handle i18n fallback when using the i18n middleware -
#12728
ee66a45
Thanks @argyleink! - Adds type support for theclosedby
attribute for<dialog>
elements -
#12709
e3bfd93
Thanks @mtwilliams-code! - Fixes a bug where Astro couldn't correctly parseparams
andprops
when receiving i18n fallback URLs -
#12657
14dffcc
Thanks @darkmaga! - Trailing slash support for actions -
#12715
029661d
Thanks @ascorbic! - Fixes a bug that caused errors in dev when editing sites with large numbers of MDX pages -
#12729
8b1cecd
Thanks @JoeMorgan! - "Addedinert
to htmlBooleanAttributes" -
#12726
7c7398c
Thanks @florian-lefebvre! - Fixes a case where failing content entries inastro check
would not be surfaced
v5.0.5
Patch Changes
-
#12705
0d1eab5
Thanks @ascorbic! - Fixes a bug where MDX files with certain characters in the name would cause builds to fail -
#12707
2aaed2d
Thanks @ematipico! - Fixes a bug where the middleware was incorrectly imported during the build -
#12697
1c4a032
Thanks @ascorbic! - Fix a bug that caused builds to fail if an image had a quote mark in its name -
#12694
495f46b
Thanks @ematipico! - Fixes a bug where the experimental featureexperimental.svg
was incorrectly used when generating ESM images -
#12658
3169593
Thanks @jurajkapsz! - Fixes astro info copy to clipboard process not returning to prompt in certain cases. -
#12712
b01c74a
Thanks @ascorbic! - Fixes a bug which misidentified pages as markdown if a query string ended in a markdown extension
v5.0.4
Patch Changes
-
#12653
e21c7e6
Thanks @sarah11918! - Updates a reference in an error message -
#12585
a9373c0
Thanks @florian-lefebvre! - Fixes a case whereprocess.env
would be frozen despite changes made to environment variables in development -
#12695
a203d5d
Thanks @ascorbic! - Throws a more helpful error when images are missing
v5.0.3
Patch Changes
-
#12645
8704c54
Thanks @sarah11918! - Updates some reference links in error messages for new v5 docs. -
#12641
48ca399
Thanks @ascorbic! - Fixes a bug whereastro info --copy
wasn't working correctly onmacOS
systems. -
#12461
62939ad
Thanks @kyr0! - Removes the misleading log message telling that a custom renderer is not recognized while it clearly is and works. -
#12642
ff18b9c
Thanks @ematipico! - Provides more information when logging a warning for accessingAstro.request.headers
in prerendered pages -
#12634
03958d9
Thanks @delucis! - Improves error message formatting for user config and content collection frontmatter -
#12547
6b6e18d
Thanks @mtwilliams-code! - Fixes a bug where URL search parameters weren't passed when using the i18nfallback
feature. -
#12449
e6b8017
Thanks @apatel369! - Fixes an issue where the customassetFileNames
configuration caused assets to be incorrectly moved to the server directory instead of the client directory, resulting in 404 errors when accessed from the client side. -
#12518
e216250
Thanks @ematipico! - Fixes an issue where SSR error pages would return duplicated custom headers. -
#12625
74bfad0
Thanks @ematipico! - Fixes an issue where theexperimental.svg
had incorrect type, resulting in some errors in the editors. -
#12631
dec0305
Thanks @ascorbic! - Fixes a bug where the class attribute was rendered twice on the image component -
#12623
0e4fecb
Thanks @ascorbic! - Correctly handles images in content collections with uppercase file extensions -
#12633
8a551c1
Thanks @bluwy! - Cleans up content layer sync during builds and programmaticsync()
calls -
#12640
22e405a
Thanks @ascorbic! - Fixes a bug that caused content collections to be returned empty when run in a test environment -
#12613
306c9f9
Thanks @matthewp! - Fix use of cloned requests in middleware with clientAddressWhen using
context.clientAddress
orAstro.clientAddress
Astro looks up the address in a hidden property. Cloning a request can cause this hidden property to be lost.The fix is to pass the address as an internal property instead, decoupling it from the request.
v5.0.2
Patch Changes
-
#12601
0724929
Thanks @ascorbic! - Includes "undefined" in types for getEntry
v5.0.1
Patch Changes
v5.0.0
Major Changes
-
#11798
e9e2139
Thanks @matthewp! - Unflag globalRoutePriorityThe previously experimental feature
globalRoutePriority
is now the default in Astro 5.This was a refactoring of route prioritization in Astro, making it so that injected routes, file-based routes, and redirects are all prioritized using the same logic. This feature has been enabled for all Starlight projects since it was added and should not affect most users.
-
#11864
ee38b3a
Thanks @ematipico! - ### [changed]:entryPoint
type inside the hookastro:build:ssr
In Astro v4.x, theentryPoint
type wasRouteData
.Astro v5.0 the
entryPoint
type isIntegrationRouteData
, which contains a subset of theRouteData
type. The fieldsisIndex
andfallbackRoutes
were removed.
What should I do?
Update your adapter to change the type of entryPoint
from RouteData
to IntegrationRouteData
.
-import type {RouteData} from 'astro';
+import type {IntegrationRouteData} from "astro"
-function useRoute(route: RouteData) {
+function useRoute(route: IntegrationRouteData) {
}
-
#12524
9f44019
Thanks @bluwy! - Bumps Vite to ^6.0.1 and handles its breaking changes -
#10742
b6fbdaa
Thanks @ematipico! - The lowest version of Node supported by Astro is now Node v18.17.1 and higher. -
#11916
46ea29f
Thanks @bluwy! - Updates how thebuild.client
andbuild.server
option values get resolved to match existing documentation. With this fix, the option values will now correctly resolve relative to theoutDir
option. So ifoutDir
is set to./dist/nested/
, then by default:-
build.client
will resolve to<root>/dist/nested/client/
-
build.server
will resolve to<root>/dist/nested/server/
Previously the values were incorrectly resolved:
-
build.client
was resolved to<root>/dist/nested/dist/client/
-
build.server
was resolved to<root>/dist/nested/dist/server/
If you were relying on the previous build paths, make sure that your project code is updated to the new build paths.
-
-
#11982
d84e444
Thanks @Princesseuh! - Adds a default exclude and include value to the tsconfig presets.{projectDir}/dist
is now excluded by default, and{projectDir}/.astro/types.d.ts
and{projectDir}/**/*
are included by default.Both of these options can be overridden by setting your own values to the corresponding settings in your
tsconfig.json
file. -
#11861
3ab3b4e
Thanks @bluwy! - Cleans up Astro-specfic metadata attached tovfile.data
in Remark and Rehype plugins. Previously, the metadata was attached in different locations with inconsistent names. The metadata is now renamed as below:-
vfile.data.__astroHeadings
->vfile.data.astro.headings
-
vfile.data.imagePaths
->vfile.data.astro.imagePaths
The types of
imagePaths
has also been updated fromSet<string>
tostring[]
. Thevfile.data.astro.frontmatter
metadata is left unchanged.While we don't consider these APIs public, they can be accessed by Remark and Rehype plugins that want to re-use Astro's metadata. If you are using these APIs, make sure to access them in the new locations.
-
-
#11987
bf90a53
Thanks @florian-lefebvre! - Thelocals
object can no longer be overriddenMiddleware, API endpoints, and pages can no longer override the
locals
object in its entirety. You can still append values onto the object, but you can not replace the entire object and delete its existing values.If you were previously overwriting like so:
ctx.locals = { one: 1, two: 2, };
This can be changed to an assignment on the existing object instead:
Object.assign(ctx.locals, { one: 1, two: 2, });
-
#11908
518433e
Thanks @Princesseuh! - Theimage.endpoint
config now allow customizing the route of the image endpoint in addition to the entrypoint. This can be useful in niche situations where the default route/_image
conflicts with an existing route or your local server setup.import { defineConfig } from 'astro/config'; defineConfig({ image: { endpoint: { route: '/image', entrypoint: './src/image_endpoint.ts', }, }, });
-
#12008
5608338
Thanks @Princesseuh! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.Starting from this release, no breaking changes will be introduced unless absolutely necessary.
To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.
-
#11679
ea71b90
Thanks @florian-lefebvre! - Theastro:env
feature introduced behind a flag in v4.10.0 is no longer experimental and is available for general use. If you have been waiting for stabilization before usingastro:env
, you can now do so.This feature lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client.
To configure a schema, add the
env
option to your Astro config and define your client and server variables. If you were previously using this feature, please remove the experimental flag from your Astro config and move your entireenv
configuration unchanged to a top-level option.import { defineConfig, envField } from 'astro/config'; export default defineConfig({ env: { schema: { API_URL: envField.string({ context: 'client', access: 'public', optional: true }), PORT: envField.number({ context: 'server', access: 'public', default: 4321 }), API_SECRET: envField.string({ context: 'server', access: 'secret' }), }, }, });
You can import and use your defined variables from the appropriate
/client
or/server
module:
v4.16.18
Patch Changes
-
#12757
d0aaac3
Thanks @matthewp! - Remove all assets created from the server build -
#12757
d0aaac3
Thanks @matthewp! - Clean server sourcemaps from static output
v4.16.17
Patch Changes
-
#12632
e7d14c3
Thanks @ematipico! - Fixes an issue where thecheckOrigin
feature wasn't correctly checking thecontent-type
header
v4.16.16
Patch Changes
-
#12542
65e50eb
Thanks @kadykov! - Fix JPEG image size determination -
#12525
cf0d8b0
Thanks @ematipico! - Fixes an issue where withi18n
enabled, Astro couldn't render the404.astro
component for non-existent routes.
v4.16.15
Patch Changes
-
#12498
b140a3f
Thanks @ematipico! - Fixes a regression where Astro was trying to accessRequest.headers
v4.16.14
Patch Changes
-
#12480
c3b7e7c
Thanks @matthewp! - Removes the default throw behavior inastro:env
-
#12444
28dd3ce
Thanks @ematipico! - Fixes an issue where a server island hydration script might fail case the island ID misses from the DOM. -
#12476
80a9a52
Thanks @florian-lefebvre! - Fixes a case where the Content Layerglob()
loader would not update when renaming or deleting an entry -
#12418
25baa4e
Thanks @oliverlynch! - Fix cached image redownloading if it is the first asset -
#12477
46f6b38
Thanks @ematipico! - Fixes an issue where the SSR build was emitting thedist/server/entry.mjs
file with an incorrect import at the top of the file/ -
#12365
a23985b
Thanks @apatel369! - Fixes an issue whereAstro.currentLocale
was not correctly returning the locale for 404 and 500 pages.
v4.16.13
Patch Changes
-
#12436
453ec6b
Thanks @martrapp! - Fixes a potential null access in the clientside router -
#12392
0462219
Thanks @apatel369! - Fixes an issue where scripts were not correctly injected during the build. The issue was triggered when there were injected routes with the sameentrypoint
and differentpattern
v4.16.12
Patch Changes
-
#12420
acac0af
Thanks @ematipico! - Fixes an issue where the dev server returns a 404 status code when a user middleware returns a validResponse
.
v4.16.11
Patch Changes
-
#12305
f5f7109
Thanks @florian-lefebvre! - Fixes a case where the error overlay would not escape the message -
#12402
823e73b
Thanks @ematipico! - Fixes a case where Astro allowed to call an action without usingAstro.callAction
. This is now invalid, and Astro will show a proper error.
v4.16.10
Patch Changes
-
#12311
bf2723e
Thanks @dinesh-58! - Addschecked
to the list of boolean attributes. -
#12363
222f718
Thanks @Fryuni! - Fixes code generated byastro add
command when adding a version of an integration other than the defaultlatest
. -
#12368
493fe43
Thanks @bluwy! - Improves error logs when executing commands -
#12355
c4726d7
Thanks @apatel369! - Improves error reporting for invalid frontmatter in MDX files during theastro build
command. The error message now includes the file path where the frontmatter parsing failed.
v4.16.9
Patch Changes
-
#12333
836cd91
Thanks @imattacus! - Destroy the server response stream if async error is thrown -
#12358
7680349
Thanks @spacedawwwg! - HonorsinlineAstroConfig
parameter ingetViteConfig
when creating a logger -
#12353
35795a1
Thanks @hippotastic! - Fixes an issue in dev server watch file handling that could cause multiple restarts for a single file change. -
#12351
5751488
Thanks @florian-lefebvre! - Reverts a change made in4.16.6
that prevented usage ofastro:env
secrets inside middleware in SSR -
#12346
20e5a84
Thanks @bluwy! - Fixes sourcemap generation when prefetch is enabled -
#12349
1fc83d3
Thanks @norskeld! - Fixes thegetImage
options type so it properly extendsImageTransform
v4.16.8
Patch Changes
-
#12338
9ca89b3
Thanks @situ2001! - ResetsNODE_ENV
to ensure install command run in dev mode -
#12286
9d6bcdb
Thanks @florian-lefebvre! - Fixes a case where a warning for experimentalastro:env
support would be shown when using an adapter but not actually usingastro:env
-
#12342
ffc836b
Thanks @liruifengv! - Fixes a typo in the command name of the CLI -
#12301
0cfc69d
Thanks @apatel369! - Fixes an issue with action handler context by passing the correct context (ActionAPIContext
). -
#12312
5642ef9
Thanks @koyopro! - Fixes an issue where usinggetViteConfig()
returns incorrect and duplicate configuration -
#12245
1d4f6a4
Thanks @bmenant! - Addcomponents
property to MDXInstance type definition (RenderResult and module import) -
#12340
94eaeea
Thanks @ematipico! - Fixes an issue where Astro actions didn't work whenbase
was different from/
v4.16.7
Patch Changes
-
#12263
e9e8080
Thanks @Fryuni! - Fixes conflict between server islands and on-demand dynamic routes in the form of/[...rest]
or/[paramA]/[paramB]
. -
#12279
b781f88
Thanks @jsparkdev! - Update wrong error message -
#12273
c2ee963
Thanks @ascorbic! - Fixes an issue with some package managers where sites would not build if TypeScript was not installed. -
#12235
a75bc5e
Thanks @ematipico! - Fixes a bug where Astro Actions couldn't redirect to the correct pathname when there was a rewrite involved. -
#11839
ff522b9
Thanks @icaliman! - Fixes error when returning a top-levelnull
from an Astro file frontmatter -
#12272
388d237
Thanks @ascorbic! - Correctly handles local images when using a base path in SSR
v4.16.6
Patch Changes
-
#11823
a3d30a6
Thanks @DerTimonius! - fix: improve error message when inferSize is used in local images with the Image component -
#12227
8b1a641
Thanks @florian-lefebvre! - Fixes a case where environment variables would not be refreshed when usingastro:env
-
#12239
2b6daa5
Thanks @ematipico! - BREAKING CHANGE to the experimental Container API onlyChanges the default page rendering behavior of Astro components in containers, and adds a new option
partial: false
to render full Astro pages as before.Previously, the Container API was rendering all Astro components as if they were full Astro pages containing
<!DOCTYPE html>
by default. This was not intended, and now by default, all components will render as page partials: only the contents of the components without a page shell.To render the component as a full-fledged Astro page, pass a new option called
partial: false
torenderToString()
andrenderToResponse()
:import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import Card from '../src/components/Card.astro'; const container = AstroContainer.create(); await container.renderToString(Card); // the string will not contain `<!DOCTYPE html>` await container.renderToString(Card, { partial: false }); // the string will contain `<!DOCTYPE html>`
v4.16.5
Patch Changes
-
#12232
ff68ba5
Thanks @martrapp! - Fixes an issue with cssesc in dev mode when settingvite.ssr.noExternal: true
v4.16.4
Patch Changes
-
#12223
79ffa5d
Thanks @ArmandPhilippot! - Fixes a false positive reported by the dev toolbar Audit app where a label was considered missing when associated with a buttonThe
button
element can be used with a label (e.g. to create a switch) and should not be reported as an accessibility issue when used as a child of alabel
. -
#12199
c351352
Thanks @ematipico! - Fixes a regression in the computation ofAstro.currentLocale
-
#12222
fb55695
Thanks @ematipico! - Fixes an issue where the edge middleware couldn't correctly compute the client IP address when callingctx.clientAddress()
v4.16.3
Patch Changes
-
#12220
b049359
Thanks @bluwy! - Fixes accidental internalsetOnSetGetEnv
parameter rename that caused runtime errors -
#12197
2aa2dfd
Thanks @ematipico! - Fix a regression where a port was incorrectly added to theAstro.url
v4.16.2
Patch Changes
-
#12206
12b0022
Thanks @bluwy! - Reverts https://github.com/withastro/astro/pull/12173 which causedCan't modify immutable headers
warnings and 500 errors on Cloudflare Pages
v4.16.1
Patch Changes
-
#12542
65e50eb
Thanks @kadykov! - Fix JPEG image size determination -
#12525
cf0d8b0
Thanks @ematipico! - Fixes an issue where withi18n
enabled, Astro couldn't render the404.astro
component for non-existent routes.
v4.16.0
Minor Changes
-
#12039
710a1a1
Thanks @ematipico! - Adds amarkdown.shikiConfig.langAlias
option that allows aliasing a non-supported code language to a known language. This is useful when the language of your code samples is not a built-in Shiki language, but you want your Markdown source to contain an accurate language while also displaying syntax highlighting.The following example configures Shiki to highlight
cjs
code blocks using thejavascript
syntax highlighter:import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { shikiConfig: { langAlias: { cjs: 'javascript', }, }, }, });
Then in your Markdown, you can use the alias as the language for a code block for syntax highlighting:
```cjs 'use strict'; function commonJs() { return 'I am a commonjs file'; } ```
-
#11984
3ac2263
Thanks @chaegumi! - Adds a newbuild.concurreny
configuration option to specify the number of pages to build in parallelIn most cases, you should not change the default value of
1
.Use this option only when other attempts to reduce the overall rendering time (e.g. batch or cache long running tasks like fetch calls or data access) are not possible or are insufficient.
Use this option only if the refactors are not possible. If the number is set too high, the page rendering may slow down due to insufficient memory resources and because JS is single-threaded.
[!WARNING] This feature is stable and is not considered experimental. However, this feature is only intended to address difficult performance issues, and breaking changes may occur in a minor release to keep this option as performant as possible.
// astro.config.mjs import { defineConfig } from 'astro'; export default defineConfig({ build: { concurrency: 2, }, });
Patch Changes
-
#12160
c6fd1df
Thanks @louisescher! - Fixes a bug whereastro.config.mts
andastro.config.cts
weren't reloading the dev server upon modifications. -
#12130
e96bcae
Thanks @thehansys! - Fixes a bug in the parsing ofx-forwarded-\*
Request
headers, where multiple values assigned to those headers were not correctly parsed.Now, headers like
x-forwarded-proto: https,http
are correctly parsed. -
#12147
9db755a
Thanks @ascorbic! - Skips setting statusMessage header for HTTP/2 responseHTTP/2 doesn't support status message, so setting this was logging a warning.
-
#12151
bb6d37f
Thanks @ematipico! - Fixes an issue whereAstro.currentLocale
wasn't incorrectly computed when thedefaultLocale
belonged to a custom locale path. -
Updated dependencies [
710a1a1
]:
v4.15.12
Patch Changes
-
#12121
2490ceb
Thanks @ascorbic! - Support passing the valuesInfinity
and-Infinity
as island props. -
#12118
f47b347
Thanks @Namchee! - Removes thestrip-ansi
dependency in favor of the native Node API -
#12126
6e1dfeb
Thanks @ascorbic! - Clear content layer cache when astro version changes -
#12117
a46839a
Thanks @ArmandPhilippot! - Updates Vite links to use their new domain -
#12124
499fbc9
Thanks @ascorbic! - Allows special characters in Action names -
#12123
b8673df
Thanks @Princesseuh! - Fixes missingbody
property on CollectionEntry types for content layer entries -
#12132
de35daa
Thanks @jcayzac! - Updates thecookie
dependency to avoid the CVE 2024-47764 vulnerability. -
#12113
a54e520
Thanks @ascorbic! - Adds a helpful error when attempting to render an undefined collection entry
v4.15.11
Patch Changes
-
#12097
11d447f
Thanks @ascorbic! - Fixes error where references in content layer schemas sometimes incorrectly report as missing -
#12108
918953b
Thanks @lameuler! - Fixes a bug where data URL images were not correctly handled. The bug resulted in anENAMETOOLONG
error. -
#12105
42037f3
Thanks @ascorbic! - Returns custom statusText that has been set in a Response -
#12109
ea22558
Thanks @ematipico! - Fixes a regression that was introduced by an internal refactor of how the middleware is loaded by the Astro application. The regression was introduced by #11550.When the edge middleware feature is opted in, Astro removes the middleware function from the SSR manifest, and this wasn't taken into account during the refactor.
-
#12106
d3a74da
Thanks @ascorbic! - Handles case where an immutable Response object is returned from an endpoint -
#12090
d49a537
Thanks @markjaquith! - Server islands: changes the server island HTML placeholder comment so that it is much less likely to get removed by HTML minifiers.
v4.15.10
Patch Changes
-
#12084
12dae50
Thanks @Princesseuh! - Adds missing filePath property on content layer entries -
#12046
d7779df
Thanks @martrapp! - View transitions: Fixes Astro's fade animation to prevent flashing during morph transitions. -
#12043
1720c5b
Thanks @bluwy! - Fixes injected endpointprerender
option detection -
#12095
76c5fbd
Thanks @TheOtterlord! - Fix installing non-stable versions of integrations withastro add
v4.15.9
Patch Changes
-
#12034
5b3ddfa
Thanks @ematipico! - Fixes an issue where the middleware wasn't called when a project uses404.astro
. -
#12042
243ecb6
Thanks @ematipico! - Fixes a problem in the Container API, where a polyfill wasn't correctly applied. This caused an issue in some environments wherecrypto
isn't supported. -
#12038
26ea5e8
Thanks @ascorbic! - Resolves image paths in content layer with initial slash as project-relativeWhen using the
image()
schema helper, previously paths with an initial slash were treated as public URLs. This was to match the behavior of markdown images. However this is a change from before, where paths with an initial slash were treated as project-relative. This change restores the previous behavior, so that paths with an initial slash are treated as project-relative.
v4.15.8
Patch Changes
-
#12014
53cb41e
Thanks @ascorbic! - Fixes an issue where component styles were not correctly included in rendered MDX -
#12031
8c0cae6
Thanks @ematipico! - Fixes a bug where the rewrite vianext(/*..*/)
inside a middleware didn't compute the newAPIContext.params
-
#12026
40e7a1b
Thanks @bluwy! - Initializes the Markdown processor only when there's.md
files -
#12028
d3bd673
Thanks @bluwy! - Handles route collision detection only if it matchesgetStaticPaths
-
#12027
dd3b753
Thanks @fviolette! - Addselected
to the list of boolean attributes -
#12001
9be3e1b
Thanks @uwej711! - Remove dependency on path-to-regexp
v4.15.7
Patch Changes
-
#12000
a2f8c5d
Thanks @ArmandPhilippot! - Fixes an outdated link used to document Content Layer API -
#11915
0b59fe7
Thanks @azhirov! - Fix: prevent island from re-rendering when using transition:persist (#11854)
v4.15.6
Patch Changes
-
#11993
ffba5d7
Thanks @matthewp! - Fix getStaticPaths regressionThis reverts a previous change meant to remove a dependency, to fix a regression with multiple nested spread routes.
-
#11964
06eff60
Thanks @TheOtterlord! - Add wayland (wl-copy) support toastro info
v4.15.5
Patch Changes
-
#11939
7b09c62
Thanks @bholmesdev! - Adds support for Zod discriminated unions on Action form inputs. This allows forms with different inputs to be submitted to the same action, using a given input to decide which object should be used for validation.This example accepts either a
create
orupdate
form submission, and uses thetype
field to determine which object to validate against.import { defineAction } from 'astro:actions'; import { z } from 'astro:schema'; export const server = { changeUser: defineAction({ accept: 'form', input: z.discriminatedUnion('type', [ z.object({ type: z.literal('create'), name: z.string(), email: z.string().email(), }), z.object({ type: z.literal('update'), id: z.number(), name: z.string(), email: z.string().email(), }), ]), async handler(input) { if (input.type === 'create') { // input is { type: 'create', name: string, email: string } } else { // input is { type: 'update', id: number, name: string, email: string } } }, }), };
The corresponding
create
andupdate
forms may look like this:
v4.15.4
Patch Changes
-
#11879
bd1d4aa
Thanks @matthewp! - Allow passing a cryptography key via ASTRO_KEYFor Server islands Astro creates a cryptography key in order to hash props for the islands, preventing accidental leakage of secrets.
If you deploy to an environment with rolling updates then there could be multiple instances of your app with different keys, causing potential key mismatches.
To fix this you can now pass the
ASTRO_KEY
environment variable to your build in order to reuse the same key.To generate a key use:
astro create-key
This will print out an environment variable to set like:
ASTRO_KEY=PIAuyPNn2aKU/bviapEuc/nVzdzZPizKNo3OqF/5PmQ=
-
#11935
c58193a
Thanks @Princesseuh! - Fixesastro add
not using the proper export point when adding certain adapters
v4.15.3
Patch Changes
-
#11902
d63bc50
Thanks @ascorbic! - Fixes case where content layer did not update during clean dev builds on Linux and Windows -
#11886
7ff7134
Thanks @matthewp! - Fixes a missing error message when actions throws duringastro sync
-
#11904
ca54e3f
Thanks @wtchnm! - perf(assets): avoid downloading original image when using cache
v4.15.2
Patch Changes
-
#11870
8e5257a
Thanks @ArmandPhilippot! - Fixes typo in documenting thefallbackType
property in i18n routing -
#11884
e450704
Thanks @ascorbic! - Correctly handles content layer data where the transformed value does not match the input schema -
#11900
80b4a18
Thanks @delucis! - Fixes the user-facing type of the newi18n.routing.fallbackType
option to be optional
v4.15.1
Patch Changes
-
#12121
2490ceb
Thanks @ascorbic! - Support passing the valuesInfinity
and-Infinity
as island props. -
#12118
f47b347
Thanks @Namchee! - Removes thestrip-ansi
dependency in favor of the native Node API -
#12126
6e1dfeb
Thanks @ascorbic! - Clear content layer cache when astro version changes -
#12117
a46839a
Thanks @ArmandPhilippot! - Updates Vite links to use their new domain -
#12124
499fbc9
Thanks @ascorbic! - Allows special characters in Action names -
#12123
b8673df
Thanks @Princesseuh! - Fixes missingbody
property on CollectionEntry types for content layer entries -
#12132
de35daa
Thanks @jcayzac! - Updates thecookie
dependency to avoid the CVE 2024-47764 vulnerability. -
#12113
a54e520
Thanks @ascorbic! - Adds a helpful error when attempting to render an undefined collection entry
v4.15.0
Minor Changes
-
#11729
1c54e63
Thanks @ematipico! - Adds a new variantsync
for theastro:config:setup
hook'scommand
property. This value is set when calling the commandastro sync
.If your integration previously relied on knowing how many variants existed for the
command
property, you must update your logic to account for this new option. -
#11743
cce0894
Thanks @ph1p! - Adds a new, optional propertytimeout
for theclient:idle
directive.This value allows you to specify a maximum time to wait, in milliseconds, before hydrating a UI framework component, even if the page is not yet done with its initial load. This means you can delay hydration for lower-priority UI elements with more control to ensure your element is interactive within a specified time frame.
<ShowHideButton client:idle={{ timeout: 500 }} />
-
#11677
cb356a5
Thanks @ematipico! - Adds a new optionfallbackType
toi18n.routing
configuration that allows you to control how fallback pages are handled.When
i18n.fallback
is configured, this new routing option controls whether to redirect to the fallback page, or to rewrite the fallback page's content in place.The
"redirect"
option is the default value and matches the current behavior of the existing fallback system.The option
"rewrite"
uses the new rewriting system to create fallback pages that render content on the original, requested URL without a browser refresh.For example, the following configuration will generate a page
/fr/index.html
that will contain the same HTML rendered by the page/en/index.html
whensrc/pages/fr/index.astro
does not exist.// astro.config.mjs export default defineConfig({ i18n: { locals: ['en', 'fr'], defaultLocale: 'en', routing: { prefixDefaultLocale: true, fallbackType: 'rewrite', }, fallback: { fr: 'en', }, }, });
-
#11708
62b0d20
Thanks @martrapp! - Adds a new objectswapFunctions
to expose the necessary utility functions onastro:transitions/client
that allow you to build custom swap functions to be used with view transitions.The example below uses these functions to replace Astro's built-in default
swap
function with one that only swaps the<main>
part of the page:<script> import { swapFunctions } from 'astro:transitions/client'; document.addEventListener('astro:before-swap', (e) => { e.swap = () => swapMainOnly(e.newDocument) }); function swapMainOnly(doc: Document) { swapFunctions.deselectScripts(doc); swapFunctions.swapRootAttributes(doc); swapFunctions.swapHeadElements(doc); const restoreFocusFunction = swapFunctions.saveFocus(); const newMain = doc.querySelector('main'); const oldMain = document.querySelector('main'); if (newMain && oldMain) { swapFunctions.swapBodyElement(newMain, oldMain); } else { swapFunctions.swapBodyElement(doc.body, document.body); } restoreFocusFunction(); }; </script>
See the view transitions guide for more information about hooking into the
astro:before-swap
lifecycle event and adding a custom swap implementation. -
#11843
5b4070e
Thanks @bholmesdev! - Exposesz
from the newastro:schema
module. This is the new recommended import source for all Zod utilities when using Astro Actions.
v4.14.6
Patch Changes
-
#11847
45b599c
Thanks @ascorbic! - Fixes a case where Vite would be imported by the SSR runtime, causing bundling errors and bloat. -
#11822
6fcaab8
Thanks @bluwy! - Marks internalvite-plugin-fileurl
plugin withenforce: 'pre'
-
#11713
497324c
Thanks @voidfill! - Prevents prefetching of the same urls with different hashes. -
#11814
2bb72c6
Thanks @eduardocereto! - Updates the documentation for experimental Content Layer API with a corrected code example -
#11842
1ffaae0
Thanks @stephan281094! - Fixes a typo in theMissingImageDimension
error message -
#11828
20d47aa
Thanks @bholmesdev! - Improves error message when invalid data is returned by an Action.
v4.14.5
Patch Changes
-
#11809
62e97a2
Thanks @bholmesdev! - Fixes usage of.transform()
,.refine()
,.passthrough()
, and other effects on Action form inputs. -
#11812
260c4be
Thanks @bholmesdev! - ExposesActionAPIContext
type from theastro:actions
module. -
#11813
3f7630a
Thanks @bholmesdev! - Fixes unexpectedundefined
value when calling an action from the client without a return value.
v4.14.4
Patch Changes
-
#11794
3691a62
Thanks @bholmesdev! - Fixes unexpected warning log when using Actions on "hybrid" rendered projects. -
#11801
9f943c1
Thanks @delucis! - Fixes a bug where thefilePath
property was not available on content collection entries when using the content layerfile()
loader with a JSON file that contained an object instead of an array. This was breaking use of theimage()
schema utility among other things.
v4.14.3
Patch Changes
-
#11780
c6622ad
Thanks @Princesseuh! - Deprecates the Squoosh image service, to be removed in Astro 5.0. We recommend migrating to the default Sharp service. -
#11790
41c3fcb
Thanks @sarah11918! - Updates the documentation for experimentalastro:env
with a corrected link to the RFC proposal -
#11773
86a3391
Thanks @ematipico! - Changes messages logged when using unsupported, deprecated, or experimental adapter features for clarity -
#11745
89bab1e
Thanks @bluwy! - Prints prerender dynamic value usage warning only if it's used -
#11774
c6400ab
Thanks @florian-lefebvre! - Fixes the path returned byinjectTypes
-
#11730
2df49a6
Thanks @florian-lefebvre! - Simplifies path operations ofastro sync
-
#11771
49650a4
Thanks @florian-lefebvre! - Fixes an error thrown byastro sync
when anastro:env
virtual module is imported inside the Content Collections config -
#11744
b677429
Thanks @bluwy! - Disables the WebSocket server when creating a Vite server for loading config files
v4.14.2
Patch Changes
v4.14.1
Patch Changes
-
#11725
6c1560f
Thanks @ascorbic! - Prevents content layer importing node builtins in runtime -
#11692
35af73a
Thanks @matthewp! - Prevent errant HTML from crashing server islandsWhen an HTML minifier strips away the server island comment, the script can't correctly know where the end of the fallback content is. This makes it so that it simply doesn't remove any DOM in that scenario. This means the fallback isn't removed, but it also doesn't crash the browser.
-
#11727
3c2f93b
Thanks @florian-lefebvre! - Fixes a type issue when using the Content Layer in dev
v4.14.0
Minor Changes
-
#11657
a23c69d
Thanks @bluwy! - Deprecates the option for route-generating files to export a dynamic value forprerender
. Only static values are now supported (e.g.export const prerender = true
or= false
). This allows for better treeshaking and bundling configuration in the future.Adds a new
"astro:route:setup"
hook to the Integrations API to allow you to dynamically set options for a route at build or request time through an integration, such as enabling on-demand server rendering.To migrate from a dynamic export to the new hook, update or remove any dynamic
prerender
exports from individual routing files:// src/pages/blog/[slug].astro - export const prerender = import.meta.env.PRERENDER
Instead, create an integration with the
"astro:route:setup"
hook and update the route'sprerender
option:// astro.config.mjs import { defineConfig } from 'astro/config'; import { loadEnv } from 'vite'; export default defineConfig({ integrations: [setPrerender()], }); function setPrerender() { const { PRERENDER } = loadEnv(process.env.NODE_ENV, process.cwd(), ''); return { name: 'set-prerender', hooks: { 'astro:route:setup': ({ route }) => { if (route.component.endsWith('/blog/[slug].astro')) { route.prerender = PRERENDER; } }, }, }; }
-
#11360
a79a8b0
Thanks @ascorbic! - Adds a newinjectTypes()
utility to the Integration API and refactors how type generation worksUse
injectTypes()
in theastro:config:done
hook to inject types into your user's project by adding a new a*.d.ts
file.The
filename
property will be used to generate a file at/.astro/integrations/<normalized_integration_name>/<normalized_filename>.d.ts
and must end with".d.ts"
.The
content
property will create the body of the file, and must be valid TypeScript.Additionally,
injectTypes()
returns a URL to the normalized path so you can overwrite its content later on, or manipulate it in any way you want.// my-integration/index.js export default { name: 'my-integration', 'astro:config:done': ({ injectTypes }) => { injectTypes({ filename: 'types.d.ts', content: "declare module 'virtual:my-integration' {}", }); }, };
Codegen has been refactored. Although
src/env.d.ts
will continue to work as is, we recommend you update it:- /// <reference types="astro/client" /> + /// <reference path="../.astro/types.d.ts" /> - /// <reference path="../.astro/env.d.ts" /> - /// <reference path="../.astro/actions.d.ts" />
-
#11605
d3d99fb
Thanks @jcayzac! - Adds a new propertymeta
to Astro's built-in<Code />
component.This allows you to provide a value for Shiki's
meta
attribute to pass options to transformers.The following example passes an option to highlight lines 1 and 3 to Shiki's
tranformerMetaHighlight
:
v4.13.4
Patch Changes
-
#11678
34da907
Thanks @ematipico! - Fixes a case where omitting a semicolon and line ending with carriage return - CRLF - in theprerender
option could throw an error. -
#11535
932bd2e
Thanks @matthewp! - Encrypt server island propsServer island props are now encrypted with a key generated at build-time. This is intended to prevent accidentally leaking secrets caused by exposing secrets through prop-passing. This is not intended to allow a server island to be trusted to skip authentication, or to protect against any other vulnerabilities other than secret leakage.
See the RFC for an explanation: https://github.com/withastro/roadmap/blob/server-islands/proposals/server-islands.md#props-serialization
-
#11655
dc0a297
Thanks @billy-le! - Fixes Astro Actionsinput
validation when usingdefault
values with a form input. -
#11689
c7bda4c
Thanks @ematipico! - Fixes an issue in the Astro actions, where the size of the generated cookie was exceeding the size permitted by theSet-Cookie
header.
v4.13.3
Patch Changes
-
#11653
32be549
Thanks @florian-lefebvre! - Updatesastro:env
docs to reflect current developments and usage guidance -
#11658
13b912a
Thanks @bholmesdev! - FixesorThrow()
type when calling an Action without aninput
validator. -
#11603
f31d466
Thanks @bholmesdev! - Improves user experience when render an Action result from a form POST request:- Removes "Confirm post resubmission?" dialog when refreshing a result.
- Removes the
?_astroAction=NAME
flag when a result is rendered.
Also improves the DX of directing to a new route on success. Actions will now redirect to the route specified in your
action
string on success, and redirect back to the previous page on error. This follows the routing convention of established backend frameworks like Laravel.For example, say you want to redirect to a
/success
route whenactions.signup
succeeds. You can add/success
to youraction
string like so:<form method="POST" action={'/success' + actions.signup}></form>
- On success, Astro will redirect to
/success
. - On error, Astro will redirect back to the current page.
You can retrieve the action result from either page using the
Astro.getActionResult()
function.
Note on security
This uses a temporary cookie to forward the action result to the next page. The cookie will be deleted when that page is rendered.
login
function may return a user's session id to retrieve from your Astro frontmatter, rather than the entire user object.
v4.13.2
Patch Changes
-
#11648
589d351
Thanks @bholmesdev! - Fixes unexpected error when refreshing a POST request from a form using Actions. -
#11600
09ec2ca
Thanks @ArmandPhilippot! - DeprecatesgetEntryBySlug
andgetDataEntryById
functions exported byastro:content
in favor ofgetEntry
. -
#11593
81d7150
Thanks @bholmesdev! - Adds support forDate()
,Map()
, andSet()
from action results. See devalue for a complete list of supported values.Also fixes serialization exceptions when deploying Actions with edge middleware on Netlify and Vercel.
-
#11617
196092a
Thanks @abubakriz! - Fix toolbar audit incorrectly flagging images as above the fold. -
#11634
2716f52
Thanks @bholmesdev! - Fixes internal server error when calling an Astro Action without arguments on Vercel. -
#11628
9aaf58c
Thanks @madbook! - Ensures consistent CSS chunk hashes across different environments
v4.13.1
Patch Changes
-
#11584
a65ffe3
Thanks @bholmesdev! - Removes async local storage dependency from Astro Actions. This allows Actions to run in Cloudflare and Stackblitz without opt-in flags or other configuration.This also introduces a new convention for calling actions from server code. Instead of calling actions directly, you must wrap function calls with the new
Astro.callAction()
utility.callAction()
is meant to trigger an action from server code.getActionResult()
usage with form submissions remains unchanged.
v4.13.0
Minor Changes
-
#11507
a62345f
Thanks @ematipico! - Adds color-coding to the console output during the build to highlight slow pages.Pages that take more than 500 milliseconds to render will have their build time logged in red. This change can help you discover pages of your site that are not performant and may need attention.
-
#11379
e5e2d3e
Thanks @alexanderniebuhr! - Theexperimental.contentCollectionJsonSchema
feature introduced behind a flag in v4.5.0 is no longer experimental and is available for general use.If you are working with collections of type
data
, Astro will now auto-generate JSON schema files for your editor to get IntelliSense and type-checking. A separate file will be created for each data collection in your project based on your collections defined insrc/content/config.ts
using a library calledzod-to-json-schema
.This feature requires you to manually set your schema's file path as the value for
$schema
in each data entry file of the collection:{ "$schema": "../../../.astro/collections/authors.schema.json", "name": "Armand", "skills": ["Astro", "Starlight"] }
Alternatively, you can set this value in your editor settings. For example, to set this value in VSCode's
json.schemas
setting, provide the path of files to match and the location of your JSON schema:{ "json.schemas": [ { "fileMatch": ["/src/content/authors/**"], "url": "./.astro/collections/authors.schema.json" } ] }
If you were previously using this feature, please remove the experimental flag from your Astro config:
import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - contentCollectionJsonSchema: true - } })
If you have been waiting for stabilization before using JSON Schema generation for content collections, you can now do so.
Please see the content collections guide for more about this feature.
-
#11542
45ad326
Thanks @ematipico! - Theexperimental.rewriting
feature introduced behind a flag in v4.8.0 is no longer experimental and is available for general use.Astro.rewrite()
andcontext.rewrite()
allow you to render a different page without changing the URL in the browser. Unlike using a redirect, your visitor is kept on the original page they visited.Rewrites can be useful for showing the same content at multiple paths (e.g. /products/shoes/men/ and /products/men/shoes/) without needing to maintain two identical source files.
Rewrites are supported in Astro pages, endpoints, and middleware.
Return
Astro.rewrite()
in the frontmatter of a.astro
page component to display a different page's content, such as fallback localized content:
v4.12.3
Patch Changes
-
#11509
dfbca06
Thanks @bluwy! - Excludes hoisted scripts and styles from Astro components imported with?url
or?raw
-
#11561
904f1e5
Thanks @ArmandPhilippot! - Uses the correct pageSize default inpage.size
JSDoc comment -
#11571
1c3265a
Thanks @bholmesdev! - BREAKING CHANGE to the experimental Actions API only. Install the latest@astrojs/react
integration as well if you're using React 19 features.Make
.safe()
the default return value for actions. This means{ data, error }
will be returned when calling an action directly. If you prefer to get the data while allowing errors to throw, chain the.orThrow()
modifier.import { actions } from 'astro:actions'; // Before const { data, error } = await actions.like.safe(); // After const { data, error } = await actions.like(); // Before const newLikes = await actions.like(); // After const newLikes = await actions.like.orThrow();
v4.12.2
Patch Changes
-
#11505
8ff7658
Thanks @ematipico! - Enhances the dev server logging when rewrites occur during the lifecycle or rendering.The dev server will log the status code before and after a rewrite:
08:16:48 [404] (rewrite) /foo/about 200ms 08:22:13 [200] (rewrite) /about 23ms
-
#11506
026e8ba
Thanks @sarah11918! - Fixes typo in documenting theslot="fallback"
attribute for Server Islands experimental feature. -
#11508
ca335e1
Thanks @cramforce! - Escapes HTML in serialized props -
#11501
4db78ae
Thanks @martrapp! - Adds the missing export for accessing thegetFallback()
function of the client site router.
v4.12.1
Patch Changes
-
#11486
9c0c849
Thanks @ematipico! - Adds a new function calledaddClientRenderer
to the Container API.This function should be used when rendering components using the
client:*
directives. TheaddClientRenderer
API must be used after the use of theaddServerRenderer
:const container = await experimental_AstroContainer.create(); container.addServerRenderer({ renderer }); container.addClientRenderer({ name: '@​astrojs/react', entrypoint: '@​astrojs/react/client.js' }); const response = await container.renderToResponse(Component);
-
#11500
4e142d3
Thanks @Princesseuh! - Fixes inferRemoteSize type not working -
#11496
53ccd20
Thanks @alfawal! - Hide the dev toolbar onwindow.print()
(CTRL + P)
v4.12.0
Minor Changes
-
#11341
49b5145
Thanks @madcampos! - Adds support for Shiki'sdefaultColor
option.This option allows you to override the values of a theme's inline style, adding only CSS variables to give you more flexibility in applying multiple color themes.
Configure
defaultColor: false
in your Shiki config to apply throughout your site, or pass to Astro's built-in<Code>
component to style an individual code block.import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { shikiConfig: { themes: { light: 'github-light', dark: 'github-dark', }, defaultColor: false, }, }, });
v4.11.6
Patch Changes
-
#11459
bc2e74d
Thanks @mingjunlu! - Fixes false positive audit warnings on elements with the role "tabpanel". -
#11472
cb4e6d0
Thanks @delucis! - Avoids targeting all files in thesrc/
directory for eager optimization by Vite. After this change, only JSX, Vue, Svelte, and Astro components get scanned for early optimization. -
#11387
b498461
Thanks @bluwy! - Fixes prerendering not removing unused dynamic imported chunks -
#11437
6ccb30e
Thanks @NuroDev! - Fixes a case where Astro's configexperimental.env.schema
keys did not allow numbers. Numbers are still not allowed as the first character to be able to generate valid JavaScript identifiers -
#11439
08baf56
Thanks @bholmesdev! - Expands theisInputError()
utility fromastro:actions
to accept errors of any type. This should now allow type narrowing from a try / catch block.// example.ts import { actions, isInputError } from 'astro:actions'; try { await actions.like(new FormData()); } catch (error) { if (isInputError(error)) { console.log(error.fields); } }
-
#11452
0e66849
Thanks @FugiTech! - Fixes an issue where using .nullish() in a formdata Astro action would always parse as a string -
#11438
619f07d
Thanks @bholmesdev! - Exposes utility types fromastro:actions
for thedefineAction
handler (ActionHandler
) and theActionError
code (ActionErrorCode
). -
#11456
17e048d
Thanks @RickyC0626! - Fixesastro dev --open
unexpected behavior that spawns a new tab every time a config file is saved -
#11337
0a4b31f
Thanks @florian-lefebvre! - Adds a new propertyexperimental.env.validateSecrets
to allow validating private variables on the server.By default, this is set to
false
and only public variables are checked on start. If enabled, secrets will also be checked on start (dev/build modes). This is useful for example in some CIs to make sure all your secrets are correctly set before deploying.// astro.config.mjs import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { // ... }, validateSecrets: true, }, }, });
-
#11443
ea4bc04
Thanks @bholmesdev! - Expose newActionReturnType
utility fromastro:actions
. This infers the return type of an action by passingtypeof actions.name
as a type argument. This example defines alike
action that returnslikes
as an object:// actions/index.ts import { defineAction } from 'astro:actions'; export const server = { like: defineAction({ handler: () => { /* ... */ return { likes: 42 }; }, }), };
In your client code, you can infer this handler return value with
ActionReturnType
:// client.ts import { actions, ActionReturnType } from 'astro:actions'; type LikesResult = ActionReturnType<typeof actions.like>; // -> { likes: number }
-
#11436
7dca68f
Thanks @bholmesdev! - Fixesastro:actions
autocompletion for thedefineAction
accept
property -
#11455
645e128
Thanks @florian-lefebvre! - Improvesastro:env
invalid variables errors
v4.11.5
Patch Changes
-
#11408
b9e906f
Thanks @matthewp! - Revert change to how boolean attributes work
v4.11.4
Patch Changes
-
#11362
93993b7
Thanks @ematipico! - Fixes an issue where creating manually the i18n middleware could break the logic of the functions of the virtual moduleastro:i18n
-
#11349
98d9ce4
Thanks @ematipico! - Fixes an issue where Astro didn't throw an error whenAstro.rewrite
was used without providing the experimental flag -
#11352
a55ee02
Thanks @ematipico! - Fixes an issue where the rewrites didn't update the status code when using manual i18n routing. -
#11388
3a223b4
Thanks @mingjunlu! - Adjusts the color of punctuations in error overlay. -
#11369
e6de11f
Thanks @bluwy! - Fixes attribute rendering for non-boolean attributes with boolean values
v4.11.3
Patch Changes
-
#11347
33bdc54
Thanks @bluwy! - Fixes installed packages detection when runningastro check
-
#11327
0df8142
Thanks @ematipico! - Fixes an issue with the container APIs where a runtime error was thrown during the build, when usingpnpm
as package manager.
v4.11.2
Patch Changes
-
#11335
4c4741b
Thanks @ematipico! - Reverts #11292, which caused a regression to the input type -
#11326
41121fb
Thanks @florian-lefebvre! - Fixes a case where runningastro sync
when using the experimentalastro:env
feature would fail if environment variables were missing -
#11338
9752a0b
Thanks @zaaakher! - Fixes svg icon margin in devtool tooltip title to look coherent inrtl
andltr
layouts -
#11331
f1b78a4
Thanks @bluwy! - Removesresolve
package and simplify internal resolve check -
#11339
8fdbf0e
Thanks @matthewp! - Remove non-fatal errors from telemetryPreviously we tracked non-fatal errors in telemetry to get a good idea of the types of errors that occur in
astro dev
. However this has become noisy over time and results in a lot of data that isn't particularly useful. This removes those non-fatal errors from being tracked.
v4.11.1
Patch Changes
-
#11308
44c61dd
Thanks @ematipico! - Fixes an issue where custom404.astro
and500.astro
were not returning the correct status code when rendered inside a rewriting cycle. -
#11302
0622567
Thanks @martrapp! - Fixes an issue with the view transition router when redirecting to an URL with different origin.
v4.11.0
Minor Changes
-
#11197
4b46bd9
Thanks @braebo! - AddsShikiTransformer
support to the<Code />
component with a newtransformers
prop.Note that
transformers
only applies classes and you must provide your own CSS rules to target the elements of your code block.
v4.10.3
Patch Changes
-
#11213
94ac7ef
Thanks @florian-lefebvre! - Removes thePUBLIC_
prefix constraint forastro:env
public variables -
#11213
94ac7ef
Thanks @florian-lefebvre! - BREAKING CHANGE to the experimentalastro:env
feature onlyServer secrets specified in the schema must now be imported from
astro:env/server
. UsinggetSecret()
is no longer required to use these environment variables in your schema:- import { getSecret } from 'astro:env/server' - const API_SECRET = getSecret("API_SECRET") + import { API_SECRET } from 'astro:env/server'
Note that using
getSecret()
with these keys is still possible, but no longer involves any special handling and the raw value will be returned, just like retrieving secrets not specified in your schema. -
#11234
4385bf7
Thanks @ematipico! - Adds a new function calledaddServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro'; import { experimental_AstroContainer } from 'astro/container'; import reactRenderer from '@​astrojs/react/server.js'; import vueRenderer from '@​astrojs/vue/server.js'; import ReactComponent from '../components/button.jsx'; import VueComponent from '../components/button.vue'; // MDX runtime is contained inside the Astro core import mdxRenderer from 'astro/jsx/server.js'; // In case you need to import a custom renderer import customRenderer from '../renderers/customRenderer.js'; export const GET: APIRoute = async (ctx) => { const container = await experimental_AstroContainer.create(); container.addServerRenderer({ renderer: reactRenderer }); container.addServerRenderer({ renderer: vueRenderer }); container.addServerRenderer({ renderer: customRenderer }); // You can pass a custom name too container.addServerRenderer({ name: 'customRenderer', renderer: customRenderer, }); const vueComponent = await container.renderToString(VueComponent); return await container.renderToResponse(Component); };
-
#11249
de60c69
Thanks @markgaze! - Fixes a performance issue with JSON schema generation -
#11242
e4fc2a0
Thanks @ematipico! - Fixes a case where the virtual moduleastro:container
wasn't resolved -
#11236
39bc3a5
Thanks @ascorbic! - Fixes a case where symlinked content collection directories were not correctly resolved -
#11258
d996db6
Thanks @ascorbic! - Adds a new errorRewriteWithBodyUsed
that throws whenAstro.rewrite
is used after the request body has already been read. -
#11243
ba2b14c
Thanks @V3RON! - Fixes a prerendering issue for libraries innode_modules
when a folder with an underscore is in the path. -
#11244
d07d2f7
Thanks @ematipico! - Improves the developer experience of the custom500.astro
page in development mode.Before, in development, an error thrown during the rendering phase would display the default error overlay, even when users had the
500.astro
page.Now, the development server will display the
500.astro
and the original error is logged in the console. -
#11240
2851b0a
Thanks @ascorbic! - Ignores query strings in module identifiers when matching ".astro" file extensions in Vite plugin -
#11245
e22be22
Thanks @bluwy! - Refactors prerendering chunk handling to correctly remove unused code during the SSR runtime
v4.10.2
Patch Changes
-
#11231
58d7dbb
Thanks @ematipico! - Fixes a regression forgetViteConfig
, where the inline config wasn't merged in the final config. -
#11228
1e293a1
Thanks @ascorbic! - UpdatesgetCollection()
to always return a cloned array -
#11207
7d9aac3
Thanks @ematipico! - Fixes an issue in the rewriting logic where old data was not purged during the rewrite flow. This caused some false positives when checking the validity of URL path names during the rendering phase. -
#11189
75a8fe7
Thanks @ematipico! - Improve error message when usinggetLocaleByPath
on path that doesn't contain any locales. -
#11195
0a6ab6f
Thanks @florian-lefebvre! - Adds support for enums toastro:env
You can now call
envField.enum
:import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { API_VERSION: envField.enum({ context: 'server', access: 'secret', values: ['v1', 'v2'], }), }, }, }, });
-
#11210
66fc028
Thanks @matthewp! - Close the iterator only after rendering is complete -
#11195
0a6ab6f
Thanks @florian-lefebvre! - Adds additional validation options toastro:env
astro:env
schema datatypesstring
andnumber
now have new optional validation rules:import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { FOO: envField.string({ // ... max: 32, min: 3, length: 12, url: true, includes: 'foo', startsWith: 'bar', endsWith: 'baz', }), BAR: envField.number({ // ... gt: 2, min: 3, lt: 10, max: 9, int: true, }), }, }, }, });
-
#11211
97724da
Thanks @matthewp! - Let middleware handle the original request URL -
#10607
7327c6a
Thanks @frankbits! - Fixes an issue where a leading slash created incorrect conflict resolution between pages generated from static routes and catch-all dynamic routes
v4.10.1
Patch Changes
-
#11198
8b9a499
Thanks @florian-lefebvre! - Fixes a case whereastro:env
getSecret
would not retrieve environment variables properly in dev and build modes -
#11206
734b98f
Thanks @florian-lefebvre! - BREAKING CHANGE to the experimentalastro:env
feature onlyUpdates the adapter
astro:env
entrypoint fromastro:env/setup
toastro/env/setup
-
#11205
8c45391
Thanks @Nin3lee! - Fixes a typo in the config reference
v4.10.0
Minor Changes
-
#10974
2668ef9
Thanks @florian-lefebvre! - Adds experimental support for theastro:env
API.The
astro:env
API lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. Import and use your defined variables from the appropriate/client
or/server
module:
v4.9.3
Patch Changes
-
#11171
ff8004f
Thanks @Princesseuh! - Guard globalThis.astroAsset usage in proxy code to avoid errors in wonky situations -
#11178
1734c49
Thanks @theoephraim! - ImprovesisPromise
utility to check the presence ofthen
on an object before trying to access it - which can cause undesired side-effects on Proxy objects -
#11183
3cfa2ac
Thanks @66Leo66! - Suggestpnpm dlx
instead ofpnpx
in update check. -
#11147
2d93902
Thanks @kitschpatrol! - Fixes invalid MIME types in Picture source elements for jpg and svg extensions, which was preventing otherwise valid source variations from being shown by the browser -
#11141
19df89f
Thanks @ematipico! - Fixes an internal error that prevented theAstroContainer
to render theContent
component.You can now write code similar to the following to render content collections:
const entry = await getEntry(collection, slug); const { Content } = await entry.render(); const content = await container.renderToString(Content);
-
#11170
ba20c71
Thanks @matthewp! - Retain client scripts in content cache
v4.9.2
Patch Changes
-
#11138
98e0372
Thanks @ematipico! - You can now passprops
when rendering a component using the Container APIs:import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import Card from '../src/components/Card.astro'; const container = await AstroContainer.create(); const result = await container.renderToString(Card, { props: { someState: true, }, });
v4.9.1
Patch Changes
-
#11129
4bb9269
Thanks @matthewp! - Prevent errors from adapters when i18n domains is not used
v4.9.0
Minor Changes
-
#11051
12a1bcc
Thanks @ematipico! - Introduces an experimental Container API to render.astro
components in isolation.This API introduces three new functions to allow you to create a new container and render an Astro component returning either a string or a Response:
-
create()
: creates a new instance of the container. -
renderToString()
: renders a component and return a string. -
renderToResponse()
: renders a component and returns theResponse
emitted by the rendering phase.
The first supported use of this new API is to enable unit testing. For example, with
vitest
, you can create a container to render your component with test data and check the result:import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import { expect, test } from 'vitest'; import Card from '../src/components/Card.astro'; test('Card with slots', async () => { const container = await AstroContainer.create(); const result = await container.renderToString(Card, { slots: { default: 'Card content', }, }); expect(result).toContain('This is a card'); expect(result).toContain('Card content'); });
For a complete reference, see the Container API docs.
For a feature overview, and to give feedback on this experimental API, see the Container API roadmap discussion.
-
-
#11021
2d4c8fa
Thanks @ematipico! - The CSRF protection feature that was introduced behind a flag in v4.6.0 is no longer experimental and is available for general use.To enable the stable version, add the new top-level
security
option inastro.config.mjs
. If you were previously using the experimental version of this feature, also delete the experimental flag:export default defineConfig({ - experimental: { - security: { - csrfProtection: { - origin: true - } - } - }, + security: { + checkOrigin: true + } })
Enabling this setting performs a check that the
"origin"
header, automatically passed by all modern browsers, matches the URL sent by each Request.This check is executed only for pages rendered on demand, and only for the requests
POST
,PATCH
,DELETE
andPUT
with one of the following"content-type"
headers:'application/x-www-form-urlencoded'
,'multipart/form-data'
,'text/plain'
.If the
"origin"
header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page.For more information, see the
security
configuration docs. -
#11022
be68ab4
Thanks @ematipico! - Thei18nDomains
routing feature introduced behind a flag in v3.4.0 is no longer experimental and is available for general use.This routing option allows you to configure different domains for individual locales in entirely server-rendered projects using the @astrojs/node or @astrojs/vercel adapter with a
site
configured.If you were using this feature, please remove the experimental flag from your Astro config:
import { defineConfig } from 'astro' export default defineConfig({ - experimental: { - i18nDomains: true, - } })
If you have been waiting for stabilization before using this routing option, you can now do so.
Please see the internationalization docs for more about this feature.
-
#11071
8ca7c73
Thanks @bholmesdev! - Adds two new functionsexperimental_getActionState()
andexperimental_withState()
to support the React 19useActionState()
hook when using Astro Actions. This introduces progressive enhancement when calling an Action with thewithState()
utility.This example calls a
like
action that accepts apostId
and returns the number of likes. Pass this action to theexperimental_withState()
function to apply progressive enhancement info, and apply touseActionState()
to track the result:import { actions } from 'astro:actions'; import { experimental_withState } from '@​astrojs/react/actions'; export function Like({ postId }: { postId: string }) { const [state, action, pending] = useActionState( experimental_withState(actions.like), 0, // initial likes ); return ( <form action={action}> <input type="hidden" name="postId" value={postId} /> <button disabled={pending}>{state} ❤️</button> </form> ); }
You can also access the state stored by
useActionState()
from your actionhandler
. Callexperimental_getActionState()
with the API context, and optionally apply a type to the result:import { defineAction, z } from 'astro:actions'; import { experimental_getActionState } from '@​astrojs/react/actions'; export const server = { like: defineAction({ input: z.object({ postId: z.string(), }), handler: async ({ postId }, ctx) => { const currentLikes = experimental_getActionState<number>(ctx); // write to database return currentLikes + 1; }, }), };
-
#11101
a6916e4
Thanks @linguofeng! - Updates Astro's code for adapters to use the headerx-forwarded-for
to initialize theclientAddress
.To take advantage of the new change, integration authors must upgrade the version of Astro in their adapter
peerDependencies
to4.9.0
. -
#11071
8ca7c73
Thanks @bholmesdev! - Adds compatibility for Astro Actions in the React 19 beta. Actions can be passed to aform action
prop directly, and Astro will automatically add metadata for progressive enhancement.import { actions } from 'astro:actions'; function Like() { return ( <form action={actions.like}> {/* auto-inserts hidden input for progressive enhancement */} <button type="submit">Like</button> </form> ); }
Patch Changes
-
#11088
9566fa0
Thanks @bholmesdev! - Allow actions to be called on the server. This allows you to call actions as utility functions in your Astro frontmatter, endpoints, and server-side UI components.Import and call directly from
astro:actions
as you would for client actions:
v4.8.7
Patch Changes
-
#11073
f5c8fee
Thanks @matthewp! - Prevent cache content from being left in dist folderWhen
contentCollectionsCache
is enabled temporary cached content is copied into theoutDir
for processing. This fixes it so that this content is cleaned out, along with the rest of the temporary build JS. -
#11054
f6b171e
Thanks @bholmesdev! - Respect error status when handling Actions with a progressive fallback. -
#11092
bfe9c73
Thanks @duckycoding-dev! - Changeslot
attribute ofIntrinsicAttributes
to match the definition ofHTMLAttributes
's ownslot
attribute of typestring | undefined | null
-
#10875
b5f95b2
Thanks @W1M0R! - Fixes a typo in a JSDoc annotation -
#11111
a5d79dd
Thanks @bholmesdev! - Fix unexpectedheaders
warning on prerendered routes when using Astro Actions. -
#11081
af42e05
Thanks @V3RON! - Correctly position inspection tooltip in RTL modeWhen RTL mode is turned on, the inspection tooltip tend to overflow the window on the left side. Additional check has been added to prevent that.
v4.8.6
Patch Changes
-
#11084
9637014
Thanks @bluwy! - Fixes regression when handling hoisted scripts from content collections
v4.8.5
Patch Changes
-
#11065
1f988ed
Thanks @ematipico! - Fixes a bug in the Astro rewrite logic, where rewriting the index with parameters -next("/?foo=bar")
- didn't work as expected. -
#10924
3a0c02a
Thanks @Its-Just-Nans! - Handle image-size errors by displaying a clearer message -
#11058
749a7ac
Thanks @matthewp! - Fix streaming in Node.js fast path -
#11052
a05ca38
Thanks @florian-lefebvre! - Fixes a case where rewriting would conflict with the actions internal middleware -
#11062
16f12e4
Thanks @ematipico! - Fixes a bug whereastro build
didn't create custom404.html
and500.html
when a certain combination of i18n options was applied -
#10965
a8f0372
Thanks @Elias-Chairi! - Update generator.ts to allow %23 (#) in dynamic urls -
#11069
240a70a
Thanks @ematipico! - Improves debug logging for on-demand pages
v4.8.4
Patch Changes
-
#11026
8dfb1a2
Thanks @bluwy! - Skips rendering script tags if it's inlined and empty whenexperimental.directRenderScript
is enabled -
#11043
d0d1710
Thanks @bholmesdev! - Fixes minor type issues in actions component example -
#10999
5f353e3
Thanks @bluwy! - The prefetch feature is updated to better support different browsers and different cache headers setup, including:- All prefetch strategies will now always try to use
<link rel="prefetch">
if supported, or will fall back tofetch()
. - The
prefetch()
programmatic API'swith
option is deprecated in favour of an automatic approach that will also try to use<link rel="prefetch>
if supported, or will fall back tofetch()
.
This change shouldn't affect most sites and should instead make prefetching more effective.
- All prefetch strategies will now always try to use
-
#11041
6cc3fb9
Thanks @bholmesdev! - Fixes 500 errors when sending empty params or returning an empty response from an action. -
#11028
771d1f7
Thanks @bholmesdev! - Throw on missing server output when using Astro Actions. -
#11029
bd34452
Thanks @bholmesdev! - Actions: include validation error in thrown error message for debugging. -
#11046
086694a
Thanks @HiDeoo! - FixesgetViteConfig()
type definition to allow passing an inline Astro configuration as second argument -
#11026
8dfb1a2
Thanks @bluwy! - Fixes CSS handling if imported in a script tag in an Astro file whenexperimental.directRenderScript
is enabled -
#11020
2e2d6b7
Thanks @xsynaptic! - Add type declarations forimport.meta.env.ASSETS_PREFIX
when defined as an object for handling different file types. -
#11030
18e7f33
Thanks @bholmesdev! - Actions: Fix missing message for custom Action errors. -
#10981
ad9227c
Thanks @mo! - Adds deprecated HTML attribute "name" to the list of valid attributes. This attribute has been replaced by the globalid
attribute in recent versions of HTML. -
#11013
4ea38e7
Thanks @QingXia-Ela! - Prevents unhandledrejection error when checking for latest Astro version -
#11034
5f2dd45
Thanks @arganaphang! - Addpopovertargetaction
to the attribute that can be passed to thebutton
andinput
element
v4.8.3
Patch Changes
-
#11006
7418bb0
Thanks @bholmesdev! - Fixlocals
access from action handlers
v4.8.2
Patch Changes
-
#10990
4161a2a
Thanks @liruifengv! - fix incorrect actions path on windows -
#10979
6fa89e8
Thanks @BryceRussell! - Fix loading of non-index routes that end withindex.html
v4.8.1
Patch Changes
-
#10987
05db5f7
Thanks @ematipico! - Fix a regression where the flagexperimental.rewriting
was marked mandatory. Is is now optional. -
#10975
6b640b3
Thanks @bluwy! - Passes the scoped style attribute or class to the<picture>
element in the<Picture />
component so scoped styling can be applied to the<picture>
element
v4.8.0
Minor Changes
-
#10935
ddd8e49
Thanks @bluwy! - Exportsastro/jsx/rehype.js
with utilities to generate an Astro metadata object -
#10625
698c2d9
Thanks @goulvenclech! - Adds the ability for multiple pages to use the same component as anentrypoint
when building an Astro integration. This change is purely internal, and aligns the build process with the behaviour in the development server. -
#10906
7bbd664
Thanks @Princesseuh! - Adds a new radio checkbox component to the dev toolbar UI library (astro-dev-toolbar-radio-checkbox
) -
#10963
61f47a6
Thanks @delucis! - Adds support for passing an inline Astro configuration object togetViteConfig()
If you are using
getViteConfig()
to configure the Vitest test runner, you can now pass a second argument to control how Astro is configured. This makes it possible to configure unit tests with different Astro options when using Vitest’s workspaces feature.// vitest.config.ts import { getViteConfig } from 'astro/config'; export default getViteConfig( /* Vite configuration */ { test: {} }, /* Astro configuration */ { site: 'https://example.com', trailingSlash: 'never', }, );
-
#10867
47877a7
Thanks @ematipico! - Adds experimental rewriting in Astro with a newrewrite()
function and the middlewarenext()
function.The feature is available via an experimental flag in
astro.config.mjs
:export default defineConfig({ experimental: { rewriting: true, }, });
When enabled, you can use
rewrite()
to render another page without changing the URL of the browser in Astro pages and endpoints.
v4.7.1
Patch Changes
-
#10911
a86dc9d
Thanks @bluwy! - Skips adding CSS dependencies of CSS Vite modules as style tags in the HTML -
#10900
36bb3b6
Thanks @martrapp! - Detects overlapping navigation and view transitions and automatically aborts all but the most recent one. -
#10933
007d17f
Thanks @Princesseuh! - Fixesapp.toggleState
not working correctly -
#10931
4ce5ced
Thanks @ktym4a! - FixestoggleNotification()
's parameter type for the notification level not using the proper levels
v4.7.0
Minor Changes
-
#10665
7b4f284
Thanks @Princesseuh! - Adds new utilities to ease the creation of toolbar apps includingdefineToolbarApp
to make it easier to define your toolbar app andapp
andserver
helpers for easier communication between the toolbar and the server. These new utilities abstract away some of the boilerplate code that is common in toolbar apps, and lower the barrier of entry for app authors.For example, instead of creating an event listener for the
app-toggled
event and manually typing the value in the callback, you can now use theonAppToggled
method. Additionally, communicating with the server does not require knowing any of the Vite APIs anymore, as a newserver
object is passed to theinit
function that contains easy to use methods for communicating with the server.import { defineToolbarApp } from "astro/toolbar"; export default defineToolbarApp({ init(canvas, app, server) { - app.addEventListener("app-toggled", (e) => { - console.log(`App is now ${state ? "enabled" : "disabled"}`);. - }); + app.onToggled(({ state }) => { + console.log(`App is now ${state ? "enabled" : "disabled"}`); + }); - if (import.meta.hot) { - import.meta.hot.send("my-app:my-client-event", { message: "world" }); - } + server.send("my-app:my-client-event", { message: "world" }) - if (import.meta.hot) { - import.meta.hot.on("my-server-event", (data: {message: string}) => { - console.log(data.message); - }); - } + server.on<{ message: string }>("my-server-event", (data) => { + console.log(data.message); // data is typed using the type parameter + }); }, })
Server helpers are also available on the server side, for use in your integrations, through the new
toolbar
object:"astro:server:setup": ({ toolbar }) => { toolbar.on<{ message: string }>("my-app:my-client-event", (data) => { console.log(data.message); toolbar.send("my-server-event", { message: "hello" }); }); }
This is a backwards compatible change and your your existing dev toolbar apps will continue to function. However, we encourage you to build your apps with the new helpers, following the updated Dev Toolbar API documentation.
-
#10734
6fc4c0e
Thanks @Princesseuh! - Astro will now automatically check for updates when you run the dev server. If a new version is available, a message will appear in the terminal with instructions on how to update. Updates will be checked once per 10 days, and the message will only appear if the project is multiple versions behind the latest release.This behavior can be disabled by running
astro preferences disable checkUpdates
or setting theASTRO_DISABLE_UPDATE_CHECK
environment variable tofalse
. -
#10762
43ead8f
Thanks @bholmesdev! - Enables type checking for JavaScript files when using thestrictest
TS config. This ensures consistency with Astro's other TS configs, and fixes type checking for integrations like Astro DB when using anastro.config.mjs
.If you are currently using the
strictest
preset and would like to still disable.js
files, setallowJS: false
in yourtsconfig.json
.
Patch Changes
-
#10861
b673bc8
Thanks @mingjunlu! - Fixes an issue whereastro build
writes type declaration files tooutDir
when it's outside of root directory. -
#10684
8b59d5d
Thanks @PeterDraex! - Update sharp to 0.33 to fix issue with Alpine Linux
v4.6.4
Patch Changes
-
#10846
3294f7a
Thanks @matthewp! - Prevent getCollection breaking in vitest -
#10856
30cf82a
Thanks @robertvanhoesel! - Prevents inputs with a name attribute of action or method to break ViewTransitions' form submission -
#10833
8d5f3e8
Thanks @renovate! - Updatesesbuild
dependency to v0.20. This should not affect projects in most cases. -
#10801
204b782
Thanks @rishi-raj-jain! - Fixes an issue where images in MD required a relative specifier (e.g../
)Now, you can use the standard
![](relative/img.png)
syntax in MD files for images colocated in the same folder: no relative specifier required!There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these MD images as they are no longer necessary:
- ![A cute dog](./dog.jpg) + ![A cute dog](dog.jpg) <!-- This dog lives in the same folder as my article! -->
-
#10841
a2df344
Thanks @martrapp! - Due to regression on mobile WebKit browsers, reverts a change made for JavaScript animations during view transitions.
v4.6.3
Patch Changes
-
#10799
dc74afca9f5eebc2d61331298d6ef187d92051e0
Thanks @martrapp! - Fixes an issue with persisted non-text input fields that have the focus during view transition navigation. -
#10773
35e43ecdaae7adc4b9a0b974192a033568cfb3f0
Thanks @lilnasy! - Improves performance for frequent use of small components. -
#10763
63132771373ce1510be3e8814897accc0bf62ef8
Thanks @matthewp! - Invalidate CC cache manifest when lockfile or config changes -
#10811
77822a822b04b5113726f713df104e8667333c59
Thanks @AvinashReddy3108! - Update list of available integrations in theastro add
CLI help.
v4.6.2
Patch Changes
-
#10732
a92e263beb6e0166f1f13c97803d1861793e2a99
Thanks @rishi-raj-jain! - Correctly setsbuild.assets
directory duringvite
config setup -
#10776
1607face67051b16d4648555f1001b2a9308e377
Thanks @fshafiee! - Fixes cookies type inference -
#10796
90669472df3a05b33f0de46fd2d039e3eba7f7dd
Thanks @bluwy! - Disables streaming when rendering site withoutput: "static"
-
#10782
b0589d05538fcc77dd3c38198bf93f3548362cd8
Thanks @nektro! - Handles possible null value when callingwhich-pm
during dynamic package installation -
#10774
308b5d8c122f44e7724bb2f3ad3aa5c43a83e584
Thanks @Princesseuh! - Fixesastro add
sometimes modifyingbaseUrl
unintentionally -
#10783
4dbd545304d1a8af903c8c97f237eb55c988c40b
Thanks @jurajkapsz! - Fixes Picture component specialFormatsFallback fallback check -
#10775
06843121450899ecf0390ca4efaff6c9a6fe0f75
Thanks @Princesseuh! - Fixes assets endpoint in serverless returning 404 in certain situations where the website might be under a protected route -
#10787
699f4559a279b374bddb3e5e48c72afe2709e8e7
Thanks @martrapp! - Fixes a timing issue in the view transition simulation.
v4.6.1
Patch Changes
-
#10708
742866c5669a2be4f8b5a4c861cadb933c381415
Thanks @horo-fox! - Limits parallel imports withingetCollection()
to prevent EMFILE errors when accessing files -
#10755
c6d59b6fb7db20af957a8706c8159c50619235ef
Thanks @ematipico! - Fixes a case where the i18n fallback failed to correctly redirect to the index page with SSR enabled
v4.6.0
Minor Changes
-
#10591
39988ef8e2c4c4888543c973e06d9b9939e4ac95
Thanks @mingjunlu! - Adds a new dev toolbar settings option to change the horizontal placement of the dev toolbar on your screen: bottom left, bottom center, or bottom right. -
#10689
683d51a5eecafbbfbfed3910a3f1fbf0b3531b99
Thanks @ematipico! - Deprecate support for versions of Node.js older thanv18.17.1
for Node.js 18, older thanv20.0.3
for Node.js 20, and the complete Node.js v19 release line.This change is in line with Astro's Node.js support policy.
-
#10678
2e53b5fff6d292b7acdf8c30a6ecf5e5696846a1
Thanks @ematipico! - Adds a new experimental security option to prevent Cross-Site Request Forgery (CSRF) attacks. This feature is available only for pages rendered on demand:import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { security: { csrfProtection: { origin: true, }, }, }, });
Enabling this setting performs a check that the "origin" header, automatically passed by all modern browsers, matches the URL sent by each
Request
.This experimental "origin" check is executed only for pages rendered on demand, and only for the requests
POST,
PATCH,
DELETEand
PUTwith one of the following
content-type` headers: 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'.It the "origin" header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page.
-
#10193
440681e7b74511a17b152af0fd6e0e4dc4014025
Thanks @ematipico! - Adds a new i18n routing optionmanual
to allow you to write your own i18n middleware:import { defineConfig } from 'astro/config'; // astro.config.mjs export default defineConfig({ i18n: { locales: ['en', 'fr'], defaultLocale: 'fr', routing: 'manual', }, });
Adding
routing: "manual"
to your i18n config disables Astro's own i18n middleware and provides you with helper functions to write your own:redirectToDefaultLocale
,notFound
, andredirectToFallback
:// middleware.js import { redirectToDefaultLocale } from 'astro:i18n'; export const onRequest = defineMiddleware(async (context, next) => { if (context.url.startsWith('/about')) { return next(); } else { return redirectToDefaultLocale(context, 302); } });
Also adds a
middleware
function that manually creates Astro's i18n middleware. This allows you to extend Astro's i18n routing instead of completely replacing it. Runmiddleware
in combination with your own middleware, using thesequence
utility to determine the order:import { defineMiddleware, sequence } from 'astro:middleware'; import { middleware } from 'astro:i18n'; // Astro's own i18n routing config export const userMiddleware = defineMiddleware(); export const onRequest = sequence( userMiddleware, middleware({ redirectToDefaultLocale: false, prefixDefaultLocale: true, }), );
-
#10671
9e14a78cb05667af9821948c630786f74680090d
Thanks @fshafiee! - Adds thehttpOnly
,sameSite
, andsecure
options when deleting a cookie
Patch Changes
-
#10747
994337c99f84304df1147a14504659439a9a7326
Thanks @lilnasy! - Fixes an issue where functions could not be used as named slots. -
#10750
7e825604ddf90c989537e07939a39dc249343897
Thanks @OliverSpeir! - Fixes a false positive for "Invalidtabindex
on non-interactive element" rule for roleless elements (div
andspan
). -
#10745
d51951ce6278d4b59deed938d65e1cb72b5102df
Thanks @lilnasy! - Fixes an issue where CLI commands could not report the reason for failure before exiting. -
#10661
e2cd7f4291912dadd4a654bc7917856c58a72a97
Thanks @liruifengv! - Fixed errorOverlay theme toggle bug. -
Updated dependencies [
ccafa8d230f65c9302421a0ce0a0adc5824bfd55
,683d51a5eecafbbfbfed3910a3f1fbf0b3531b99
]:
v4.5.18
Patch Changes
-
#10728
f508c4b7d54316e737f454a3777204b23636d4a0
Thanks @ematipico! - Fixes a regression where some very specific code rendered usingexpressive-code
was not escaped properly. -
#10737
8a30f257b1f3618b01212a591b82ad7a63c82fbb
Thanks @lilnasy! - Fixes a regression where constructing and returning 404 responses from a middleware resulted in the dev server getting stuck in a loop. -
#10719
b21b3ba307235510707ee9f5bd49f71473a07004
Thanks @ematipico! - Fixes a false positive fordiv
andspan
elements when running the Dev Toolbar accessibility audits.Those are special elements that don't have an interaction assigned by default. Instead, it is assigned through the
role
attribute. This means that cases like the following are now deemed correct:<div role="tablist"></div> <span role="button" onclick="" onkeydown=""></span>
v4.5.17
Patch Changes
-
#10688
799f6f3f29a3ef4f76347870a209ffa89651adfa
Thanks @bluwy! - Marks rendererjsxImportSource
andjsxTransformOptions
options as deprecated as they are no longer used since Astro 3.0 -
#10657
93d353528fa1a85b67e3f1e9514ed2a1b42dfd94
Thanks @natemoo-re! - Improves the color contrast for notification badges on dev toolbar apps -
#10693
1d26e9c7f7d8f47e33bc68d3b30bbffce25c7b63
Thanks @apetta! - Adds thedisableremoteplayback
attribute to MediaHTMLAttributes interface -
#10695
a15975e41cb5eaf6ed8eb3ebaee676a17e433052
Thanks @bluwy! - Skips prerender chunk if building with static output -
#10707
5e044a5eafaa206d2ef8b62c37d1bcd37f0a4078
Thanks @horo-fox! - Logs an error when a page'sgetStaticPaths
fails -
#10686
fa0f593890502faf5709ab881fe0e45519d2f7af
Thanks @bluwy! - Prevents inlining scripts if used by other chunks when using theexperimental.directRenderScript
option
v4.5.16
Patch Changes
-
#10679
ca6bb1f31ef041e6ccf8ef974856fa945ff5bb31
Thanks @martrapp! - Generates missing popstate events for Firefox when navigating to hash targets on the same page. -
#10669
0464563e527f821e53d78028d9bbf3c4e1050f5b
Thanks @Princesseuh! - Fixes Astro waiting infinitely in CI when a required package was not installed
v4.5.15
Patch Changes
-
#10666
55ddb2ba4889480f776a8d29b9dcd531b9f5ab3e
Thanks @lilnasy! - Fixes an issue where forwarded requests did not include hostname on node-based adapters. This also makes error pages more reliable. -
#10642
4f5dc14f315eba7ea6ec5cc8e5dacb0cb81288dd
Thanks @OliverSpeir! - Fixes typing issues when usingformat
andquality
options with remote images -
#10616
317d18ef8c9cf4fd13647518e3fd352774a86481
Thanks @NikolaRHristov! - This change disables thesharp
libvips
image cache as it errors when the file is too small and operations are happening too fast (runs into a race condition)
v4.5.14
Patch Changes
-
#10470
320c309ca9fbe51c40e6ba846d04a0cb49aced5f
Thanks @liruifengv! - improvesclient:only
error message -
#10496
ce985631129e49f7ea90e6ea690ef9f9cf0e6987
Thanks @florian-lefebvre! - Makes the warning less scary when adding 3rd-party integrations usingastro add
v4.5.13
Patch Changes
-
#10495
046d69d517118ab5c0e71604b321729d66ddffff
Thanks @satyarohith! - This patch allows astro to run in node-compat mode in Deno. Deno doesn't support construction of response from async iterables in node-compat mode so we need to use ReadableStream. -
#10605
a16a829f4e25ad5c9a1b4557ec089fc8ab53320f
Thanks @martrapp! - Fixes an issue with outdated page titles in browser history when using text fragments in view transition navigation. -
#10584
e648c5575a8774af739231cfa9fc27a32086aa5f
Thanks @duanwilliam! - Fixes a bug where JSX runtime would error on components with nullish prop values in certain conditions. -
#10608
e31bea0704890ff92ce4f9b0ce536c1c90715f2c
Thanks @matthewp! - Fixes bug with head content being pushed into body -
Updated dependencies [
2cf116f80cb5e421ab5cc5eb4a654e7b78c1b8de
,374efcdff9625ca43309d89e3b9cfc9174351512
]:
v4.5.12
Patch Changes
-
#10596
20463a6c1e1271d8dc3cb0ab3419ee5c72abd218
Thanks @Princesseuh! - AddremoveBase
function -
Updated dependencies [
20463a6c1e1271d8dc3cb0ab3419ee5c72abd218
]:
v4.5.11
Patch Changes
-
#10567
fbdc10f90f7baa5c49f2f53e3e4ce8f453814c01
Thanks @Princesseuh! - Fixesastro:assets
not working when using complex config withvite.build.rollupOptions.output.assetFileNames
-
#10593
61e283e5a0d95b6ef5d3c4c985d6ee78f74bbd8e
Thanks @Princesseuh! - Fixes Polymorphic type helper causing TypeScript errors in certain cases after the previous update -
#10543
0fd36bdb383297b32cc523b57d2442132da41595
Thanks @matthewp! - Fixes inline stylesheets with content collections cache -
#10582
a05953538fcf524786385830b99c0c5a015173e8
Thanks @lilnasy! - Fixes an issue where the dev server got stuck in a loop while routing responses with a 404 status code to the 404 route.
v4.5.10
Patch Changes
-
#10549
54c2f9707f5d038630143f769e3075c698474654
Thanks @admirsaheta! - Updates theHTMLAttributes
type exported fromastro
to allow data attributes -
#10562
348c1ca1323d0516c2dcf8e963343cd12cb5407f
Thanks @apetta! - Fixes minor type issues inside the built-in components of Astro -
#10550
34fa8e131b85531e6629390307108ffc4adb7ed1
Thanks @Skn0tt! - Fixes bug where server builds would include unneeded assets in SSR Function, potentially leading to upload errors on Vercel, Netlify because of size limits -
Updated dependencies [
c585528f446ccca3d4c643f4af5d550b93c18902
]:
v4.5.9
Patch Changes
-
#10532
8306ce1ff7b71a2a0d7908336c9be462a54d395a
Thanks @martrapp! - Fixes a style issue ofclient:only
components in DEV mode during view transitions. -
#10473
627e47d67af4846cea2acf26a96b4124001b26fc
Thanks @bluwy! - Fixes and improves performance when rendering Astro JSX
v4.5.8
Patch Changes
-
#10504
8e4e554cc211e59c329c0a5d110c839c886ff120
Thanks @Princesseuh! - Update Babel version to fix regression in Babel's7.24.2
. -
Updated dependencies [
19e42c368184013fc30d1e46753b9e9383bb2bdf
]:
v4.5.7
Patch Changes
-
#10493
e4a6462751725878bfe47632eeafa6854cad5bf2
Thanks @firefoxic! -<link>
tags created by astro for optimized stylesheets now do not include the closing forward slash. This slash is optional for void elements such as link, but made some html validation fail.
v4.5.6
Patch Changes
-
#10455
c12666166db724915e42e37a048483c99f88e6d9
Thanks @lilnasy! - Adds a helpful error message that will be shown when an endpoint does not return aResponse
. -
#10426
6a9a35ee15069541c3144012385366a3c689240a
Thanks @markgaze! - Fixes an issue with generating JSON schemas when the schema is a function -
#10448
fcece3658697248ab58f77b3d4a8b14d362f3c47
Thanks @lilnasy! - Fixes an issue where multiple rendering errors resulted in a crash of the SSR app server.
v4.5.5
Patch Changes
-
#10379
3776ecf0aa9e08a992d3ae76e90682fd04093721
Thanks @1574242600! - Fixes a routing issue with partially truncated dynamic segments. -
#10442
f8e0ad3c52a37b8a2175fe2f5ff2bd0cd738f499
Thanks @Princesseuh! - Fixes small rendering issues with the dev toolbar in certain contexts -
#10438
5b48cc0fc8383b0659a595afd3a6ee28b28779c3
Thanks @bholmesdev! - Generate Astro DB types when runningastro sync
. -
#10456
1900a8f9bc337f3a882178d1770e10ab67fab0ce
Thanks @martrapp! - Fixes an error when usingastro:transtions/client
without<ViewTransitions/>
v4.5.4
Patch Changes
-
#10427
128c7a36397d99608dea918885b68bd302d00e7f
Thanks @lilnasy! - Fixes an issue where error pages did not have access to theAstro.locals
fields provided by the adapter.
v4.5.3
Patch Changes
-
#10410
055fe293c6702dd27bcd6c4f59297c6d4385abb1
Thanks @lilnasy! - Fixes an issue where configured redirects could not include certain characters in the target path. -
#9820
8edc42aa7c209b12d98ecf20cdecccddf7314af0
Thanks @alexnguyennz! - Prevents fully formed URLs in attributes from being escaped
v4.5.2
Patch Changes
-
#10400
629c9d7c4d96ae5711d95601e738b3d31d268116
Thanks @mingjunlu! - Fixes an issue where dev toolbar x-ray didn't escape props content.
v4.5.1
Patch Changes
-
#10728
f508c4b7d54316e737f454a3777204b23636d4a0
Thanks @ematipico! - Fixes a regression where some very specific code rendered usingexpressive-code
was not escaped properly. -
#10737
8a30f257b1f3618b01212a591b82ad7a63c82fbb
Thanks @lilnasy! - Fixes a regression where constructing and returning 404 responses from a middleware resulted in the dev server getting stuck in a loop. -
#10719
b21b3ba307235510707ee9f5bd49f71473a07004
Thanks @ematipico! - Fixes a false positive fordiv
andspan
elements when running the Dev Toolbar accessibility audits.Those are special elements that don't have an interaction assigned by default. Instead, it is assigned through the
role
attribute. This means that cases like the following are now deemed correct:<div role="tablist"></div> <span role="button" onclick="" onkeydown=""></span>
v4.5.0
Minor Changes
-
#10206
dc87214141e7f8406c0fdf6a7f425dad6dea6d3e
Thanks @lilnasy! - Allows middleware to run when a matching page or endpoint is not found. Previously, apages/404.astro
orpages/[...catch-all].astro
route had to match to allow middleware. This is now not necessary.When a route does not match in SSR deployments, your adapter may show a platform-specific 404 page instead of running Astro's SSR code. In these cases, you may still need to add a
404.astro
or fallback route with spread params, or use a routing configuration option if your adapter provides one. -
#9960
c081adf998d30419fed97d8fccc11340cdc512e0
Thanks @StandardGage! - Allows passing any props to the<Code />
component -
#10102
e3f02f5fb1cf0dae3c54beb3a4af3dbf3b06abb7
Thanks @bluwy! - Adds a newexperimental.directRenderScript
configuration option which provides a more reliable strategy to prevent scripts from being executed in pages where they are not used.This replaces the
experimental.optimizeHoistedScript
flag introduced in v2.10.4 to prevent unused components' scripts from being included in a page unexpectedly. That experimental option no longer exists and must be removed from your configuration, whether or not you enabledirectRenderScript
:// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { - optimizeHoistedScript: true, + directRenderScript: true } });
With
experimental.directRenderScript
configured, scripts are now directly rendered as declared in Astro files (including existing features like TypeScript, importingnode_modules
, and deduplicating scripts). You can also now conditionally render scripts in your Astro file.However, this means scripts are no longer hoisted to the
<head>
and multiple scripts on a page are no longer bundled together. If you enable this option, you should check that all your<script>
tags behave as expected.This option will be enabled by default in Astro 5.0.
-
#10130
5a9528741fa98d017b269c7e4f013058028bdc5d
Thanks @bluwy! - Stabilizesmarkdown.shikiConfig.experimentalThemes
asmarkdown.shikiConfig.themes
. No behaviour changes are made to this option. -
#10189
1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd
Thanks @peng! - Adds the option to pass an object tobuild.assetsPrefix
. This allows for the use of multiple CDN prefixes based on the target file type.When passing an object to
build.assetsPrefix
, you must also specify afallback
domain to be used for all other file types not specified.Specify a file extension as the key (e.g. 'js', 'png') and the URL serving your assets of that file type as the value:
// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ build: { assetsPrefix: { js: 'https://js.cdn.example.com', mjs: 'https://js.cdn.example.com', // if you have .mjs files, you must add a new entry like this png: 'https://images.cdn.example.com', fallback: 'https://generic.cdn.example.com', }, }, });
-
#10252
3307cb34f17159dfd3f03144697040fcaa10e903
Thanks @Princesseuh! - Adds support for emitting warning and info notifications from dev toolbar apps.When using the
toggle-notification
event, the severity can be specified throughdetail.level
:eventTarget.dispatchEvent( new CustomEvent('toggle-notification', { detail: { level: 'warning', }, }), );
-
#10186
959ca5f9f86ef2c0a5a23080cc01c25f53d613a9
Thanks @Princesseuh! - Adds the ability to set colors on all the included UI elements for dev toolbar apps. Previously, only badge and buttons could be customized. -
#10136
9cd84bd19b92fb43ae48809f575ee12ebd43ea8f
Thanks @matthewp! - Changes the default behavior oftransition:persist
to update the props of persisted islands upon navigation. Also adds a new view transitions optiontransition:persist-props
(default:false
) to prevent props from updating as needed.Islands which have the
transition:persist
property to keep their state when using the<ViewTransitions />
router will now have their props updated upon navigation. This is useful in cases where the component relies on page-specific props, such as the current page title, which should update upon navigation.For example, the component below is set to persist across navigation. This component receives a
products
props and might have some internal state, such as which filters are applied:<ProductListing transition:persist products={products} />
Upon navigation, this component persists, but the desired
products
might change, for example if you are visiting a category of products, or you are performing a search.Previously the props would not change on navigation, and your island would have to handle updating them externally, such as with API calls.
With this change the props are now updated, while still preserving state.
You can override this new default behavior on a per-component basis using
transition:persist-props=true
to persist both props and state during navigation:<ProductListing transition:persist-props="true" products={products} />
-
#9977
0204b7de37bf626e1b97175b605adbf91d885386
Thanks @OliverSpeir! - Supports adding thedata-astro-rerun
attribute on script tags so that they will be re-executed after view transitions<script is:inline data-astro-rerun> ... </script>
-
#10145
65692fa7b5f4440c644c8cf3dd9bc50103d2c33b
Thanks @alexanderniebuhr! - Adds experimental JSON Schema support for content collections.This feature will auto-generate a JSON Schema for content collections of
type: 'data'
which can be used as the$schema
value for TypeScript-style autocompletion/hints in tools like VSCode.To enable this feature, add the experimental flag:
import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { + contentCollectionJsonSchema: true } });
This experimental implementation requires you to manually reference the schema in each data entry file of the collection:
// src/content/test/entry.json { + "$schema": "../../../.astro/collections/test.schema.json", "test": "test" }
Alternatively, you can set this in your VSCode
json.schemas
settings:"json.schemas": [ { "fileMatch": [ "/src/content/test/**" ], "url": "../../../.astro/collections/test.schema.json" } ]
Note that this initial implementation uses a library with known issues for advanced Zod schemas, so you may wish to consult these limitations before enabling the experimental flag.
-
#10130
5a9528741fa98d017b269c7e4f013058028bdc5d
Thanks @bluwy! - Migratesshikiji
toshiki
1.0 -
#10268
2013e70bce16366781cc12e52823bb257fe460c0
Thanks @Princesseuh! - Adds support for page mutations to the audits in the dev toolbar. Astro will now rerun the audits whenever elements are added or deleted from the page. -
#10217
5c7862a9fe69954f8630538ebb7212cd04b8a810
Thanks @Princesseuh! - Updates the UI for dev toolbar audits with new information
Patch Changes
-
#10360
ac766647b0e6156b7c4a0bb9a11981fe168852d7
Thanks @nmattia! - Fixes an issue where some CLI commands attempted to directly read vite config files. -
#10291
8107a2721b6abb07c3120ac90e03c39f2a44ab0c
Thanks @bluwy! - Treeshakes unused Astro component scoped styles -
#10368
78bafc5d661ff7dd071c241cb1303c4d8a774d21
Thanks @Princesseuh! - Updates the basetsconfig.json
preset withjsx: 'preserve'
in order to fix errors when importing Astro files inside.js
and.ts
files. -
Updated dependencies [
c081adf998d30419fed97d8fccc11340cdc512e0
,1ea0a25b94125e4f6f2ac82b42f638e22d7bdffd
,5a9528741fa98d017b269c7e4f013058028bdc5d
,a31bbd7ff8f3ec62ee507f72d1d25140b82ffc18
]:
v4.4.15
Patch Changes
-
#10317
33583e8b31ee8a33e26cf57f30bb422921f4745d
Thanks @lilnasy! - Fixes an issue where elements slotted within interactive framework components disappeared after hydration.
v4.4.14
Patch Changes
-
#10355
8ce9fffd44b0740621178d61fb1425bf4155c2d7
Thanks @ematipico! - Fixes a regression where full dynamic routes were prioritized over partial dynamic routes. Now a route likefood-[name].astro
is matched before[name].astro
. -
#10356
d121311a3f4b5345e344e31f75d4e7164d65f729
Thanks @mingjunlu! - Fixes an issue wheregetCollection
might returnundefined
when content collection is empty -
#10325
f33cce8f6c3a2e17847658cdedb015bd93cc1ee3
Thanks @lilnasy! - Fixes an issue wherectx.site
included the configuredbase
in API routes and middleware, unlikeAstro.site
in astro pages. -
#10343
f973aa9110592fa9017bbe84387f22c24a6d7159
Thanks @ematipico! - Fixes some false positive in the dev toolbar a11y audits, by adding thea
element to the list of interactive elements. -
#10295
fdd5bf277e5c1cfa30c1bd2ca123f4e90e8d09d9
Thanks @rossrobino! - Adds a prefetch fallback when using theexperimental.clientPrerender
option. If prerendering fails, which can happen if Chrome extensions block prerendering, it will fallback to prefetching the URL. This works by adding aprefetch
field to thespeculationrules
script, but does not create an extra request.
v4.4.13
Patch Changes
-
#10342
a2e9b2b936666b2a4779feb00dcb8ff0ab82c2ec
Thanks @matthewp! - Fixes @astrojs/db loading TS in the fixtures
v4.4.12
Patch Changes
-
#10336
f2e60a96754ed1d86001fe4d5d3a0c0ef657408d
Thanks @FredKSchott! - Fixes an issue where slotting interactive components within a "client:only" component prevented all component code in the page from running.
v4.4.11
Patch Changes
-
#10281
9deb919ff95b1d2ffe5a5f70ec683e32ebfafd05
Thanks @lilnasy! - Fixes an issue where404.astro
was ignored withi18n
routing enabled. -
#10279
9ba3e2605daee3861e3bf6c5768f1d8bced4709d
Thanks @lilnasy! - Fixes an issue where returning redirect responses resulted in missing files with certain adapters. -
#10319
19ecccedaab6d8fa0ff23711c88fa7d4fa34df38
Thanks @lilnasy! - Fixes an issue where streaming SSR responses sometimes failed with "iterator.result
is not a function" on node-based adapters. -
#10302
992537e79f1847b590a2e226aac88a47a6304f68
Thanks @florian-lefebvre! - Fixes an issue that causes static entrypoints build to fail because of the path in certain conditions. Specifically, it failed if the path had an extension (like.astro
,.mdx
etc) and such extension would be also within the path (like./.astro/index.astro
). -
#10298
819d20a89c0d269333c2d397c1080884f516307a
Thanks @Fryuni! - Fix an incorrect conflict resolution between pages generated from static routes and rest parameters
v4.4.10
Patch Changes
-
#10235
4bc360cd5f25496aca3232f6efb3710424a14a34
Thanks @sanman1k98! - Fixes jerky scrolling on IOS when using view transitions.
v4.4.9
Patch Changes
-
#10278
a548a3a99c2835c19662fc38636f92b2bda26614
Thanks @Princesseuh! - Fixes original images sometimes being kept / deleted when they shouldn't in both MDX and Markdoc -
#10280
3488be9b59d1cb65325b0e087c33bcd74aaa4926
Thanks @bholmesdev! - Finalize db API to a shared db/ directory.
v4.4.8
Patch Changes
-
#10275
5e3e74b61daa2ba44c761c9ab5745818661a656e
Thanks @Princesseuh! - Fixes dev toolbar warning about using the proper loading attributes on images usingdata:
URIs
v4.4.7
Patch Changes
-
#10274
e556151603a2f0173059d0f98fdcbec0610b48ff
Thanks @lilnasy! - Fixes a regression introduced in v4.4.5 where image optimization did not work in dev mode when a base was configured. -
#10263
9bdbed723e0aa4243d7d6ee64d1c1df3b75b9aeb
Thanks @martrapp! - Adds auto completion forastro:
event names when adding or removing event listeners ondocument
. -
#10284
07f89429a1ef5173d3321e0b362a9dc71fc74fe5
Thanks @Princesseuh! - Fixes an issue where in Node SSR, the image endpoint could be used maliciously to reveal unintended information about the underlying system.Thanks to Google Security Team for reporting this issue.
v4.4.6
Patch Changes
-
#10247
fb773c9161bf8faa5ebd7e115f3564c3359e56ea
Thanks @martrapp! - Fixes an issue wheretransition:animate="none"
still allowed the browser-native morph animation. -
#10248
8ae5d99534fc09d650e10e64a09b61a2807574f2
Thanks @ematipico! - Fixes an issue where multiple injected routes with the sameentrypoint
but differentpattern
were incorrectly cached, causing some of them not being rendered in the dev server. -
#10250
57655a99db34e20e9661c039fab253b867013318
Thanks @log101! - Fixes the overwriting of localised index pages with redirects -
#10239
9c21a9df6b03e36bd78dc553e13c55b9ef8c44cd
Thanks @mingjunlu! - Improves the message ofMiddlewareCantBeLoaded
for clarity -
#10222
ade9759cae74ca262b988260250bcb202235e811
Thanks @martrapp! - Adds a warning in DEV mode when using view transitions on a device with prefer-reduced-motion enabled. -
#10251
9b00de0a76b4f4b5b808e8c78e4906a2497e8ecf
Thanks @mingjunlu! - Fixes TypeScript type definitions forCode
componenttheme
andexperimentalThemes
props
v4.4.5
Patch Changes
-
#10221
4db82d9c7dce3b73fe43b86020fcfa326c1357ec
Thanks @matthewp! - Prevents errors in templates from crashing the server -
#10219
afcb9d331179287629b5ffce4020931258bebefa
Thanks @matthewp! - Fix dynamic slots missing hydration scripts -
#10220
1eadb1c5290f2f4baf538c34889a09d5fcfb9bd4
Thanks @Princesseuh! - Fixes some built-in apps of the dev toolbar not closing when clicking the page -
#10154
e64bd0740b44aed5cfaf67e5c37a1c56ed4442f4
Thanks @Cherry! - Fixes an issue whereconfig.vite.build.assetsInlineLimit
could not be set as a function. -
#10196
8fb32f390d40cfa12a82c0645928468d27218866
Thanks @lilnasy! - Fixes an issue where a warning about headers being accessed in static mode is unnecessarily shown when i18n is enabled. -
#10199
6aa660ae7abc6841d7a3396b29f10b9fb7910ce5
Thanks @lilnasy! - Fixes an issue where prerendered pages had access to query params in dev mode.
v4.4.4
Patch Changes
-
#10195
903eace233033998811b72e27a54c80d8e59ff37
Thanks @1574242600! - Fix build failure caused by read-only files under /public (in the presence of client-side JS). -
#10205
459f74bc71748279fe7dce0688f38bd74b51c5c1
Thanks @martrapp! - Adds an error message for non-string transition:name values -
#10208
8cd38f02456640c063552aef00b2b8a216b3935d
Thanks @log101! - Fixes custom headers are not added to the Node standalone server responses in preview mode
v4.4.3
Patch Changes
-
#10143
7c5fcd2fa817472f480bbfbbc11b9ed71a7210ab
Thanks @bluwy! - Improves the defaultoptimizeDeps.entries
Vite config to avoid globbing server endpoints, and respect thesrcDir
option -
#10197
c856c729404196900a7386c8426b81e79684a6a9
Thanks @Princesseuh! - Fixes errors being logged twice in some cases -
#10166
598f30c7cd6c88558e3806d9bc5a15d426d83992
Thanks @bluwy! - Improves Astro style tag HMR when updating imported styles -
#10194
3cc20109277813ccb9578ca87a8b0d680a73c35c
Thanks @matthewp! - Fixes an issue related to content collections usage in browser context caused bycsssec
v4.4.2
Patch Changes
-
#10169
a46249173edde66b03c19441144272baa8394fb4
Thanks @ematipico! - Fixes an issue with thei18n.routing
types, where an internal transformation was causing the generation of incorrect types for integrations.
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot. The local configuration can be found in the local Renovate Bot repository.