Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
144 KiB
astro
2.0.9
Patch Changes
-
#6176
8bbdcf17d
Thanks @matthewp! - Take dynamic import into account in CSS ordering -
#6170
ec2f2a31d
Thanks @bholmesdev! - Show content config errors in overlay, instead of stopping the dev server.
2.0.8
Patch Changes
2.0.7
Patch Changes
-
#6161
f6fc662c3
Thanks @matthewp! - Prevent ?inline and ?raw CSS from being bundled as CSS -
#6149
592386b75
Thanks @bloycey! - Moved pagination error to AstroErrorData -
#6153
1b591a143
Thanks @torchsmith! - Respectvite.build.emptyOutDir
setting duringastro build
-
#6092
bf8d7366a
Thanks @bholmesdev! - Ensure vite config (aliases, custom modules, etc) is respected when loading the content collection config -
#6111
ec38a8921
Thanks @e111077! - Implement client:only functionality in Lit and add lit to the client:only warning -
#6124
f20a85b64
Thanks @FredKSchott! - Fix outdated error message inpaginate()
function. -
#6122
9f22ac3d0
Thanks @bholmesdev! - Content collections: Fix accidental "use underscore to ignore" logs for.DS_Store
files and underscored directory names. -
#6163
cee70f5c6
Thanks @Princesseuh! - Fix returning hex / base64 images from endpoints not working in dev -
#6114
ac7fb04d6
Thanks @bluwy! - Fix sourcemap generation when scanning files -
#6152
d1f5611fe
Thanks @matthewp! - Fix MDX related head placement bugsThis fixes a variety of head content placement bugs (such as page
<link>
) related to MDX, especially when used in content collections. Issues fixed:- Head content being placed in the body instead of the head.
- Head content missing when rendering an MDX component from within a nested Astro component.
-
#6119
2189170be
Thanks @matthewp! - Fix hoisted script propagation in content collection pages -
#6117
32abe49bd
Thanks @Princesseuh! - Fix polyfills not being available in certain cases
2.0.6
Patch Changes
2.0.5
Patch Changes
-
#6052
9793f19ec
Thanks @mayank99! - Error overlay will now show the error'scause
if available. -
#6070
f91615f5c
Thanks @AirBorne04! - * safe guard against TextEncode.encode(HTMLString) [errors on vercel edge]- safe guard against html.replace when html is undefined
-
#6064
2fb72c887
Thanks @bholmesdev! - Apply MDXcomponents
export when rendering as a content collection entry
2.0.4
Patch Changes
-
#6045
41e97158b
Thanks @natemoo-re! - Improve error handling when an Astro component is rendered manually -
#6036
e779c6242
Thanks @natemoo-re! - Improve error handling when top-levelreturn
is present
2.0.3
Patch Changes
-
#6035
b4432cd6b
Thanks @bholmesdev! - Fix: Astro component scripts now load in development when using MDX + Content Collections -
#6024
98a4a914b
Thanks @MoustaphaDev! - RemoverawContent()
andcompiledContent()
from MDX import types -
#6034
071e1dee7
Thanks @matthewp! - Ensure CSS injections properly when using multiple layouts -
#5927
322e059d0
Thanks @izmttk! - Fix undefinedremarkPluginFrontmatter
after callingrender
method -
#6006
b994f6f35
Thanks @tony-sull! - Makes theAstroCookies
type available as an import from the main "astro" package -
#5998
12c68343c
Thanks @andersk! - UpdategetCollection()
filter to support type guards or unknown values
2.0.2
Patch Changes
-
#5983
b53e0717b
Thanks @natemoo-re! - Fixes a dev server edge case where prerender + getStaticPaths would not 404 on an unmatched route -
#5992
60b32d585
Thanks @HiDeoo! - FixAstro.url.protocol
when using the @astrojs/node SSR adapter with HTTPS -
#5971
883e0cc29
Thanks @JLarky! - improve error message: change @astrojs/solid to @astrojs/solid-js -
#5970
dabce6b8c
Thanks @bholmesdev! - Add type guard support to filters ongetCollection()
-
#5952
aedf23f85
Thanks @wulinsheng123! - Fix custom theme handling for<Code>
component -
Updated dependencies [
7abb1e905
]:- @astrojs/markdown-remark@2.0.1
2.0.1
Patch Changes
-
#5969
f4c71e5eb
Thanks @matthewp! - Fix usage of logger in Vercel EdgeThis protects against usage of
process
global in shimmed environments. -
#5962
46b6e1426
Thanks @MoustaphaDev! - Fix Content Collections not loading config file when there are spaces in the folder tree -
#5972
02549b8ce
Thanks @bluwy! - Correctly detect Node.js version
2.0.0
Note
This is a detailed changelog of all changes in Astro v2.
See our upgrade guide for an overview of steps needed to upgrade an existing project.
Major Changes
-
#5687
e2019be6f
Thanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This meansdata.astro.frontmatter
is now the complete Markdown or MDX document's frontmatter, rather than an empty object.This allows plugin authors to modify existing frontmatter, or compute new properties based on other properties. For example, say you want to compute a full image URL based on an
imageSrc
slug in your document frontmatter:export function remarkInjectSocialImagePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname; }; }
When using Content Collections, you can access this modified frontmatter using the
remarkPluginFrontmatter
property returned when rendering an entry.Migration instructions
Plugin authors should now check for user frontmatter when applying defaults.
For example, say a remark plugin wants to apply a default
title
if none is present. Add a conditional to check if the property is present, and update if none exists:export function remarkInjectTitlePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; + if (!frontmatter.title) { frontmatter.title = 'Default title'; + } } }
This differs from previous behavior, where a Markdown file's frontmatter would always override frontmatter injected via remark or reype.
-
#5891
05caf445d
Thanks @bholmesdev! - Remove deprecated Markdown APIs from Astro v0.X. This includesgetHeaders()
, the.astro
property for layouts, and therawContent()
andcompiledContent()
error messages for MDX. -
#5778
49ab4f231
Thanks @bluwy! - Remove proload to load the Astro config. It will now use NodeJS and Vite to load the config only. -
#5728
8fb28648f
Thanks @natemoo-re! - The previously experimental features--experimental-error-overlay
and--experimental-prerender
, both added in v1.7.0, are now the default.You'll notice that the error overlay during
astro dev
has a refreshed visual design and provides more context for your errors.The
prerender
feature is now enabled by default when usingoutput: 'server'
. To prerender a particular page, addexport const prerender = true
to your frontmatter.Warning
Integration authors that previously relied on the exact structure of Astro's v1.0 build output may notice some changes to our output file structure. Please test your integrations to ensure compatability. Users that have configured a custom
vite.build.rollupOptions.output.chunkFileNames
should ensure that their Astro project is configured as an ESM Node project. Either include"type": "module"
in your rootpackage.json
file or use the.mjs
extension forchunkFileNames
. -
#5782
1f92d64ea
Thanks @Princesseuh! - Remove support for Node 14. Minimum supported Node version is now >=16.12.0 -
#5771
259a539d7
Thanks @matthewp! - Removes support for astroFlavoredMarkdownIn 1.0 Astro moved the old Astro Flavored Markdown (also sometimes called Components in Markdown) to a legacy feature. This change removes the
legacy.astroFlavoredMarkdown
option completely.In 2.0 this feature will not be available in Astro at all. We recommend migration to MDX for those were still using this feature in 1.x.
-
#5941
304823811
Thanks @bholmesdev! - Content collections: Introduce a newslug
frontmatter field for overriding the generated slug. This replaces the previousslug()
collection config option from Astro 1.X and the 2.0 beta.When present in a Markdown or MDX file, this will override the generated slug for that entry.
# src/content/blog/post-1.md --- title: Post 1 + slug: post-1-custom-slug ---
Astro will respect this slug in the generated
slug
type and when using thegetEntryBySlug()
utility:--- import { getEntryBySlug } from 'astro:content'; // Retrieve `src/content/blog/post-1.md` by slug with type safety const post = await getEntryBySlug('blog', 'post-1-custom-slug'); ---
Migration
If you relied on the
slug()
config option, you will need to move all custom slugs toslug
frontmatter properties in each collection entry.Additionally, Astro no longer allows
slug
as a collection schema property. This ensures Astro can manage theslug
property for type generation and performance. Remove this property from your schema and any relevantslug()
configuration:const blog = defineCollection({ schema: z.object({ - slug: z.string().optional(), }), - slug({ defaultSlug, data }) { - return data.slug ?? defaultSlug; - }, })
-
#5753
302e0ef8f
Thanks @bluwy! - Default preview host tolocalhost
instead of127.0.0.1
. This allows the static server and integration preview servers to serve under ipv6. -
#5716
dd56c1941
Thanks @bluwy! - Remove MDX Fragment hack. This was used by@astrojs/mdx
to access theFragment
component, but isn't required anymore since@astrojs/mdx
v0.12.1. -
#5584
9963c6e4d
& #5842c4b0cb8bf
Thanks @wulinsheng123 and @natemoo-re! - Breaking Change: client assets are built to an_astro
directory in the build output directory. Previously these were built to various locations, includingassets/
,chunks/
and the root of build output.You can control this location with the new
build
configuration option namedassets
. -
#5893
be901dc98
Thanks @matthewp! - RenamegetEntry
togetEntryBySlug
This change moves
getEntry
togetEntryBySlug
and accepts a slug rather than an id.In order to improve support in
[id].astro
routes, particularly in SSR where you do not know what the id of a collection is. UsinggetEntryBySlug
instead allows you to map the[id]
param in your route to the entry. You can use it like this:--- import { getEntryBySlug } from 'astro:content'; const entry = await getEntryBySlug('docs', Astro.params.id); if (!entry) { return new Response(null, { status: 404, }); } --- <!-- You have an entry! Use it! -->
-
#5685
f6cf92b48
Thanks @bluwy! - Upgrade to Vite 4. Please see its migration guide for more information. -
#5724
16c7d0bfd
Thanks @bluwy! - Remove outdated Vue info log. RemovetoString
support forRenderTemplateResult
. -
#5684
a9c292026
& #576993e633922
Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.-
Markdown
-
Replace the
extendDefaultPlugins
option with agfm
boolean and asmartypants
boolean. These are enabled by default, and can be disabled to remove GitHub-Flavored Markdown and SmartyPants. -
Ensure GitHub-Flavored Markdown and SmartyPants are applied whether or not custom
remarkPlugins
orrehypePlugins
are configured. If you want to apply custom plugins and remove Astro's default plugins, manually setgfm: false
andsmartypants: false
in your config.
-
-
Migrate
extendDefaultPlugins
togfm
andsmartypants
You may have disabled Astro's built-in plugins (GitHub-Flavored Markdown and Smartypants) with the
extendDefaultPlugins
option. This has now been split into 2 flags to disable each plugin individually:markdown.gfm
to disable GitHub-Flavored Markdownmarkdown.smartypants
to disable SmartyPants
// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { - extendDefaultPlugins: false, + smartypants: false, + gfm: false, } });
Additionally, applying remark and rehype plugins no longer disables
gfm
andsmartypants
. You will need to opt-out manually by settinggfm
andsmartypants
tofalse
. -
MDX
-
Support all Markdown configuration options (except
drafts
) from your MDX integration config. This includessyntaxHighlighting
andshikiConfig
options to further customize the MDX renderer. -
Simplify
extendPlugins
to anextendMarkdownConfig
option. MDX options will default to their equivalent in your Markdown config. By settingextendMarkdownConfig
to false, you can "eject" to set your own syntax highlighting, plugins, and more.
-
-
Migrate MDX's
extendPlugins
toextendMarkdownConfig
You may have used the
extendPlugins
option to manage plugin defaults in MDX. This has been replaced by 3 flags:extendMarkdownConfig
(true
by default) to toggle Markdown config inheritance. This replaces theextendPlugins: 'markdown'
option.gfm
(true
by default) andsmartypants
(true
by default) to toggle GitHub-Flavored Markdown and SmartyPants in MDX. This replaces theextendPlugins: 'defaults'
option.
-
-
#5717
a3a7fc929
Thanks @bluwy! - Removestyle.postcss
Astro config. Refactor tailwind integration to configure throughvite
instead. Also disablesautoprefixer
in dev. -
#5825
52209ca2a
Thanks @bholmesdev! - Baseline the experimentalcontentCollections
flag. You're free to remove this from your astro config!import { defineConfig } from 'astro/config'; export default defineConfig({ - experimental: { contentCollections: true } })
-
#5707
5eba34fcc
Thanks @bluwy! - Remove deprecatedAstro
global APIs, includingAstro.resolve
,Astro.fetchContent
, andAstro.canonicalURL
.-
Astro.resolve
You can resolve asset paths using
import
instead. For example:--- import 'style.css'; import imageUrl from './image.png'; --- <img src={imageUrl} />
See the v0.25 migration guide for more information.
-
Astro.fetchContent
Use
Astro.glob
instead to fetch markdown files, or migrate to the Content Collections feature.let allPosts = await Astro.glob('./posts/*.md');
-
Astro.canonicalURL
Use
Astro.url
instead to construct the canonical URL.const canonicalURL = new URL(Astro.url.pathname, Astro.site);
-
-
#5608
899214298
Thanks @konojunya! - A trailing slash will not be automatically appended toimport.meta.env.SITE
. Instead, it will be the value of thesite
config as is. This may affect usages of${import.meta.env.SITE}image.png
, which will need to be updated accordingly. -
#5707
5eba34fcc
Thanks @bluwy! - RemovebuildConfig
option parameter from integrationastro:build:start
hook in favour of thebuild.config
option in theastro:config:setup
hook.export default function myIntegration() { return { name: 'my-integration', hooks: { 'astro:config:setup': ({ updateConfig }) => { updateConfig({ build: { client: '...', server: '...', serverEntry: '...', }, }); }, }, }; }
Minor Changes
-
#5901
a342a486c
Thanks @bluwy! - The fallback Svelte preprocessor will only be applied if a custompreprocess
option is not passed to thesvelte()
integration option, or in thesvelte.config.js
file.To support IDE autocompletion, or if you're migrating from
@astrojs/svelte
v1, you can create asvelte.config.js
file with:import { vitePreprocess } from '@astrojs/svelte'; export default { preprocess: vitePreprocess(), };
This file will also be generated by
astro add svelte
by default. -
#5786
c2180746b
Thanks @bholmesdev! - Move generated content collection types to a.astro
directory. This replaces the previously generatedsrc/content/types.generated.d.ts
file.If you're using Git for version control, we recommend ignoring this generated directory by adding
.astro
to your .gitignore.Astro will also generate the TypeScript reference path to include
.astro
types in your project. This will update your project'ssrc/env.d.ts
file, or write one if none exists. -
#5826
840412128
Thanks @bholmesdev! - Allow Zod objects, unions, discriminated unions, intersections, and transform results as content collection schemas.Migration
Astro requires a
z.object(...)
wrapper on all content collection schemas. Update your content collections config like so:// src/content/config.ts import { z, defineCollection } from 'astro:content'; const blog = defineCollection({ - schema: { + schema: z.object({ ... })
-
#5823
1f49cddf9
Thanks @delucis! - Generate content types when runningastro check
-
#5832
2303f9514
Thanks @HiDeoo! - Add support for serving well-known URIs with the @astrojs/node SSR adapter
Patch Changes
-
#5855
16dc36a87
Thanks @natemoo-re! - Remove legacy compiler error handling -
#5822
01f3f463b
Thanks @natemoo-re! - Fix edge case with bundle generation by emitting a single chunk for pages -
#5803
ae8a012a7
Thanks @bluwy! - Upgrade compiler and handle breaking changes -
#5840
cf2de5422
Thanks @chenxsan! - Persist CLI flags when restarting the dev server -
#5884
ce5c5dbd4
Thanks @MoustaphaDev! - Add a theme toggle button to the error overlay -
#5824
665a2c222
Thanks @bholmesdev! - Better handle content type generation failures:- Generate types when content directory is empty
- Log helpful error when running
astro sync
without a content directory - Avoid swallowing
config.ts
syntax errors from Vite
-
#5499
4987d6f44
Thanks @bluwy! - Handle custom injected entry files during build -
#5734
55cea0a9d
Thanks @natemoo-re! - Fixprerender
when used withgetStaticPaths
-
#5845
e818cc046
Thanks @bluwy! - Fix importing client-side components with alias -
#5849
8c100a6fe
Thanks @bluwy! - Handle server restart from Vite plugins -
#5756
116d8835c
Thanks @matthewp! - Fix for hoisted scripts in project with spaces in the file path -
#5917
7325df412
Thanks @natemoo-re! - Fix duplicate CSS in dev mode whenvite.css.devSourcemap
is provided -
#5743
2a5786419
Thanks @Princesseuh! - Add error location during build for user-generated errors -
#5761
fa8c131f8
Thanks @bholmesdev! - Add helpful error message when the MDX integration is missing. -
#5896
64b8082e7
Thanks @natemoo-re! - Update@astrojs/compiler
tov1.0.0
-
#5829
23dc9ea96
Thanks @giuseppelt! - FixCode.astro
shiki css class replace logic -
#5836
63a6ceb38
Thanks @natemoo-re! - Fix route matching when path includes special characters -
#5909
5fd9208d4
Thanks @jasikpark! - Update compiler to 1.0.1 -
#5852
3a00ecb3e
Thanks @rishi-raj-jain! - Respectvite.envPrefix
if provided -
#5872
b66d7195c
Thanks @bluwy! - EnableskipLibCheck
by default -
Updated dependencies [
93e633922
,e2019be6f
,1f92d64ea
,12f65a4d5
,46ecd5de3
,16107b6a1
,c55fbcb8e
,a9c292026
,1f92d64ea
,52209ca2a
,7572f7402
]:- @astrojs/markdown-remark@2.0.0
- @astrojs/telemetry@2.0.0
- @astrojs/webapi@2.0.0
2.0.0-beta.4
See changes in 2.0.0-beta.4
Major Changes
-
#5941
304823811
Thanks @bholmesdev! - Content collections: Introduce a newslug
frontmatter field for overriding the generated slug. This replaces the previousslug()
collection config option from Astro 1.X and the 2.0 beta.When present in a Markdown or MDX file, this will override the generated slug for that entry.
# src/content/blog/post-1.md --- title: Post 1 + slug: post-1-custom-slug ---
Astro will respect this slug in the generated
slug
type and when using thegetEntryBySlug()
utility:--- import { getEntryBySlug } from 'astro:content'; // Retrieve `src/content/blog/post-1.md` by slug with type safety const post = await getEntryBySlug('blog', 'post-1-custom-slug'); ---
Migration
If you relied on the
slug()
config option, you will need to move all custom slugs toslug
frontmatter properties in each collection entry.Additionally, Astro no longer allows
slug
as a collection schema property. This ensures Astro can manage theslug
property for type generation and performance. Remove this property from your schema and any relevantslug()
configuration:const blog = defineCollection({ schema: z.object({ - slug: z.string().optional(), }), - slug({ defaultSlug, data }) { - return data.slug ?? defaultSlug; - }, })
Patch Changes
-
#5499
4987d6f44
Thanks @bluwy! - Handle custom injected entry files during build -
#5917
7325df412
Thanks @natemoo-re! - Fix duplicate CSS in dev mode whenvite.css.devSourcemap
is provided -
#5909
5fd9208d4
Thanks @jasikpark! - Update compiler to 1.0.1 -
Updated dependencies [
46ecd5de3
]:- @astrojs/webapi@2.0.0-beta.1
2.0.0-beta.3
See changes in 2.0.0-beta.3
Major Changes
-
#5891
05caf445d
Thanks @bholmesdev! - Remove deprecated Markdown APIs from Astro v0.X. This includesgetHeaders()
, the.astro
property for layouts, and therawContent()
andcompiledContent()
error messages for MDX. -
#5893
be901dc98
Thanks @matthewp! - Move getEntry to getEntryBySlugThis change moves
getEntry
togetEntryBySlug
and accepts a slug rather than an id.In order to improve support in
[id].astro
routes, particularly in SSR where you do not know what the id of a collection is. UsinggetEntryBySlug
instead allows you to map the[id]
param in your route to the entry. You can use it like this:--- import { getEntryBySlug } from 'astro:content'; const entry = await getEntryBySlug('docs', Astro.params.id); if (!entry) { return new Response(null, { status: 404, }); } --- <!-- You have an entry! Use it! -->
-
#5608
899214298
Thanks @konojunya! - A trailing slash will not be automatically appended toimport.meta.env.SITE
. Instead, it will be the value of thesite
config as is. This may affect usages of${import.meta.env.SITE}image.png
, which will need to be updated accordingly.
Minor Changes
-
#5901
a342a486c
Thanks @bluwy! - The fallback Svelte preprocessor will only be applied if a custompreprocess
option is not passed to thesvelte()
integration option, or in thesvelte.config.js
file.To support IDE autocompletion, or if you're migrating from
@astrojs/svelte
v1, you can create asvelte.config.js
file with:import { vitePreprocess } from '@astrojs/svelte'; export default { preprocess: vitePreprocess(), };
This file will also be generated by
astro add svelte
by default.
Patch Changes
-
#5855
16dc36a87
Thanks @natemoo-re! - Remove legacy compiler error handling -
#5884
ce5c5dbd4
Thanks @MoustaphaDev! - Add a theme toggle button to the error overlay -
#5845
e818cc046
Thanks @bluwy! - Fix importing client-side components with alias -
#5849
8c100a6fe
Thanks @bluwy! - Handle server restart from Vite plugins -
#5896
64b8082e7
Thanks @natemoo-re! - Update@astrojs/compiler
tov1.0.0
-
#5852
3a00ecb3e
Thanks @rishi-raj-jain! - Respectvite.envPrefix
if provided -
#5872
b66d7195c
Thanks @bluwy! - EnableskipLibCheck
by default
2.0.0-beta.2
See changes in 2.0.0-beta.2
Major Changes
-
#5782
1f92d64ea
Thanks @Princesseuh! - Remove support for Node 14. Minimum supported Node version is now >=16.12.0 -
#5753
302e0ef8f
Thanks @bluwy! - Default preview host tolocalhost
instead of127.0.0.1
. This allows the static server and integration preview servers to serve under ipv6. -
#5842
c4b0cb8bf
Thanks @natemoo-re! - Breaking Change: client assets are built to an_astro
directory in the build output directory. Previously these were built to various locations, includingassets/
,chunks/
and the root of build output.You can control this location with the new
build
configuration option namedassets
. -
#5825
52209ca2a
Thanks @bholmesdev! - Baseline the experimentalcontentCollections
flag. You're free to remove this from your astro config!import { defineConfig } from 'astro/config'; export default defineConfig({ - experimental: { contentCollections: true } })
Minor Changes
-
#5786
c2180746b
Thanks @bholmesdev! - Move generated content collection types to a.astro
directory. This replaces the previously generatedsrc/content/types.generated.d.ts
file.If you're using Git for version control, we recommend ignoring this generated directory by adding
.astro
to your .gitignore.Astro will also generate the TypeScript reference path to include
.astro
types in your project. This will update your project'ssrc/env.d.ts
file, or write one if none exists. -
#5826
840412128
Thanks @bholmesdev! - Allow Zod objects, unions, discriminated unions, intersections, and transform results as content collection schemas.Migration
Astro requires a
z.object(...)
wrapper on all content collection schemas. Update your content collections config like so:// src/content/config.ts import { z, defineCollection } from 'astro:content'; const blog = defineCollection({ - schema: { + schema: z.object({ ... })
-
#5823
1f49cddf9
Thanks @delucis! - Generate content types when runningastro check
-
#5832
2303f9514
Thanks @HiDeoo! - Add support for serving well-known URIs with the @astrojs/node SSR adapter
Patch Changes
-
#5822
01f3f463b
Thanks @natemoo-re! - Fix edge case with bundle generation by emitting a single chunk for pages -
#5803
ae8a012a7
Thanks @bluwy! - Upgrade compiler and handle breaking changes -
#5840
cf2de5422
Thanks @chenxsan! - Persist CLI flags when restarting the dev server -
#5824
665a2c222
Thanks @bholmesdev! - Better handle content type generation failures:- Generate types when content directory is empty
- Log helpful error when running
astro sync
without a content directory - Avoid swallowing
config.ts
syntax errors from Vite
-
#5829
23dc9ea96
Thanks @giuseppelt! - FixCode.astro
shiki css class replace logic -
#5836
63a6ceb38
Thanks @natemoo-re! - Fix route matching when path includes special characters -
Updated dependencies [
1f92d64ea
,12f65a4d5
,16107b6a1
,c55fbcb8e
,1f92d64ea
,52209ca2a
,7572f7402
]:- @astrojs/telemetry@2.0.0-beta.0
- @astrojs/markdown-remark@2.0.0-beta.2
- @astrojs/webapi@2.0.0-beta.0
2.0.0-beta.1
See changes in 2.0.0-beta.1
Major Changes
-
#5778
49ab4f231
Thanks @bluwy! - Remove proload to load the Astro config. It will now use NodeJS and Vite to load the config only. -
#5771
259a539d7
Thanks @matthewp! - Removes support for astroFlavoredMarkdownIn 1.0 Astro moved the old Astro Flavored Markdown (also sometimes called Components in Markdown) to a legacy feature. This change removes the
legacy.astroFlavoredMarkdown
option completely.In 2.0 this feature will not be available in Astro at all. We recommend migration to MDX for those were still using this feature in 1.x.
-
#5717
a3a7fc929
Thanks @bluwy! - Removestyle.postcss
Astro config. Refactor tailwind integration to configure throughvite
instead. Also disablesautoprefixer
in dev.
Minor Changes
-
#5769
93e633922
Thanks @bholmesdev! - Introduce asmartypants
flag to opt-out of Astro's default SmartyPants plugin.{ markdown: { smartypants: false, } }
Migration
You may have disabled Astro's built-in plugins (GitHub-Flavored Markdown and Smartypants) with the
extendDefaultPlugins
option. This has now been split into 2 flags to disable each plugin individually:markdown.gfm
to disable GitHub-Flavored Markdownmarkdown.smartypants
to disable SmartyPants
// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { - extendDefaultPlugins: false, + smartypants: false, + gfm: false, } });
Patch Changes
-
#5734
55cea0a9d
Thanks @natemoo-re! - Fixprerender
when used withgetStaticPaths
-
#5756
116d8835c
Thanks @matthewp! - Fix for hoisted scripts in project with spaces in the file path -
#5743
2a5786419
Thanks @Princesseuh! - Add error location during build for user-generated errors -
#5761
fa8c131f8
Thanks @bholmesdev! - Add helpful error message when the MDX integration is missing. -
Updated dependencies [
93e633922
]:- @astrojs/markdown-remark@2.0.0-beta.1
2.0.0-beta.0
See changes in 2.0.0-beta.0
Major Changes
-
#5687
e2019be6f
Thanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This meansdata.astro.frontmatter
is now the complete Markdown or MDX document's frontmatter, rather than an empty object.This allows plugin authors to modify existing frontmatter, or compute new properties based on other properties. For example, say you want to compute a full image URL based on an
imageSrc
slug in your document frontmatter:export function remarkInjectSocialImagePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname; }; }
Content Collections - new
remarkPluginFrontmatter
propertyWe have changed inject frontmatter to modify frontmatter in our docs to improve discoverability. This is based on support forum feedback, where "injection" is rarely the term used.
To reflect this, the
injectedFrontmatter
property has been renamed toremarkPluginFrontmatter
. This should clarify this plugin is still separate from thedata
export Content Collections expose today.Migration instructions
Plugin authors should now check for user frontmatter when applying defaults.
For example, say a remark plugin wants to apply a default
title
if none is present. Add a conditional to check if the property is present, and update if none exists:export function remarkInjectTitlePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; + if (!frontmatter.title) { frontmatter.title = 'Default title'; + } } }
This differs from previous behavior, where a Markdown file's frontmatter would always override frontmatter injected via remark or reype.
-
#5728
8fb28648f
Thanks @natemoo-re! - The previously experimental features--experimental-error-overlay
and--experimental-prerender
, both added in v1.7.0, are now the default.You'll notice that the error overlay during
astro dev
has a refreshed visual design and provides more context for your errors.The
prerender
feature is now enabled by default when usingoutput: 'server'
. To prerender a particular page, addexport const prerender = true
to your frontmatter.Warning
Integration authors that previously relied on the exact structure of Astro's v1.0 build output may notice some changes to our output file structure. Please test your integrations to ensure compatability. Users that have configured a custom
vite.build.rollupOptions.output.chunkFileNames
should ensure that their Astro project is configured as an ESM Node project. Either include"type": "module"
in your rootpackage.json
file or use the.mjs
extension forchunkFileNames
. -
#5716
dd56c1941
Thanks @bluwy! - Remove MDX Fragment hack. This was used by@astrojs/mdx
to access theFragment
component, but isn't require anymore since@astrojs/mdx
v0.12.1. -
#5685
f6cf92b48
Thanks @bluwy! - Upgrade to Vite 4. Please see its migration guide for more information. -
#5724
16c7d0bfd
Thanks @bluwy! - Remove outdated Vue info log. RemovetoString
support forRenderTemplateResult
. -
#5684
a9c292026
Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.Markdown
- Remove
remark-smartypants
from Astro's default Markdown plugins. - Replace the
extendDefaultPlugins
option with a simplifiedgfm
boolean. This is enabled by default, and can be disabled to remove GitHub-Flavored Markdown. - Ensure GitHub-Flavored Markdown is applied whether or not custom
remarkPlugins
orrehypePlugins
are configured. If you want to apply custom plugins and remove GFM, manually setgfm: false
in your config.
MDX
- Support all Markdown configuration options (except
drafts
) from your MDX integration config. This includessyntaxHighlighting
andshikiConfig
options to further customize the MDX renderer. - Simplify
extendDefaults
to anextendMarkdownConfig
option. MDX options will default to their equivalent in your Markdown config. By settingextendMarkdownConfig
to false, you can "eject" to set your own syntax highlighting, plugins, and more.
Migration
To preserve your existing Markdown and MDX setup, you may need some configuration changes:
Smartypants manual installation
Smartypants has been removed from Astro's default setup. If you rely on this plugin, install
remark-smartypants
and apply to yourastro.config.*
:// astro.config.mjs import { defineConfig } from 'astro/config'; + import smartypants from 'remark-smartypants'; export default defineConfig({ markdown: { + remarkPlugins: [smartypants], } });
Migrate
extendDefaultPlugins
togfm
You may have disabled Astro's built-in plugins (GitHub-Flavored Markdown and Smartypants) with the
extendDefaultPlugins
option. Since Smartypants has been removed, this has been renamed togfm
.// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { - extendDefaultPlugins: false, + gfm: false, } });
Additionally, applying remark and rehype plugins no longer disables
gfm
. You will need to opt-out manually by settinggfm
tofalse
.Migrate MDX's
extendPlugins
toextendMarkdownConfig
You may have used the
extendPlugins
option to manage plugin defaults in MDX. This has been replaced by 2 flags:extendMarkdownConfig
(true
by default) to toggle Markdown config inheritance. This replaces theextendPlugins: 'markdown'
option.gfm
(true
by default) to toggle GitHub-Flavored Markdown in MDX. This replaces theextendPlugins: 'defaults'
option.
- Remove
-
#5707
5eba34fcc
Thanks @bluwy! - Remove deprecatedAstro
global APIs, includingAstro.resolve
,Astro.fetchContent
, andAstro.canonicalURL
.Astro.resolve
You can resolve asset paths using
import
instead. For example:--- import 'style.css'; import imageUrl from './image.png'; --- <img src={imageUrl} />
See the v0.25 migration guide for more information.
Astro.fetchContent
Use
Astro.glob
instead to fetch markdown files, or migrate to the Content Collections feature.let allPosts = await Astro.glob('./posts/*.md');
Astro.canonicalURL
Use
Astro.url
instead to construct the canonical URL.const canonicalURL = new URL(Astro.url.pathname, Astro.site);
-
#5707
5eba34fcc
Thanks @bluwy! - RemovebuildConfig
option parameter from integrationastro:build:start
hook in favour of thebuild.config
option in theastro:config:setup
hook.export default function myIntegration() { return { name: 'my-integration', hooks: { 'astro:config:setup': ({ updateConfig }) => { updateConfig({ build: { client: '...', server: '...', serverEntry: '...', }, }); }, }, }; }
Patch Changes
1.9.2
Patch Changes
1.9.1
Patch Changes
1.9.0
Minor Changes
- #5666
bf210f784
Thanks @bholmesdev! - Correctly handle spaces and capitalization insrc/content/
file names. This introduces github-slugger for slug generation to ensure slugs are usable bygetStaticPaths
. Changes:- Resolve spaces and capitalization:
collection/Entry With Spaces.md
becomescollection/entry-with-spaces
. - Truncate
/index
paths to base URL:collection/index.md
becomescollection
- Resolve spaces and capitalization:
Patch Changes
-
#5720
fe316be86
Thanks @umarov! - Do not add base path to a hoisted script body -
#5706
c2844a79c
Thanks @bluwy! - Add preact and sitemap integration to config load external list -
#5700
3aa3e00a6
Thanks @bholmesdev! - Fiximport.meta.env.DEV
always being set totrue
when using Content Collections
1.8.0
Minor Changes
- #5647
d72da5290
Thanks @bholmesdev! - Addastro sync
CLI command for type generation
Patch Changes
-
#5668
9674cf56c
Thanks @bholmesdev! - Remove strayconsole.log
from content collections error message -
#5652
0b5098758
Thanks @bluwy! - Use acorn to postprocess Astro globs -
#5648
853081d1c
Thanks @bholmesdev! - Prevent relative image paths insrc/content/
-
#5678
f8f576829
Thanks @bluwy! - Fix code generation quotes handling -
#5635
376f67011
Thanks @SegaraRai! - Addserver.headers
typing -
Updated dependencies [
853081d1c
,2c65b433b
]:- @astrojs/markdown-remark@1.2.0
1.7.2
Patch Changes
-
#5641
62580ed07
Thanks @chenxsan! - Fix "Maximum call stack size exceeded" error in vite-plugin-head-propagation -
#5644
d5aff85db
Thanks @natemoo-re! - Fix static build regression where chunks would not be generated -
#5639
1ac1ed86e
Thanks @bluwy! - Fixclient:only
imports with"importsNotUsedAsValues": "error"
tsconfig
1.7.1
Patch Changes
- #5617
33dcaa05b
Thanks @bholmesdev! - Fix error message when using Content Collections and an out-of-date@astrojs/mdx
integration
1.7.0
Minor Changes
-
#5297
d2960984c
Thanks @natemoo-re! - Introduces the experimental Prerender API.Note
This API is not yet stable and is subject to possible breaking changes!
- Deploy an Astro server without sacrificing the speed or cacheability of static HTML.
- The Prerender API allows you to statically prerender specific
pages/
at build time.
Usage
- First, run
astro build --experimental-prerender
or enableexperimental: { prerender: true }
in yourastro.config.mjs
file. - Then, include
export const prerender = true
in any file in thepages/
directory that you wish to prerender.
-
#5495
31ec84797
Thanks @Princesseuh! - Add a new error overlay designed by @doodlemarks! This new overlay should be much more informative, clearer, astro-y, and prettier than the previous one. -
#5291
5ec0f6ed5
Thanks @bholmesdev! - Introduce Content Collections experimental API- Organize your Markdown and MDX content into easy-to-manage collections.
- Add type safety to your frontmatter with schemas.
- Generate landing pages, static routes, and SSR endpoints from your content using the collection query APIs.
-
#5341
6b156dd3b
Thanks @alexpdraper! - Allow setting domain when deleting cookies
Patch Changes
- #5615
d85ec7484
Thanks @natemoo-re! - Sanitize dynamically rendered tags to strip out any attributes
1.6.15
Patch Changes
-
#5572
b2f0210c4
Thanks @matthewp! - Include base in 'page' stage injected scripts -
#5554
02bb0a1cc
Thanks @natemoo-re! - Update@astrojs/compiler
to latest -
#5577
2bd23e454
Thanks @jerzakm! - Updated magic-string to 0.27.0
1.6.14
Patch Changes
-
#5545
9082a850e
Thanks @bluwy! - Exclude astro from Vite optimization -
#5446
4f7f20616
Thanks @jyasskin! - Fix redirect() typing to allow all redirection status codes. -
#5511
05915fec0
Thanks @matthewp! - Low-level head propagationThis adds low-level head propagation ability within the Astro runtime. This is not really usable within an Astro app at the moment, but provides the APIs necessary for
renderEntry
to do head propagation. -
#5553
1aeabe417
Thanks @matthewp! - Fix Astro.params not having values when using base in SSR -
#5549
795f00f73
Thanks @matthewp! - Use accumulated sort order when order production CSS -
#5539
2c836b9d1
Thanks @wulinsheng123! - Error reporting fails on undefined error index -
#5548
8f3f67c96
Thanks @ido-pluto! - Removed premature optimization
1.6.13
Patch Changes
-
#5506
f536a34e5
Thanks @bluwy! - Dedupe Astro package when resolving -
#5506
f536a34e5
Thanks @bluwy! - Refactor Astro compile flow -
#5533
58188e053
Thanks @bluwy! - Refactor and remove esbuild dependency -
#5501
3c44033e4
Thanks @Princesseuh! - Added a warning in build when trying to hydrate an Astro component
1.6.12
Patch Changes
-
#5484
731e99df8
Thanks @Pimm! - Narrow type ofParams
, as its values cannot be numbers -
#5480
c13775279
Thanks @sapphi-red! - Fix astro preview not working on Windows -
#5497
ca01a71eb
Thanks @bluwy! - Refactor internal plugins code -
#5460
57888e069
Thanks @bluwy! - Fix linked Astro library style HMR -
#5477
5e693c214
Thanks @bluwy! - Prevent inlining SCSS partials in dev -
#5498
1a3923da7
Thanks @bluwy! - Optimize JSX import source detection
1.6.11
Patch Changes
-
#5433
936c1e411
Thanks @wtchnm! - Add missingfetchpriority
attribute to img, link, script and iframe elements -
#5437
4b188132e
Thanks @bluwy! - Correctly transform third-party JSX files -
#5434
f5ed630bc
Thanks @matthewp! - Use Vite's resolve to resolve paths for client:only
1.6.10
Patch Changes
-
#5431
1ab505855
Thanks @matthewp! - Fix regression with loading .ts in .mjs config -
#5426
ff35b4759
Thanks @bluwy! - Fix JSX tagging for anonymous higher-order components default export -
#5430
b22ba1c03
Thanks @bluwy! - Fix preview --host in Node.js 18 -
#5417
a9f7ff966
Thanks @matthewp! - Prevent dev from crashing when there are errors in template
1.6.9
Patch Changes
-
#5409
9f80a4046
Thanks @matthewp! - Fix Code component usage in Vercel -
#5410
3c5cb6948
Thanks @impcyber! - Fix: https://github.com/withastro/astro/issues/5400 -
#5412
a278c7ae6
Thanks @matthewp! - Restart dev server on package.json changes -
#5377
40226dd14
Thanks @matthewp! - Uses vite to load astro.config.ts files
1.6.8
Patch Changes
-
#5375
f9104354b
Thanks @Princesseuh! - Fix regression causing nested arrays ingetStaticPaths
's return value to throw an error -
#5346
f3181b5ad
Thanks @bluwy! - Fix .html.astro file routing in dev -
#5358
9eee0f016
Thanks @matthewp! - Properly support trailingSlash: never with a base -
#5345
3ae2a961b
Thanks @bluwy! - Respect Vite user config for third-party packages config handling -
#5371
bee8c14af
Thanks @matthewp! - Prefer thebase
config rather than site config for creating URLs for links and scripts. -
#5369
e385076ef
Thanks @natemoo-re! - Upgrade@astrojs/compiler
, fixes regression withbody
handling whenhead
contains a Component node
1.6.7
Patch Changes
-
#5353
b3d936ac2
Thanks @matthewp! - Updated the CSS naming algorithm to prevent clashes -
#5294
ae41f25e1
Thanks @mrienstra! - Consistent Markdown frontmatter typing (MarkdownAstroData["frontmatter"]
in particular wasobject
before)
1.6.6
Patch Changes
-
#5316
a780f2595
Thanks @Princesseuh! - Improved error messages descriptions and hints to be more informative -
#5331
688f8e4bc
Thanks @matthewp! - Allow dynamic segments in injected routes -
#5330
7e19e8b30
Thanks @matthewp! - Prevent jsx throws from hanging server -
#5328
bcd0f8f8c
Thanks @matthewp! - 404 when not using subpath for items in public in devPreviously if using a base like
base: '/subpath/
you could load things from the root, which would break in prod. Now you must include the subpath. -
#5339
03a8f89d5
Thanks @natemoo-re! - Upgrade@astrojs/compiler
to latest -
#5327
0dcdc6fb1
Thanks @Princesseuh! - Update Astro language-server to 0.28.3
1.6.5
Patch Changes
-
#5326
88c1bbe3a
Thanks @matthewp! - Fix omitted island hydration scripts in slots -
#5301
a79a37cad
Thanks @bluwy! - Improve environment variable handling performance
1.6.4
Patch Changes
-
#5290
b2b291d29
Thanks @matthewp! - Handle base configuration in adaptersThis allows adapters to correctly handle
base
configuration. Internally Astro now matches routes when the URL includes thebase
.Adapters now also have access to the
removeBase
method which will remove thebase
from a pathname. This is useful to look up files for static assets. -
#5292
97e2b6ad7
Thanks @MontelAle! - Changes slow astro cli imports to dynamic -
#5293
4af4d8fa0
Thanks @matthewp! - Prevent overcaching .astro HMR changes -
#5314
f6add3924
Thanks @matthewp! - Fixes regression with config file restarts -
#5298
247eb7411
Thanks @wulinsheng123! - have not founded style when srcDir was root
1.6.3
Patch Changes
-
#5273
c7b9b14a1
Thanks @matthewp! - Surface astro.config errors to the user -
#5264
0d27c4a2b
Thanks @VladCuciureanu! - Fixed memleak caused by project dir names containing '.md' or '.mdx' -
#5258
74759cf78
Thanks @bluwy! - Allow 200 response for endpoints in build -
#5284
126cd8e83
Thanks @herteleo! - Include missingclass:list
withinHTMLAttributes
type -
#5236
1cc067052
Thanks @bluwy! - Refactor CSS preprocessing handling -
#5198
c77a6cbe3
Thanks @matthewp! - HMR - Improved error recoveryThis improves error recovery for HMR. Now when the dev server finds itself in an error state (because a route contained an error), it will recover from that state and refresh the page when the user has corrected the mistake.
1.6.2
Patch Changes
-
#5243
7d678c9ed
Thanks @matthewp! - Upgrade@astrojs/compiler
to 0.29.x -
Updated dependencies [
b6a478f37
]:- @astrojs/webapi@1.1.1
1.6.1
Patch Changes
-
#5233
7f8987085
Thanks @bluwy! - Support rendering@motionone/solid
components -
#5238
26ff42905
Thanks @MoustaphaDev! - Fix not included file extension inurl
metadata for newly added markdown files -
#5217
8c83359e3
Thanks @Princesseuh! - Fix missing types.d.ts in npm package -
#5206
d64d5b9b5
Thanks @Princesseuh! - Improve error messages related to CSS and compiler errors -
#5212
a609a8937
Thanks @bluwy! - Allow importing public files in SSR
1.6.0
Minor Changes
-
#5147
0bf0758fb
Thanks @natemoo-re! - Addastro/types
entrypoint. These utilities can be used for common prop type patterns.HTMLAttributes
If you would like to extend valid HTML attributes for a given HTML element, you may use the provided
HTMLAttributes
type—it accepts an element name and returns the valid HTML attributes for that element name.import { HTMLAttributes } from 'astro/types'; interface Props extends HTMLAttributes<'a'> { myProp?: string; }
-
#5164
4a8a346ca
Thanks @MoustaphaDev! - Add support for markdown files with the following extensions:.markdown
.mdown
.mkdn
.mkd
.mdwn
-
#4917
ddf2f8390
Thanks @natemoo-re! - Add support for--base
CLI argument, which will override thebase
set in yourastro.config.mjs
file.astro --site https://astro.build --base /docs
Patch Changes
1.5.3
Patch Changes
-
#5133
1c477dd8d
Thanks @bluwy! - Update@astrojs/compiler
and use the newresolvePath
option. This allows removing much of the runtime code, which should improve rendering performance for Astro and MDX pages. -
#5192
8728ee0b9
Thanks @tony-sull! -astro add
no longer automatically installs optional peer dependencies
1.5.2
Patch Changes
-
#5119
430e0346c
Thanks @bluwy! - Usefs.promises.rm
to remove node deprecation warning -
#5123
9745009ae
Thanks @matthewp! - Fixes index page with build.format=file -
#5116
500acb3c1
Thanks @matthewp! - Throws when using Response.redirect in SSG mode
1.5.1
Patch Changes
-
#5110
0edfdd325
Thanks @bluwy! - Ensure CLI flags override function-style server config -
#5106
ef0c54316
Thanks @bluwy! - Support spread parameters for server endpoints -
#5095
ddfbef5ac
Thanks @Princesseuh! - Fixastro add
trying to add lines from extended configurations when adding frameworks -
#5076
6f9a88b31
Thanks @Princesseuh! - Fix jsconfig.json aliases not working anymore after 1.5.0 -
#5080
90b715d5c
Thanks @matthewp! - Fix Astro-in-MDX dashes in slot attr -
#5098
f684e9d36
Thanks @jkjustjoshing! - Separate type definitions for built-in HTML elements and custom elements. Helpful when implementing an "as" prop similar to styled-components. -
#5108
ce01225a7
Thanks @Princesseuh! - Fix types not working properly when usingmoduleResolution: 'node16'
-
#5060
5923dd77c
Thanks @AirBorne04! - api routes: adding cookies to the response, also when returning a simple result -
#5087
49a8d18b4
Thanks @JuanM04! - Fixastro add
pnpm command
1.5.0
Minor Changes
-
#5056
e55af8a23
Thanks @matthewp! - # Adapter support forastro preview
Adapters are now about to support the
astro preview
command via a new integration option. The Node.js adapter@astrojs/node
is the first of the built-in adapters to gain support for this. What this means is that if you are using@astrojs/node
you can new preview your SSR app by running:npm run preview
Adapter API
We will be updating the other first party Astro adapters to support preview over time. Adapters can opt-in to this feature by providing the
previewEntrypoint
via thesetAdapter
function inastro:config:done
hook. The Node.js adapter's code looks like this:export default function() { return { name: '@astrojs/node', hooks: { 'astro:config:done': ({ setAdapter, config }) => { setAdapter({ name: '@astrojs/node', serverEntrypoint: '@astrojs/node/server.js', + previewEntrypoint: '@astrojs/node/preview.js', exports: ['handler'], }); // more here } } }; }
The
previewEntrypoint
is a module in the adapter's package that is a Node.js script. This script is run whenastro preview
is run and is charged with starting up the built server. See the Node.js implementation in@astrojs/node
to see how that is implemented. -
#4986
ebd364e39
Thanks @bluwy! - ## New properties for API routesIn API routes, you can now get the
site
,generator
,url
,clientAddress
,props
, andredirect
fields on the APIContext, which is the first parameter passed to an API route. This was done to make the APIContext more closely align with theAstro
global in .astro pages.For example, here's how you might use the
clientAddress
, which is the user's IP address, to selectively allow users.export function post({ clientAddress, request, redirect }) { if (!allowList.has(clientAddress)) { return redirect('/not-allowed'); } }
Check out the docs for more information on the newly available fields: https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes
-
#4959
0ea6187f9
Thanks @Princesseuh! - Added support for updating TypeScript settings automatically when usingastro add
The
astro add
command will now automatically update yourtsconfig.json
with the proper TypeScript settings needed for the chosen frameworks.For instance, typing
astro add solid
will update yourtsconfig.json
with the following settings, per Solid's TypeScript guide:{ "compilerOptions": { "jsx": "preserve", "jsxImportSource": "solid-js" } }
-
#4947
a5e3ecc80
Thanks @JuanM04! - - AddedisRestart
andaddWatchFile
to integration stepisRestart
.- Restart dev server automatically when tsconfig changes.
-
#4986
ebd364e39
Thanks @bluwy! - ## Support passing a custom status code for Astro.redirectNew in this minor is the ability to pass a status code to
Astro.redirect
. By default it uses302
but now you can pass another code as the second argument:--- // This page was moved return Astro.redirect('/posts/new-post-name', 301); ---
-
#5056
e55af8a23
Thanks @matthewp! - # New build configurationThe ability to customize SSR build configuration more granularly is now available in Astro. You can now customize the output folder for
server
(the server code for SSR),client
(your client-side JavaScript and assets), andserverEntry
(the name of the entrypoint server module). Here are the defaults:import { defineConfig } from 'astro/config'; export default defineConfig({ output: 'server', build: { server: './dist/server/', client: './dist/client/', serverEntry: 'entry.mjs', }, });
These new configuration options are only supported in SSR mode and are ignored when building to SSG (a static site).
Integration hook change
The integration hook
astro:build:start
includes a parambuildConfig
which includes all of these same options. You can continue to use this param in Astro 1.x, but it is deprecated in favor of the newbuild.config
options. All of the built-in adapters have been updated to the new format. If you have an integration that depends on this param we suggest upgrading to do this instead:export default function myIntegration() { return { name: 'my-integration', hooks: { 'astro:config:setup': ({ updateConfig }) => { updateConfig({ build: { server: '...', }, }); }, }, }; }
Patch Changes
-
#5057
baf88ee9e
Thanks @bluwy! - Skip JSX tagging for export statements with source -
#5044
44ea0c6d9
Thanks @JuanM04! - Upgrade Astro compiler to 0.27.1 -
#5059
f7fcdfe62
Thanks @bluwy! - Support strict dependency install for libraries with JSX -
#5047
1e2799243
Thanks @matthewp! - Update Astro.cookies.set types to allow booleans and numbersNote that booleans and numbers were already allowed, they just were not allowed by the type definitions.
1.4.7
Patch Changes
-
#5035
d7bfb144b
Thanks @AirBorne04! - preventing multiple doctype injection into html documents -
#5015
b1964e9e1
Thanks @matthewp! - Shared state in Preact components with signalsThis makes it possible to share client state between Preact islands via signals.
For example, you can create a signals in an Astro component and then pass it to multiple islands:
--- // Component Imports import Counter from '../components/Counter'; import { signal } from '@preact/signals'; const count = signal(0); --- <Count count={count} /> <Count count={count} />
-
#5036
38fdb4ca6
Thanks @matthewp! - New algorithm for shorter CSS bundle names
1.4.6
Patch Changes
1.4.5
Patch Changes
-
#4981
1f890b336
Thanks @matthewp! - Ensure dynamic tags have their slot instructions yielded -
#4886
61d26f335
Thanks @yuhang-dong! - Fix: import.meta.env.BASE_URL will be '/' in client loaded component on dev mode -
#4973
c733d4fb8
Thanks @bluwy! - Support Astro.slots.render for mdx -
#4918
a6bb2694b
Thanks @bluwy! - Refactor hydration path handling -
#4977
4f73b98ae
Thanks @tony-sull! - Fixes a bug that logged route cache warnings inastro dev
-
#4887
37cb2fc02
Thanks @Calvin-LL! - fix object styles not escaped -
#4990
8f9791d84
Thanks @matthewp! - Upgrade Astro compiler to 0.26.0
1.4.4
Patch Changes
-
#4967
e6a881081
Thanks @matthewp! - Final perf fix from 1.3.0 regressionA regression in rendering perf happened in 1.3.0. This is the final fix for the underlying issue.
1.4.3
Patch Changes
-
#4956
ee8dd424f
Thanks @matthewp! - Fix perf regression in SSR -
#4952
5bcd76e3a
Thanks @bluwy! - Refactor ViteConfigWithSSR type
1.4.2
Patch Changes
-
#4932
9898088c0
Thanks @matthewp! - Prevent hydration mismatch in streaming SSR -
#4939
cf2bba1e4
Thanks @natemoo-re! - Fix MDX error handling, preventing a memory leak
1.4.1
Patch Changes
- #4928
7690849a8
Thanks @Princesseuh! - Fix module definition of Markdown and MDX files not being available outside Astro files
1.4.0
Minor Changes
-
#4907
01c1aaa00
Thanks @matthewp! - Order Astro styles last, to override imported stylesThis fixes CSS ordering so that imported styles are placed higher than page/component level styles. This means that if you do:
--- import '../styles/global.css'; --- <style> body { background: limegreen; } </style>
The
<style>
defined in this component will be placed below the imported CSS. When compiled for production this will result in something like this:/* /src/styles/global.css */ body { background: blue; } /* /src/pages/index.astro */ body:where(.astro-12345) { background: limegreen; }
Given Astro's 0-specificity hashing, this change effectively makes it so that Astro styles "win" when they have the same specificity as global styles.
-
#4876
d3091f89e
Thanks @matthewp! - Adds the Astro.cookies APIAstro.cookies
is a new API for manipulating cookies in Astro components and API routes.In Astro components, the new
Astro.cookies
object is a map-like object that allows you to get, set, delete, and check for a cookie's existence (has
):--- type Prefs = { darkMode: boolean; }; Astro.cookies.set<Prefs>( 'prefs', { darkMode: true }, { expires: '1 month', } ); const prefs = Astro.cookies.get<Prefs>('prefs').json(); --- <body data-theme={prefs.darkMode ? 'dark' : 'light'}></body>
Once you've set a cookie with Astro.cookies it will automatically be included in the outgoing response.
This API is also available with the same functionality in API routes:
export function post({ cookies }) { cookies.set('loggedIn', false); return new Response(null, { status: 302, headers: { Location: '/login', }, }); }
See the RFC to learn more.
Patch Changes
-
#4892
ff7ba0ee0
Thanks @matthewp! - Prevent multiple rendering of head content -
#4842
812658ad2
Thanks @bluwy! - Add missing dependencies, support strict dependency installation (e.g. pnpm) -
#4891
87a7cf48e
Thanks @matthewp! - Hoist hydration scripts out of slot templates -
Updated dependencies [
812658ad2
,812658ad2
]:- @astrojs/markdown-remark@1.1.3
- @astrojs/telemetry@1.0.1
1.3.1
Patch Changes
-
#4861
42fe8e0c7
Thanks @rishi-raj-jain! - use const instead of let for define:vars -
#4878
90c207299
Thanks @rishi-raj-jain! - add warning for post routes called when output is not server -
#4855
49ca9e129
Thanks @matthewp! - Fix TS errors when not using skipLibCheck -
#4845
3389f0ce9
Thanks @matthewp! - Prevent the root folder from being deleted during the build -
#4841
4b092269c
Thanks @rishi-raj-jain! - copy assets even if outDir is out of process.cwd() -
#4849
ee5fdeffd
Thanks @rishi-raj-jain! - append .html to the file URL in case build.format says file -
#4867
03e8b750a
Thanks @rishi-raj-jain! - check if class:list's value is defined before converting -
#4873
83ed1cc1f
Thanks @bluwy! - Prevent /undefined catch-all routes in dev -
#4454
6a1a17dd2
Thanks @bluwy! - Allow HMR for internal e2e tests -
#4712
17dbc6701
Thanks @Lifeni! - Fix slashes for paths containing non-ASCII characters on Windows -
#4850
edb7bead6
Thanks @rishi-raj-jain! - add support for changing mode via CLI -
#4868
b99f9902b
Thanks @rishi-raj-jain! - remove all the ssr generated folders in static build if only empty -
Updated dependencies [
5e4c5252b
]:- @astrojs/webapi@1.1.0
1.3.0
Minor Changes
-
#4775
b0cc93996
Thanks @tony-sull! - Adds a new "astro:build:generated" hook that runs after SSG builds finish but before build artifacts are cleaned up. This is a very specific use case, "astro:build:done" is probably what you're looking for. -
#4669
a961aa3c2
Thanks @aggre! - astro-island now correctly passes Uint8Array/Uint16Array/Uint32Array -
#4832
73f215df7
Thanks @matthewp! - Allows Responses to be passed to set:htmlThis expands the abilities of
set:html
to ultimate service this use-case:<div set:html={fetch('/legacy-post.html')} />
This means you can take a legacy app that has been statically generated to HTML and directly consume that HTML within your templates. As is always the case with
set:html
, this should only be used on trusted content.To make this possible, you can also pass several other types into
set:html
now:Response
objects, since that is what fetch() returns:<div set:html={new Response('<span>Hello world</span>', { headers: { 'content-type': 'text/html' }, })} />
ReadableStream
s:<div set:html={new ReadableStream({ start(controller) { controller.enqueue(`<span>read me</span>`); controller.close(); }, })} />
AsyncIterable
s:<div set:html={(async function* () { for await (const num of [1, 2, 3, 4, 5]) { yield `<li>${num}</li>`; } })()} />
Iterable
s (non-async):<div set:html={(function* () { for (const num of [1, 2, 3, 4, 5]) { yield `<li>${num}</li>`; } })()} />
Patch Changes
-
#4831
29b29e6a8
Thanks @yuhang-dong! - Update vite-jsx-plugin for jsx export -
#4754
baae1b3fd
Thanks @Princesseuh! - Updateastro check
to latest version of the language server
1.2.8
Patch Changes
-
#4813
be9eaa069
Thanks @bluwy! - Allow overridevite.build.target
-
#4817
a49bc2f02
Thanks @mohammed-elhaouari! - fix parsing integration names with astro add command -
#4819
518e8f7e2
Thanks @matthewp! - Allow passing promises to set:html -
#4807
44fa37818
Thanks @lucacasonato! - Remove explicitTransfer-Encoding: chunked
header from streaming responses -
#4803
f53d97d56
Thanks @Enteleform! - replaces hard-codedminify
values withvite.build.minify
-
Updated dependencies [
df54595a8
]:- @astrojs/markdown-remark@1.1.2
1.2.7
Patch Changes
1.2.6
Patch Changes
1.2.5
Patch Changes
-
#4768
9a59e24e0
Thanks @matthewp! - nsure before-hydration is only loaded when used -
#4759
fc885eaea
Thanks @matthewp! - Read jsxImportSource from tsconfig
1.2.4
Patch Changes
-
#4736
13ca686ea
Thanks @bluwy! - Handle builds with outDir outside of current working directory -
#4748
c5e134d03
Thanks @bluwy! - Fix console.error filtering -
#4742
cf8a7e933
Thanks @matthewp! - Allow file uploads in dev server -
#4594
005d5bacd
Thanks @matthewp! - Allow custom 404 route to handle API route missing methods
1.2.3
Patch Changes
1.2.2
Patch Changes
-
#4705
5b6173fd0
Thanks @Princesseuh! - Properly show an error message when a renderer is not properly configured -
#4723
0dba3b6f3
Thanks @matthewp! - Makes the dev server more resilient to crashes
1.2.1
Patch Changes
- #4703
d28f7013c
Thanks @bholmesdev! - Fix: [astro add] Apply fetch polyfill before running
1.2.0
Minor Changes
-
#4682
d1e695914
Thanks @bholmesdev! - astro add - move configuration updates to final step -
#4549
255636cc7
Thanks @altano! - Allow specifying custom encoding when using a non-html route. Only option before was 'utf-8' and now that is just the default. -
#4578
c706d845e
Thanks @bholmesdev! - Restart dev server when config file is added, updated, or removed
Patch Changes
1.1.8
Patch Changes
-
#4675
63e49c3b6
Thanks @matthewp! - Prevent locking up when encountering invalid CSS -
#4684
919df13b9
Thanks @natemoo-re! - Fixes regression introduced in #4646 with better cyclic reference detection -
#4683
cc242d3af
Thanks @Princesseuh! - Fixtsc
compilation errors whenskipLibCheck
wasn't enabled -
#4667
9290b2414
Thanks @Holben888! - Fix framework components on Vercel Edge -
#4645
f27ca6ab3
Thanks @bholmesdev! - Fix client-side scripts reloads on dev server in windows
1.1.7
Patch Changes
-
#4646
98f242cdc
Thanks @natemoo-re! - Add cyclic ref detection when serializing props -
#4656
6d845c353
Thanks @matthewp! - Fix bug with usingassert
as import identifier -
#4403
d31e72c3b
Thanks @JohnDaly! - Fix for components, declared with JSXMemberExpression nodes, that failed to hydrate due to incomplete 'component-export' metadata
1.1.6
Patch Changes
-
#4623
eb1862b4e
Thanks @delucis! - Improve third-party Astro package support -
#4643
307b7b97c
Thanks @matthewp! - Remove regression when there is duplicate client/server CSS -
#4584
29a5fdc15
Thanks @bluwy! - Correctly escape paths in file names -
#4621
0068afb87
Thanks @AllanChain! - Ensure SSR module is loaded before testing if it's CSS in dev
1.1.5
Patch Changes
1.1.4
Patch Changes
-
#4586
16814dc71
Thanks @bluwy! - Move ast-types as dev dependency -
#4585
f018e365c
Thanks @FredKSchott! - Add docs link to "missing adapter" error msg
1.1.3
Patch Changes
- #4574
b92c24f40
Thanks @delucis! - Updateastro add
to list official integrations & adapters with same organisation we use in docs
1.1.2
Patch Changes
-
#4519
a2e8e76c3
Thanks @JuanM04! - Upgraded Shiki to v0.11.1 -
#4531
2d2e38e47
Thanks @bluwy! - Remove hardcoded Vite middleware handling -
#4553
2f05f5d30
Thanks @matthewp! - Include trailingSlash in astro:build:done hookThis change ensures that the
pages
provided in theastro:build:done
hook conform to thetrailingSlash
andbuild.format
configs. -
#4526
046bfd908
Thanks @bluwy! - Skip clean SSR output if page generation fails -
#4546
bb71be78d
Thanks @bholmesdev! - Update "Add an Adapter" help heading to "Add an SSR Adapter" -
#4548
69b640b87
Thanks @bholmesdev! - Fix "failed to load for SSR" on styles when using tailwind -
#4535
ca28d7578
Thanks @Princesseuh! - Add missingslot
attributes to SVG definitions -
#4524
d431fbe4e
- fix import in the config type declarations -
Updated dependencies [
a2e8e76c3
]:- @astrojs/markdown-remark@1.1.1
1.1.1
Patch Changes
- #4507
4e1af3f0e
Thanks @Princesseuh! - Fiximport-meta.d.ts
not being included in the npm package
1.1.0
Minor Changes
- #4352
cd154e447
Thanks @matthewp! - Make Astro.url match the build.format configuration during the build
- #4423
d4cd7a59f
Thanks @bholmesdev! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment
- #4474
ac0321824
Thanks @bholmesdev! - Add "extends" to markdown plugin config to preserve Astro defaults
Patch Changes
- #4500
9874c7bf4
Thanks @Princesseuh! - Updateastro check
to use latest version of the Astro language server
- #4439
77ce6be30
Thanks @Princesseuh! - Add tsconfig templates for users to extend from
- #4499
1f42c0791
Thanks @Princesseuh! - Fixtsc
not being able to find Vite's import.meta types on Linux
-
#4497
78e06c8ec
Thanks @bholmesdev! - Production build logging - Only log[code].html
instead of[code]/index.html
for 404 and 500 routes -
Updated dependencies [
ac0321824
,839097c84
]:- @astrojs/markdown-remark@1.1.0
1.1.0-next.0
Minor Changes
- #4352
cd154e447
Thanks @matthewp! - Make Astro.url match the build.format configuration during the build
- #4423
d4cd7a59f
Thanks @bholmesdev! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment
- #4474
ac0321824
Thanks @bholmesdev! - Add "extends" to markdown plugin config to preserve Astro defaults
Patch Changes
-
#4439
77ce6be30
Thanks @Princesseuh! - Add tsconfig templates for users to extend from -
Updated dependencies [
ac0321824
,839097c84
]:- @astrojs/markdown-remark@1.1.0-next.0
1.0.9
Patch Changes
- #4456
47e71ae8f
Thanks @Princesseuh! - Added an error message when the second argument of Astro.slots.render is not an array
1.0.8
Patch Changes
- #4427
b2e976f39
Thanks @cameronmcefee! - Fix config types to allow falsy values in integrations list, to match docs
- #4385
8164fa6f1
Thanks @krolebord! - Fix warning when using hooks inside the react components not exported as a function declaration
- #4445
df4e99928
Thanks @bholmesdev! - Add "waiting for X integration" log for long-running integration hooks
- #4430
dc42f2c00
Thanks @bholmesdev! - astro add - Fix third-party npm orgs, i.e.@example/integration
- #4441
ca0c7e8b8
Thanks @Princesseuh! - Allow arbitrary strings on the target attribute
-
#4446
27ac6a03a
Thanks @matthewp! - Deterministic CSS orderingThis makes our CSS link order deterministic. It uses CSS depth; that is how deeply a module import the CSS comes from, in order to determine which CSS is page-level vs. component-level CSS.
This is intended to match dev ordering where, because we do not bundle, the page-level CSS always comes after component-level.
1.0.7
Patch Changes
- #4362
aa5118e85
Thanks @joseph-lozano! - Allow user config to setmarkdown.drafts
option
- #4405
a70f69a06
Thanks @FredKSchott! - Refactor JSX build plugin, improve performance
1.0.6
Patch Changes
- #4324
45fdbc465
Thanks @BurntCaramel! - Use TextEncoder instead of Buffer.byteLength() for Deno compatibility
- #4329
0274b8d47
Thanks @tony-sull! - Updates routing logic to allow multiple routes to match the same URL in SSR
- #4347
166b3b8a5
Thanks @bholmesdev! - Fix MDXLayoutProps type signature for linting
1.0.5
Patch Changes
- #4302
1d3a0a16f
Thanks @FredKSchott! - Revert "Ensure hydration scripts inside of slots render ASAP (#4288)" to fix Svelte integration bug
- #4284
73f367c77
Thanks @FredKSchott! - Prevent preview if 'output: server' is configured
1.0.4
Patch Changes
- #4268
f7afdb889
Thanks @bholmesdev! - Align MD with MDX on layout props and "glob" import results:- Add
Content
to MDX - Add
file
andurl
to MDX frontmatter (layout import only) - Update glob types to reflect differences (lack of
rawContent
andcompiledContent
)
- Add
- #4265
8f845ca95
Thanks @matthewp! - Prevents automatic trailingSlash appending on getStaticPaths produced pages
- #4282
c0992e1fe
Thanks @natemoo-re! - Fix bug where Astro's server runtime would end up in the browser
- #4272
24d2f7a6e
Thanks @natemoo-re! - Properly handle hydration for namespaced components
- #4289
3ca905174
Thanks @bholmesdev! - [astro add] Setoutput: 'server'
when adding adapter
1.0.3
Patch Changes
- #4279
42fd6936c
Thanks @FredKSchott! - Handle "not found" imports without throwing an "Invalid URL" error
- #4273
0022f46b5
Thanks @Princesseuh! - Fix build output adding/index.html
at the end of endpoints route
- #4270
7127b1bb3
Thanks @natemoo-re! - Make third-party integration names nicer when usingastro add
1.0.2
Patch Changes
- #4240
561a34d91
Thanks @matthewp! - Properly invalidate Astro modules when a child script updates in HMR
1.0.1
Patch Changes
3a7f2385e
Thanks @FredKSchott! - Add rawContent and compiledContent to MD layout props
1.0.0
Astro v1.0 is out! Read the official announcement post.
Note
If you need help migrating an existing Astro project to the new Astro v1.0, check out our updated Migration Guide and full documentation website.
0.X
For older changelog entries -- including all v0.X, v1.0 Beta, and v1.0 Release Candidate versions -- check out the v0.X changelog.