Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
214 KiB
astro
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.
Features
Astro v1.0 includes a few new features and improvements since our original beta announcement back in April, including:
- SSR Builds: Server output is now stable and available for production use.
- Image Optimization: New
<Image />
and<Picture />
components available with@astrojs/image
. - MDX Support: A standard syntax for mixing UI components in Markdown is available with
@astrojs/mdx
. - Vite 3.0: An upgrade to our internal build engine, Vite.
Breaking Changes
Astro.canonicalURL
has been deprecated. Please useAstro.url
to construct your own canonical URL.- CSS Specificity is now preserved for scoped styles. See the migration guide for more details.
Warning
Please visually inspect your site output to make sure everything is styled as expected. If not, find your scoped style and increase the selector specificity manually to match the old behavior.
- Components and JSX in Markdown has been deprecated. For long-term support you should migrate to the
@astrojs/mdx
integration. See the migration guide for more details. - The previously deprecated
<Markdown>
component has been removed. It is now available as a separate package,@astrojs/markdown-component
.
If you are coming from v0.25 or earlier, make sure you have read and followed the v0.26 Migration Guide, which contained several major breaking changes.
Patch Changes
- Updated dependencies [
04ad44563
]:- @astrojs/markdown-remark@1.0.0
- @astrojs/telemetry@1.0.0
- @astrojs/webapi@1.0.0
1.0.0-rc.8
Patch Changes
- #4012
f207c417e
Thanks @natemoo-re! - AddsAstro.generator
which can be used to add a<meta name="generator">
tag.
- #4201
25d36d955
Thanks @matthewp! - Adds warning in dev when using client: directive on Astro component
- #4203
ec376369a
Thanks @natemoo-re! - Ensure JSX does not reference server entrypoint
- #4189
5e71a8720
Thanks @jablonski! - Fix custom 404 pages when usingastro preview
(#4113)
1.0.0-rc.7
Minor Changes
- #4176
2675b8633
Thanks @bholmesdev! - Support frontmatter injection for MD and MDX using remark and rehype plugins
- #4137
471c6f784
Thanks @bholmesdev! - Speed up internal markdown builds with new vite-plugin markdown
Patch Changes
- #4154
36223f663
Thanks @natemoo-re! - ExposegetViteConfig
fromastro/config
to unblock usage with Vitest
- #4158
e569f0a5c
Thanks @natemoo-re! - Fix edge case where MDX components would be escaped
- #4157
025743849
Thanks @natemoo-re! - Fix duplicated CSS when using HMR
- #4153
3321aace0
Thanks @FredKSchott! - Improve an error message for getStaticPaths
- #4180
c56a9227c
Thanks @natemoo-re! - Fix edge case where Astro component would render [Object object] when using MDX
-
#4136
9afa4611c
Thanks @natemoo-re! - Fix issue when using Fragment inside MDX -
Updated dependencies [
2675b8633
,471c6f784
,16034f0dd
]:- @astrojs/markdown-remark@0.14.1
1.0.0-rc.6
Patch Changes
1.0.0-rc.5
Patch Changes
- #4125
5f3b3b44d
Thanks @natemoo-re! - Fix HMR of style blocks in Astro files. Updating a style block should no longer perform a full reload of the page.
- #4141
65f2d3b4b
Thanks @FredKSchott! - fix windows "bad package export" error
1.0.0-rc.4
Patch Changes
- #4049
b60cc0538
Thanks @natemoo-re! - ImproveinjectScript
handling for non-Astro pages
- #4105
9cc3a11c4
Thanks @dimitrov-adrian! - Do not sendbody
withHEAD
orGET
requests when usingserver
output.
- #4114
64432bcb8
Thanks @Princesseuh! - Refactor@astrojs/mdx
and@astrojs/markdown-remark
to use@astrojs/prism
instead of duplicating the code
-
#4115
26cc0bbf7
Thanks @natemoo-re! - Fix edge case with hoisted scripts and Tailwind during dev -
Updated dependencies [
64432bcb8
]:- @astrojs/markdown-remark@0.14.0
1.0.0-rc.3
Patch Changes
- #4087
a0d1731a7
Thanks @tony-sull! - Fixes a couple routing bugs that could lead to routing differences indev
vs.build
when using multiple dynamic routes
1.0.0-rc.2
Patch Changes
- #4045
a397b981f
Thanks @tony-sull! - Adding support for custom "astro/client" type definitions in@astrojs/image
- #4028
c565465a9
Thanks @alfredogonzalezmartinez! - Addurl
andfile
properties toMarkdownContent
type
1.0.0-rc.1
The Astro v1.0.0 Release Candidate comes includes new features, tons of bug fixes, and a few breaking changes to be aware of.
Breaking Changes
- Astro now uses Vite 3, which comes with its own Migration Guide.
- Components and JSX expressions in
.md
files is no longer supported by default. It can be enabled by setting thelegacy.astroFlavoredMarkdown
flag totrue
.- We are deeply invested in
@astrojs/mdx
as a long-term replacement for using components in Markdown.
- We are deeply invested in
- Astro scoped styles now respect their authored specificity (see RFC0012). Please visually inspect your site after upgrading to confirm that styles are working as expected.
Astro.canonicalURL
has been replaced by the newAstro.url
helper.- The Markdown
headers
andgetHeaders()
utils have been renamed toheadings
andgetHeadings()
. - The deprecated
Markdown
component has been removed from core and is now available as@astrojs/markdown-component
.
New Features
astro dev
HMR has been overhauled to provide more stable live reload behaviorastro dev
error handling has been overhauled to provide a more seamless error handling experience- The new
output
configuration option builds to'static' | 'server'
targets .html
components and pages are now supported.mdx
components and pages are now supported via@astrojs/mdx
server
output now supports custom404
and500
pagesserver
output now exposesAstro.clientAddress
to get the current IP address per request
Patch Changes
- #3988
9841c21e8
Thanks @Princesseuh! - Fix certain characters showing incorrectly inastro check
- #4000
1c1b9da62
Thanks @tony-sull! - public assets should always take priority over page routes in SSR deployments
- #3944
e82ff13f1
Thanks @mihkeleidast! - Add export keyword to astro config file stub created by add cli command
- #3942
21462feb4
Thanks @AllanChain! - Use a base middleware for better base path handling in dev.
- #3991
4dd341c8a
Thanks @natemoo-re! - #3859 Overhaul Astro error handling, using Vite's built-in error overlay when possible
-
#4024
1215e731b
Thanks @natemoo-re! - BREAKING Implement RFC0012 to preserve authored specificity for Astro scoped styles.If you use a mix of global styles and Astro scoped styles, please visually inspect your site after upgrading to confirm that styles are working as expected.
If you previously relied on Astro's scoped styles to increase the specificity of your selectors, please update your selectors to use an additional class. For example, updating
div
todiv.my-class
will match the previous behavior.
- #4008
399d7e269
Thanks @bholmesdev! - Avoid parsing JSX, components, and Astro islands when using "plain" md mode. This bringsmarkdown.mode: 'md'
in-line with our docs description.
- #4047
453c026aa
Thanks @matthewp! - Perf: move getStaticPaths call during the build to during page generation
- #3974
54865612e
Thanks @Princesseuh! - Added missingmedia
attributes from the JSX definitions for themeta
element
- #3932
27ee8b97a
Thanks @natemoo-re! - Overhaul HMR handling for more stable live reload behavior
- #3995
b2b367c96
Thanks @bholmesdev! - Support YAML frontmatter in MDX files
- #3976
fbef6a7f7
Thanks @natemoo-re! - Fixdefine:vars
bugs with bothstyle
andscript
- #4032
beddf073b
Thanks @arimgibson! - Fix: find a hosting network differently based on Node version -- adjusted for Node v18.4+
- #3867
7250e4e86
Thanks @natemoo-re! - Add support for.html
components and pages
- #3959
ddefb172f
Thanks @FredKSchott! - Deprecate Astro.canonicalURL, in favor of Astro.url instead.
- #3968
95eaa207d
Thanks @bholmesdev! - Improve warning logs on astro.config change
- #3959
ddefb172f
Thanks @FredKSchott! - Add Astro.url helper for getting the request URL
-
#4031
6e27a5fdc
Thanks @natemoo-re! - BREAKING Renamed Markdown utility functiongetHeaders()
togetHeadings()
. -
Updated dependencies [
ba11b3399
,399d7e269
,00fab4ce1
,6e27a5fdc
]:- @astrojs/markdown-remark@0.13.0
1.0.0-beta.73
Patch Changes
- #3588
5d0edfc3b
Thanks @charlesvdv! - Fix missing props (url, file) in markdown layout
- #3958
8eba6d9d9
Thanks @Princesseuh! - Fix JSX definitions being too strict as to what an element is, which lead to type issues in certain cases (Markdown imports, JSX components etc)
- #3915
f5d4ebf0e
Thanks @natemoo-re! - Fix metadata handling for building MDX files
-
#3906
b37695c34
Thanks @Princesseuh! - Fixed many long-standing issues withastro check
- Fixed it not working on Windows at all
- Fixed red squiggles not showing in the proper place in certain contexts, notably with strings using non-latin characters
- Fixed IDE links pointing to the wrong line number and character
- Fixed line numbers being off by one
- Fixed IDE links not working when the project wasn't at the root of the folder
Additionally added some features:
- Added more pretty colors
- Fixed it not working at all on Windows
- Warnings and hints are now printed alongside errors
- Surrounding lines are now shown when relevant (aka not empty)
-
#3963
5fde2fd8b
Thanks @matthewp! - Makes the Debug component's styles be inlined -
Updated dependencies [
31f9c0bf0
,07fb544da
]:- @astrojs/prism@0.6.1
- @astrojs/telemetry@0.4.1
- @astrojs/markdown-remark@0.12.0
1.0.0-beta.72
Patch Changes
- #3922
7094d6a45
Thanks @natemoo-re! - Properly handlefalse
inclass:list
- #3927
7c5c4106d
Thanks @Princesseuh! - Updatedastro/components
exports to a.ts
file so it's automatically typed
1.0.0-beta.71
Patch Changes
-
#3918
6a7a17f73
Thanks @natemoo-re! - Update@astrojs/compiler
, fixing various edge cases around nested expressions, tables, and conditional slots. See the@astrojs/compiler@0.19.0 changelog
for more information. -
Updated dependencies [
01a55467d
]:- @astrojs/markdown-remark@0.11.7
1.0.0-beta.70
Patch Changes
- #3902
d8af02a94
Thanks @bholmesdev! - Fix: markdown "require is not defined" issue
-
#3914
b48767985
Thanks @ran-dall! - Rollback supportednode@16
version. Minimum versions are nownode@14.20.0
ornode@16.14.0
. -
Updated dependencies [
ca45c0c27
,b48767985
]:- @astrojs/markdown-remark@0.11.6
- @astrojs/prism@0.6.0
- @astrojs/telemetry@0.4.0
1.0.0-beta.69
Patch Changes
- #3880
402c4181d
Thanks @crutchcorn! - Fix rendering HTML comments inmode="md"
configuration
1.0.0-beta.68
Patch Changes
-
#3883
b4cb4a40d
Thanks @crutchcorn! - Added "mode" to Astro config file TypeScript definitions -
Updated dependencies [
c4f6fdf37
]:- @astrojs/telemetry@0.3.1
1.0.0-beta.67
Patch Changes
- #3669
93e1020b1
Thanks @natemoo-re! - Tooling: reintroduce smoke test across example projects
-
#3889
5f4ecbad1
Thanks @matthewp! - Allow defining Astro components in Vite plugins -
Updated dependencies [
93e1020b1
]:- @astrojs/markdown-remark@0.11.5
1.0.0-beta.66
Patch Changes
- #3871
1cc5b7890
Thanks @natemoo-re! - Update supportednode
versions. Minimum versions are nownode@14.20.0
ornode@16.16.0
.
-
#3892
7c49096e8
Thanks @natemoo-re! - Update@astrojs/compiler
to latest -
Updated dependencies [
1cc5b7890
]:- @astrojs/prism@0.5.0
- @astrojs/telemetry@0.3.0
- @astrojs/markdown-remark@0.11.4
1.0.0-beta.65
Patch Changes
- #3842
08fa0772
Thanks @bholmesdev! - Docs: add complete "adapter" configuration reference
- #3854
b012ee55
Thanks @bholmesdev! - [astro add] Support adapters and third party packages
- #3873
957fb505
Thanks @bholmesdev! - Fix hydration for SSR components that return null
- #3801
b84bd7db
Thanks @Princesseuh! - Update JSX definitions with element specific types and added some missing attributes
-
#3837
5afb8076
Thanks @natemoo-re! - Fix usage of slots inside expressions -
Updated dependencies [
eedb32c7
]:- @astrojs/telemetry@0.2.5
1.0.0-beta.64
Patch Changes
- #3841
820a26dd
Thanks @bholmesdev! - Fix: add default content type to endpoints with { body } shorthand
-
#3839
cd3f6348
Thanks @bholmesdev! - Fixclient:visible
directive in safari -
Updated dependencies [
e4b2dca1
]:- @astrojs/telemetry@0.2.4
1.0.0-beta.63
Patch Changes
- #3799
5fe52737
Thanks @natemoo-re! - Fix internal error for MDX integration
1.0.0-beta.62
Patch Changes
- #3788
f4943e0f
Thanks @tony-sull! - Adds support for the newastrojs/image
integration
1.0.0-beta.61
Patch Changes
- #3777
976e1f17
Thanks @tony-sull! - Adds an option to disable HTTP streaming in Astro's productionApp
server
1.0.0-beta.60
Patch Changes
- #3779
192c4bcf
Thanks @FredKSchott! - Fix an issue with throwAndExit not awaiting
- #3706
032ad1c0
Thanks @natemoo-re! - Internal changes needed to support@astrojs/mdx
-
#3768
913591d1
Thanks @FredKSchott! - Fix an issue with unfriendly config validation error output -
Updated dependencies [
8045c8ad
]:- @astrojs/telemetry@0.2.3
1.0.0-beta.59
Patch Changes
- #3767
1eab496e
Thanks @tony-sull! - Updates an error handler to expect updated@astrojs/lit
behavior
- #3763
54cd6b8d
Thanks @tony-sull! - Fixes howinjectRoute
parses route patterns on Windows
-
#3750
dd176ca5
Thanks @FredKSchott! - Add basic error reporting to astro telemetry -
Updated dependencies [
dd176ca5
]:- @astrojs/telemetry@0.2.2
1.0.0-beta.58
Patch Changes
- #3715
4d6d8644
Thanks @FredKSchott! - Update "astro add" output to remove confusing multi-select prompt.
- #3715
4d6d8644
Thanks @FredKSchott! - Update the help output to improve formatting
-
#3713
ebd7e7ad
Thanks @FredKSchott! - Update telemetry to support a more anonymized project id.anonymousProjectId
is now hashed based on anonymous git data instead of your git remote URL. -
Updated dependencies [
ebd7e7ad
]:- @astrojs/telemetry@0.2.0
1.0.0-beta.57
Patch Changes
1.0.0-beta.56
Patch Changes
1.0.0-beta.55
Patch Changes
-
#3696
3daaf510
Thanks @matthewp! - Support for streaming responsesAstro supports streaming in its templates. Any time Astro encounters an async boundary it will stream out HTML that occurs before it. For example:
In this arbtrary example Astro will streaming out the
<head>
section and everything else until it encounters<LoadTodos />
and then stop. LoadTodos, which is also an Astro component will stream its contents as well; stopping and waiting at any other asynchronous components.As part of this Astro also now supports async iterables within its templates. This means you can do this:
Which will stream out
<li>
s one at a time, waiting a second between each.
1.0.0-beta.54
Patch Changes
-
#3652
7373d61c
Thanks @natemoo-re! - Add renderer support for passing named slots to framework components.BREAKING: integrations using the
addRenderer()
API are now passed all named slots viaRecord<string, string>
rather thanstring
. Previously only the default slot was passed.
-
#3679
fa7ed3f3
Thanks @matthewp! - Moves head injection to happen during renderingThis change makes it so that head injection; to insert component stylesheets, hoisted scripts, for example, to happen during rendering than as a post-rendering step.
This is to enable streaming. This change will only be noticeable if you are rendering your
<head>
element inside of a framework component. If that is the case then the head items will be injected before the first non-head element in an Astro file instead.In the future we may offer a
<Astro.Head>
component as a way to control where these scripts/styles are inserted.
1.0.0-beta.53
Patch Changes
- #3685
3d554fdb
Thanks @bholmesdev! - Fix PostCSS config not applied to Svelte component by default
-
#3665
9a813268
Thanks @matthewp! - Allow TypeScript inside script tagsThis makes it so that you can use TypeScript inside of script tags like so:
<script> interface Person { name: string; } const person: Person = { name: 'Astro', }; console.log(person); </script>
Note that the the VSCode extension does not currently support this, however.
- #3633
921d9a27
Thanks @FredKSchott! - Fix a bug withastro add react
adding a too-complex semver to your package.json
1.0.0-beta.52
Patch Changes
- #3667
df02fad1
Thanks @bholmesdev! - Fix: add @nanostores/preact to ALWAYS_NOEXTERNAL list for easier onboarding
-
#3658
aeab8909
Thanks @matthewp! - Inlines small hoisted scriptsThis enables a perf improvement, whereby small hoisted scripts without dependencies are inlined into the HTML, rather than loaded externally. This uses
vite.build.assetInlineLimit
to determine if the script should be inlined.
1.0.0-beta.51
Patch Changes
- #3675
ef6282d5
Thanks @hippotastic! - Fiximport.meta.env
also without trailing dot
- #3673
ba5ad785
Thanks @hippotastic! - Fix react dependencies to improve test reliability
1.0.0-beta.50
Patch Changes
1.0.0-beta.49
Patch Changes
1.0.0-beta.48
Patch Changes
-
#3625
f5afaf24
Thanks @matthewp! - Significantly improved build performanceThis change reflects in a significantly improved build performance, especially on larger sites.
With this change Astro is not building everything by statically analyzing
.astro
files. This means it no longer needs to dynamically run your code in order to know what JavaScript needs to be built.With one particular large site we found it to build 32% faster.
- #3612
fca58cfd
Thanks @bholmesdev! - Fix: "vpath" import error when building for netlify edge
- #3650
d9f6dcf6
Thanks @natemoo-re! - Properly catch falsy components
- #3610
6ab749be
Thanks @hippotastic! - Add component hydration in Markdown E2E tests
-
#3620
05aa7244
Thanks @hippotastic! - Remove extra newlines around Markdown components -
Updated dependencies [
80c71c7c
,fca58cfd
,9c8a7c0b
,9c8a7c0b
,48e67fe0
,05aa7244
]:- @astrojs/markdown-remark@0.11.3
- @astrojs/telemetry@0.1.3
1.0.0-beta.47
Patch Changes
- #3599
0ffc350c
Thanks @arimgibson! - Fix: find a hosting network differently based on Node version
1.0.0-beta.46
Patch Changes
d1f3406d
- Add support for theinjectRoute
hook proposed in RFC0023. Feature documentation is available in #704
- #3397
48161b77
Thanks @happycollision! - MarkdownInstance: Persist frontmatter type into the return of.default()
1.0.0-beta.45
Patch Changes
-
#3590
d46f8fb1
Thanks @okikio! - Add support for optional integrationsBy making integration optional, Astro can now ignore null, undefined or other falsy "Integration" values instead of giving an internal error most devs can't and/or won't understand.
This also enables conditional integrations, e.g.
integration: [ // Only run `compress` integration when in production environments, etc... // Note that `import.meta.env` is not available inside the `astro.config.mjs` file! process.env.production ? compress() : null, ];
1.0.0-beta.44
Patch Changes
-
#3557
3ec41f28
Thanks @natemoo-re! - Improve the way YAML errors are surfaced -
Updated dependencies [
5c73f614
]:- @astrojs/markdown-remark@0.11.2
1.0.0-beta.43
Patch Changes
- #3552
3eb96a7a
Thanks @tony-sull! - Fix: Astro.site should default to localhost when not provided in a project's config
- #3540
78164033
Thanks @tony-sull! - Fix: showing a more helpful error message when an import in an Astro component could not be resolved
-
#3547
a83d5817
Thanks @bholmesdev! - Fix: show "unable to find network to expose" with local network log when using --host without suitable networks -
Updated dependencies [
76fb01cf
,c549f161
]:- @astrojs/markdown-remark@0.11.1
1.0.0-beta.42
Patch Changes
- #3492
a87ce441
Thanks @natemoo-re! - - Improvements to how Astro handles style updates in HMR- Fixes a Svelte-specific HMR bug that caused Svelte component styles to be lost once a .astro file was hot reloaded
1.0.0-beta.41
Patch Changes
-
#3521
85b90549
Thanks @bholmesdev! - Fix isSelfAccepting errors when hydrating JSX components -
Updated dependencies [
6c955ca6
,30578015
,939fe159
]:- @astrojs/markdown-remark@0.11.0
1.0.0-beta.40
Patch Changes
- #3507
cf2fb300
Thanks @natemoo-re! - Silence noisy build warnings aboutoptimizeDeps.include
- #3506
d41540cc
Thanks @natemoo-re! - Fix issue where generatedlink
tags would have an invalid closing tag
- #3503
207f58d1
Thanks @williamtetlow! - Aliasfrom 'astro'
imports to'@astro/types'
Update Deno and Netlify integrations to handle vite.resolves.alias as an array
1.0.0-beta.39
Patch Changes
- #3464
9c2ba137
Thanks @bholmesdev! - Add warning on startup whenvite.server.fs.strict
is disabled
- #3427
10b25890
Thanks @tony-sull! - Fixes HMR support for inline scripts in Astro components on Linux and OSX
- #3505
2b35650b
Thanks @bholmesdev! - Fix newline characters in SolidJS JSX attributes (ex: multiline CSS classes)
1.0.0-beta.38
Patch Changes
- #3486
119ecf8d
Thanks @hippotastic! - Fix components in markdown regressions
- #3462
d145b868
Thanks @bholmesdev! - Remove the rss() helper from getStaticPaths. Using rss() now prints an error pointing to the new @astrojs/rss documentation.
-
#3455
e9a77d86
Thanks @natemoo-re! - Implements improved hydration event system, meaning hydration for client:only and nested frameworks should be see significant stability improvements -
Updated dependencies [
119ecf8d
]:- @astrojs/markdown-remark@0.10.2
1.0.0-beta.37
Patch Changes
- #3471
75fa58f1
Thanks @hippotastic! - Fix using Vite env var names in Markdown
- #3477
429b65d6
Thanks @hippotastic! - Prevent*/
from breaking HTML comments in Markdown
1.0.0-beta.36
Minor Changes
- #3452
47d1a8d5
Thanks @bholmesdev! - Add content parsing helpers to imported markdown files. This exposes both the raw markdown content when using rawContent() and the parsed Astro syntax when using compiledContent()
1.0.0-beta.35
Patch Changes
-
#3439
ac3c60d4
Thanks @matthewp! - Fixes importing npm packages within CSSThis change fixes a longstanding bug where the string
VITE_ASSET
was left in CSS when trying to import CSS packages. The fix comes thanks to an upstream Vite feature that allows us to hand off most of the CSS bundling work to Vite.
1.0.0-beta.34
Patch Changes
-
#3444
51db2b9b
Thanks @bholmesdev! - Fix: markdown imports failing due to internal dependency issue -
Updated dependencies [
51db2b9b
]:- @astrojs/markdown-remark@0.10.1
1.0.0-beta.33
Patch Changes
- #3426
946630a1
Thanks @bholmesdev! - Logs: Add "ssr.noExternal" hint for CSS loaded from npm packages
- #3434
4e3b405e
Thanks @natemoo-re! - Respect user's configured vite logLevel during build
- #3384
296fff2c
Thanks @natemoo-re! - Fix long-standing bug where aclass
attribute inside of a spread prop will cause duplicateclass
attributes
- #3433
4ca60e93
Thanks @natemoo-re! - Fix build issue where hoisted scripts would be duplicated per page
- #3422
0209d627
Thanks @tony-sull! - Updates component hydration scripts to use absolute paths for script imports
-
#3410
cfae9760
Thanks @natemoo-re! - Significantally more stable behavior for "Markdown + Components" usage, which now handles component serialization much more similarly to MDX. Also supports switching between Components and Markdown without extra newlines, removes wrapping<p>
tags from standalone components, and improves JSX expression handling. -
Updated dependencies [
cfae9760
]:- @astrojs/markdown-remark@0.10.0
1.0.0-beta.32
Patch Changes
- #3407
63735084
Thanks @tony-sull! - Adds a check during build to make sure routing priority is always enforced in the final dist output
- #3398
fb5572be
Thanks @bholmesdev! - Fix component usage in imported markdown files
- #3408
b26d48d2
Thanks @natemoo-re! - Fix hydration when rendering<head>
elements inside of a component
- #3393
d372d29e
Thanks @tony-sull! - Fixes a bug in the canonical URL when using1
as a route parameter ingetStaticPaths()
-
#3417
4de53ecc
Thanks @bholmesdev! - Fix: support FormData object on fetch body -
Updated dependencies [
4de53ecc
]:- @astrojs/webapi@0.12.0
1.0.0-beta.31
Patch Changes
- #3385
d34859d7
Thanks @natemoo-re! - Exposefile
andurl
properties when fetching.astro
files withAstro.glob()
1.0.0-beta.30
Patch Changes
- #3401
0d3c673d
Thanks @tony-sull! - Adding support for config.build.format to the dev server
- #3399
1bf12260
Thanks @bholmesdev! - Update "building for SSR..." log for SSG users to say "building entrypoints for prerendering..."
- #3391
cf8015ea
Thanks @natemoo-re! - Fix #3309 default logger locale behavior.
1.0.0-beta.29
Patch Changes
- #3379
0259d765
Thanks @matthewp! - Fixes issue with loading md pages in project with a space in folder name
1.0.0-beta.28
Patch Changes
- #3350
e48aa2fd
Thanks @FredKSchott! - Improve error hints for packages that should be added tovite.ssr.noExternal
- #3348
43e411ee
Thanks @natemoo-re! - Update defaultvite.optimizeDeps.exclude
to keepnode-fetch
from being optimized
- #3331
e22f7364
Thanks @tony-sull! - Fixes an issue preventing custom 404 pages in dev
- #3339
3dc68e14
Thanks @thepassle! - fixes injectscript in ssr mode
- #3332
d04928e8
Thanks @FredKSchott! - Fix animport from '../core/build/types';
error
- #3300
b463ddb3
Thanks @tony-sull! - Resolve .astro components by module ID to support the use of Astro + framework components in an NPM package
- #3337
678c2b75
Thanks @bholmesdev! - Fix: remove hydration failures on React v18 by exposing the "client" directive from Astro core.
1.0.0-beta.27
Patch Changes
- #3178
19e1686b
Thanks @tony-sull! - Fixes an issue that was breaking asset and stylesheet URLs when building for a subpath
-
#3299
8021998b
Thanks @matthewp! - Update to telemetry to include AstroConfig keys used -
Updated dependencies [
8021998b
]:- @astrojs/telemetry@0.1.2
1.0.0-beta.26
Patch Changes
1.0.0-beta.25
Patch Changes
1.0.0-beta.24
Patch Changes
- #3286
e5f6de4e
Thanks @thepassle! - Adds pages param to the astro:build:setup integration hook
1.0.0-beta.23
Patch Changes
1032e450
Thanks @FredKSchott! - Introduce new @astrojs/rss package for RSS feed generation! This also adds a new global env variable for your project's configured "site": import.meta.env.SITE. This is consumed by the RSS feed helper to generate the correct canonical URL.
1032e450
Thanks @FredKSchott! - Internal: removedshorthash
1032e450
Thanks @FredKSchott! - Internal: replacesserialize-javascript
withdevalue
-
82345fdd
Thanks @FredKSchott! - Deprecate the markdown component in SSR.This was not working before, so now we make it official by throwing with a clean error message. See https://docs.astro.build/en/guides/markdown-content/#markdown-component to learn more.
1.0.0-beta.22
Patch Changes
-
#3262
adada1ba
Thanks @thepassle! - Adds astro:build:ssr integration hook -
Updated dependencies [
8f8f05c1
,6d5ef41b
]:- @astrojs/markdown-remark@0.9.4
- @astrojs/telemetry@0.1.1
1.0.0-beta.21
Patch Changes
-
#3234
de123b28
Thanks @JuanM04! - Moved some type fromastro
to@astrojs/markdown-remark
-
Updated dependencies [
de123b28
,f76038ac
,de123b28
]:- @astrojs/markdown-remark@0.9.3
- @astrojs/telemetry@0.1.0
1.0.0-beta.20
Patch Changes
- #3241
d25dc4c4
Thanks @tony-sull! - Fix a bug in define:vars preventing variables from being included in rendered styles
1.0.0-beta.19
Patch Changes
- #3221
f23d6c52
Thanks @bholmesdev! - Fix: bump Astro core to update available starter templates. Find new "Just the Basics" option in create-astro!
1.0.0-beta.18
Patch Changes
- #3183
7a61977d
Thanks @bholmesdev! - Support "astro add" before installing project dependencies
- #3209
fdd607c5
Thanks @Princesseuh! - Addis:raw
to AstroBuiltinAttributes
- #3187
75dab3ca
Thanks @bholmesdev! - Fix: remove online editor configs (stackblitz and code sandbox) from create-astro output
- #3205
e4bb2767
Thanks @Princesseuh! - Added Astro attributes to SVG elements in JSX definition
- #3186
2b702d6a
Thanks @bholmesdev! - Fix: astro add generating "astro.config.mjs" outside project root
1.0.0-beta.17
Patch Changes
- #3171
908fffb5
Thanks @natemoo-re! - Fix various edge cases in the compiler, upgrading to@astrojs/compiler@0.14.2
. Read the full changelog.
1.0.0-beta.16
Patch Changes
- #3156
637919c8
Thanks @tony-sull! - Adds subpath to assets/scripts when statically generating
1.0.0-beta.15
Patch Changes
- #3138
37a7a834
Thanks @natemoo-re! - General HMR Improvements, including new HMR support for framework components that are only server-side rendered (do not have aclient:*
directive)
1.0.0-beta.14
Patch Changes
- #3152
9ba1f4f8
Thanks @bholmesdev! - Fix JSX expression inconsistencies within markdown files
-
#3141
0247b542
Thanks @bholmesdev! - Astro internals: remove all legacy build logic from the codebase, now that the legacy build flag has been removed -
Updated dependencies [
9ba1f4f8
]:- @astrojs/markdown-remark@0.9.2
1.0.0-beta.13
Patch Changes
- #3130
394ab905
Thanks @tony-sull! - Updates<Code />
component to cache and reuse Shiki highlighters
- #3087
e0f838ca
Thanks @tony-sull! - Adds support for numeric route parameters in getStaticPaths()
- #3116
44bacd20
Thanks @bholmesdev! - Fix: Astro components used in dynamically imported markdown (ex. Astro.glob('*.md') will now retain their CSS styles in dev and production builds
- #3108
ef198ff8
Thanks @FredKSchott! - shiki: Adddiff
symbol handling to disableuser-select
on+
/-
symbols.
-
#3137
facf8016
Thanks @bholmesdev! - Fix: show correct stacktrace on dev server errors, instead of cryptic "package.json" error -
Updated dependencies [
ef198ff8
]:- @astrojs/markdown-remark@0.9.1
1.0.0-beta.12
Patch Changes
1.0.0-beta.11
Patch Changes
1.0.0-beta.10
Patch Changes
-
#3095
5acf77dd
Thanks @matthewp! - Fixes rendering of "undefined" on custom element children -
Updated dependencies [
5acf77dd
]:- @astrojs/webapi@0.11.1
1.0.0-beta.9
Minor Changes
- #3078
d33e1778
Thanks @FredKSchott! - Support the "del" API method, because "delete" is a reserved word.
- #3078
d33e1778
Thanks @FredKSchott! - Add support for an "all" API method, to handle all requests
Patch Changes
- #3094
564caf24
Thanks @bholmesdev! - Expose "metadata" to component integrations renderToStaticMarkup function
-
#3068
81e210e0
Thanks @FredKSchott! - Fix an issue around build not respecting your base config -
Updated dependencies [
53162534
]:- @astrojs/markdown-remark@0.9.0
1.0.0-beta.8
Patch Changes
- #3066
5b3464a8
Thanks @FredKSchott! - Fix bug with inconsistent url search params
-
#2970
b835e285
Thanks @JuanM04! - Improved markdown config type checking -
Updated dependencies [
b835e285
]:- @astrojs/markdown-remark@0.8.2
1.0.0-beta.7
Patch Changes
815d62f1
Thanks @FredKSchott! - no changes.
1.0.0-beta.6
Patch Changes
- #3004
9724d844
Thanks @tony-sull! - Fix bug causingastro preview
server to close immediately
1.0.0-beta.5
Patch Changes
-
#3020
c773dcde
Thanks @tony-sull! - Add support for advanced CSS imports with?raw
and?url
⚠️WARNING⚠️: Be careful when bypassing Astro's built-in CSS bundling! Styles won't be included in the built output - this is best used in combination with
set:html
to inline styles directly into the built HTML page.
1.0.0-beta.4
Patch Changes
- #3001
25cc9218
Thanks @natemoo-re! - Fix relative config handling with the--config
flag
- #3008
8bd49c95
Thanks @JuanM04! - Updated integrations'astro:build:done
hook: now it matches the client dist when using SSR
- #2958
d0777ad3
Thanks @aFuzzyBear! - Addastro docs
command which opens the Astro docs in your preferred browser.
1.0.0-beta.3
Patch Changes
- #3004
9724d844
Thanks @tony-sull! - Fix bug causingastro preview
server to close immediately
1.0.0-beta.2
Patch Changes
572ca3dc
Thanks @FredKSchott! - fix markdown issue with parsing components in setup
1.0.0-beta.1
Patch Changes
bc12edf0
Thanks @FredKSchott! - Add missing entry to "files" field in package.json
1.0.0-beta.0
Major Changes
- #2979
9d7a4b59
Thanks @FredKSchott! - Welcome to the Astro v1.0.0 Beta! Read the official announcement for more details.
0.26.1
Patch Changes
- #2978
3f0bc5af
Thanks @natemoo-re! - Fix edge case where default slots could be rendered too early for Astro components. Slots are now only rendered on demand.
- #2973
75919537
Thanks @tony-sull! - Updates the @docs default value listed for config.publicDir and config.outputDir
-
Updated dependencies [
ad3c3916
]:- @astrojs/markdown-remark@0.8.1
0.26.0
Minor Changes
-
e425f896
Thanks @FredKSchott! - Implement RFC #0017- New Markdown API
- New
Astro.glob()
API - BREAKING CHANGE: Removed
Astro.fetchContent()
(replaced byAstro.glob()
)
// v0.25 - let allPosts = Astro.fetchContent('./posts/*.md'); // v0.26+ + let allPosts = await Astro.glob('./posts/*.md');
e425f896
Thanks @FredKSchott! - Implement RFC0016 which changes the default behavior ofscript
, introducesis:inline
, and changes<style global>
to<style is:global>
e425f896
Thanks @FredKSchott! - Implements the Astro.request RFC
e425f896
Thanks @FredKSchott! - Update config options to resepect RFC0019
Patch Changes
e425f896
Thanks @FredKSchott! - Allow components to return a Response
e425f896
Thanks @FredKSchott! ---experimental-ssr
now is only required when using a 3rd-party adapter
-
e425f896
Thanks @FredKSchott! - ImproveAstro.slots
API to support passing arguments to function-based slots.This allows for more ergonomic utility components that accept a callback function as a child.
e425f896
Thanks @FredKSchott! - Fixes non-GET API routes in dev with Node 14
e425f896
Thanks @FredKSchott! - Update CLI error format and style
e425f896
Thanks @FredKSchott! - Update@astrojs/compiler
, fixing some bugs related to RegExp usage in frontmatter
e425f896
Thanks @FredKSchott! - Add a Deno adapter for SSR
-
e425f896
Thanks @FredKSchott! - Fix for copying public when using SSR and not client JS -
Updated dependencies [
e425f896
]:- @astrojs/markdown-remark@0.8.0
0.25.4
Patch Changes
0.25.3
Patch Changes
0.25.2
Patch Changes
- #2894
9d6e0b5d
Thanks @FredKSchott! - Add the "--experimental-integrations" flag to enable 3rd-party integrations.
- #2893
f2684512
Thanks @FredKSchott! - tailwind: add a default "contents" configuration that works for most Astro projects
0.25.1
Patch Changes
- #2891
a0d67b1d
Thanks @natemoo-re! - Add missingexeca
dependency
0.25.0
Minor Changes
-
#2849
72ef7ae6
Thanks @natemoo-re! - Introduce newastro add
command to automatically configure integrations.npx astro add
-
#2833
79545412
Thanks @natemoo-re! - This PR introduces a new internal CSS parser for@astrojs/compiler
. Seewithastro/compiler#329
for more details.This fixes Astro's support for modern CSS syntax like
@container
,@layer
, and nesting. Note While Astro now correctly parses this modern syntax, it does not automatically compile features for browser compatability purposes.
- #2824
0a3d3e51
Thanks @bholmesdev! - Change shiki to our default markdown syntax highlighter. This includes updates to all relevant starter projects that used Prism-specific styles.
Patch Changes
-
#2879
80034c6c
Thanks @matthewp! - Netlify AdapterThis change adds a Netlify adapter that uses Netlify Functions. You can use it like so:
import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify/functions'; export default defineConfig({ adapter: netlify(), });
- #2871
5029382a
Thanks @FredKSchott! - Fix a bug where tailwind integration wouldn't apply to markdown pages
- #2852
96372e6b
Thanks @bholmesdev! - Fix "isSelfAccepting" exception when using the new @astrojs/react integration in development
-
#2855
5e52814d
Thanks @matthewp! - Adds support for the Node adapter (SSR)This provides the first SSR adapter available using the
integrations
API. It is a Node.js adapter that can be used with thehttp
module or any framework that wraps it, like Express.In your astro.config.mjs use:
import nodejs from '@astrojs/node'; export default { adapter: nodejs(), };
After performing a build there will be a
dist/server/entry.mjs
module that works like a middleware function. You can use with any framework that supports the Noderequest
andresponse
objects. For example, with Express you can do:import express from 'express'; import { handler as ssrHandler } from '@astrojs/node'; const app = express(); app.use(handler); app.listen(8080);
- #2859
c781b12f
Thanks @natemoo-re! - Ensure private, internal APIs are not enumerable
- #2835
77ebab8b
Thanks @natemoo-re! - Fix missingpostcss-load-config
dependency
- #2878
2db97f10
Thanks @bholmesdev! - Move the built-inPrism
component fromastro/components
to@astrojs/prism/component
.
- #2857
1061d647
Thanks @bholmesdev! - Improve granularity of production build logs. This now lists:- the "data collection" build step, with timeout warnings for larger imports. This is useful for understanding large
import.meta.glob
calls. - the Vite client bundling step. This logs all Vite production build info to clarify what assets are built alongside your HTML.
- the route generation step, complete with all output HTML files for a given input file. This is especially useful when debugging
getStaticPaths
. - fixes "0 pages in Infinityms" log when building to SSR
- the "data collection" build step, with timeout warnings for larger imports. This is useful for understanding large
- #2825
1cd7184c
Thanks @hlynursmari1! - Fix island deduplication ignoring props.Re-resolves an issue initially patched in https://github.com/withastro/astro/pull/846 but seemingly lost in the 0.21.0 mega-merge (d84bfe719a
).This change makes the component render step account for all props, even if they don't affect the generated HTML, when deduplicating island mounts.
- #2815
7b9d042d
Thanks @matthewp! - Allows dynamic routes in SSR to avoid implementing getStaticPaths
- #2875
55712277
Thanks @FredKSchott! - Generalize output assets to avoid adblocker false positives
- #2848
981e2a83
Thanks @FredKSchott! - add missing injected "page" scripts into markdown pages
-
#2872
098f6f6b
Thanks @bholmesdev! - FixisSelfAccepting
errors when using the Preact integration with the Astro dev server -
Updated dependencies [
0a3d3e51
,2db97f10
,d763ec18
]:- @astrojs/markdown-remark@0.7.0
- @astrojs/prism@0.4.1
0.25.0-next.3
Patch Changes
- #2871
5029382a
Thanks @FredKSchott! - Fix a bug where tailwind integration wouldn't apply to markdown pages
-
#2855
5e52814d
Thanks @matthewp! - Adds support for the Node adapter (SSR)This provides the first SSR adapter available using the
integrations
API. It is a Node.js adapter that can be used with thehttp
module or any framework that wraps it, like Express.In your astro.config.mjs use:
import nodejs from '@astrojs/node'; export default { adapter: nodejs(), };
After performing a build there will be a
dist/server/entry.mjs
module that works like a middleware function. You can use with any framework that supports the Noderequest
andresponse
objects. For example, with Express you can do:import express from 'express'; import { handler as ssrHandler } from '@astrojs/node'; const app = express(); app.use(handler); app.listen(8080);
- #2859
c781b12f
Thanks @natemoo-re! - Ensure private, internal APIs are not enumerable
- #2878
2db97f10
Thanks @bholmesdev! - Move the built-inPrism
component fromastro/components
to@astrojs/prism/component
.
- #2857
1061d647
Thanks @bholmesdev! - Improve granularity of production build logs. This now lists:- the "data collection" build step, with timeout warnings for larger imports. This is useful for understanding large
import.meta.glob
calls. - the Vite client bundling step. This logs all Vite production build info to clarify what assets are built alongside your HTML.
- the route generation step, complete with all output HTML files for a given input file. This is especially useful when debugging
getStaticPaths
. - fixes "0 pages in Infinityms" log when building to SSR
- the "data collection" build step, with timeout warnings for larger imports. This is useful for understanding large
- #2875
55712277
Thanks @FredKSchott! - Generalize output assets to avoid adblocker false positives
-
#2872
098f6f6b
Thanks @bholmesdev! - FixisSelfAccepting
errors when using the Preact integration with the Astro dev server -
Updated dependencies [
2db97f10
,d763ec18
]:- @astrojs/prism@0.4.1-next.0
- @astrojs/markdown-remark@0.7.0-next.1
0.25.0-next.2
Patch Changes
- #2852
96372e6b
Thanks @bholmesdev! - Fix "isSelfAccepting" exception when using the new @astrojs/react integration in development
- #2848
981e2a83
Thanks @FredKSchott! - add missing injected "page" scripts into markdown pages
0.25.0-next.1
Patch Changes
- #2835
77ebab8b
Thanks @natemoo-re! - Fix missingpostcss-load-config
dependency
0.25.0-next.0
Minor Changes
-
#2833
79545412
Thanks @natemoo-re! - This PR introduces a new internal CSS parser for@astrojs/compiler
. Seewithastro/compiler#329
for more details.This fixes Astro's support for modern CSS syntax like
@container
,@layer
, and nesting. Note While Astro now correctly parses this modern syntax, it does not automatically compile features for browser compatability purposes.
- #2824
0a3d3e51
Thanks @bholmesdev! - Change shiki to our default markdown syntax highlighter. This includes updates to all relevant starter projects that used Prism-specific styles.
Patch Changes
- #2825
1cd7184c
Thanks @hlynursmari1! - Fix island deduplication ignoring props.Re-resolves an issue initially patched in https://github.com/withastro/astro/pull/846 but seemingly lost in the 0.21.0 mega-merge (d84bfe719a
).This change makes the component render step account for all props, even if they don't affect the generated HTML, when deduplicating island mounts.
-
#2815
7b9d042d
Thanks @matthewp! - Allows dynamic routes in SSR to avoid implementing getStaticPaths -
Updated dependencies [
0a3d3e51
]:- @astrojs/markdown-remark@0.7.0-next.0
0.24.3
Patch Changes
-
#2806
9e59ec92
Thanks @natemoo-re! - Fix a warning from Vite regarding internal sourcemaps -
Updated dependencies [
79282163
]:- @astrojs/renderer-svelte@0.5.2
0.24.2
Patch Changes
- #2801
11fb3745
Thanks @FredKSchott! - Fix: Handle CLI output in a cross-compat way
- #2793
6eb49479
Thanks @FredKSchott! - Fix HTML double-escaping issue
-
#2803
2b76ee8d
Thanks @natemoo-re! - Add anastro/config
entrypoint with adefineConfig
utility.Config files can now be easily benefit from Intellisense using the following approach:
import { defineConfig } from 'astro/config'; export default defineConfig({ renderers: [], });
- #2791
2d95541b
Thanks @bholmesdev! - Fix missing styles on initial dev server load (ex. Tailwind styles)
0.24.1
Patch Changes
- #2785
2c4fd919
Thanks @bholmesdev! - Update Astro.props to show object properties on console.log(Astro.props), interating over properties, and anything else outside direct key access
- #2790
6b34840d
Thanks @natemoo-re! - Improveset:html
behavior fornull
andundefined
values
- #2772
b4d34e2d
Thanks @FredKSchott! - Improve build performance, especially on large sites
- #2772
b4d34e2d
Thanks @FredKSchott! - Surface vite warnings to the user
0.24.0
Minor Changes
- #2760
77b9c953
Thanks @bholmesdev! - Introduce a new --host flag + host devOption to expose your server on a network IP
-
af075d81
Thanks @natemoo-re! - Visual redesign of theastro dev
CLI, including newastro --help
andastro --version
outputs.These changes introduce a new startup screen, make it more obvious when a file triggers in-place HMR (
update
) or a full reload (reload
), and improve the way Astro surfaces errors during dev.
-
#2705
72c2c86e
Thanks @natemoo-re! - New default build strategyThis change marks the "static build" as the new default build strategy. If you are unfamiliar with this build strategy check out the migration guide on how to change your code to be compatible with this new bulid strategy.
If you'd like to keep using the old build strategy, use the flag
--legacy-build
both in yourastro dev
andastro build
scripts, for ex:{ "scripts": { "build": "astro build --legacy-build" } }
Note that the legacy build is deprecated and will be removed in a future version. You should only use this flag until you have the time to migration your code.
-
#2705
72c2c86e
Thanks @natemoo-re! - ## Updated<head>
and<body>
behaviorSince
astro@0.21
, Astro placed certain restrictions on what files could use<head>
or<body>
tags. Inastro@0.24
, the restrictions have been lifted. Astro will be able to correctly handle<head>
and<body>
tags in any component, not just those insrc/pages/
orsrc/layouts/
.
- #2747
05b66bd6
Thanks @natemoo-re! - Escape HTML inside of expressions by default. Please see our migration guide for more details.
Patch Changes
-
#2695
ae8d9256
Thanks @natemoo-re! - UpdateAstro.slots
API with new publichas
andrender
methods.This is a backwards-compatible change—
Astro.slots.default
will still betrue
if the component has been passed adefault
slot.if (Astro.slots.has('default')) { const content = await Astro.slots.render('default'); }
-
#2755
10843aba
Thanks @natemoo-re! - Add user-configurablesitemapFilter
option.This option can be used to ensure certain pages are excluded from your final sitemap.
// astro.config.ts import type { AstroUserConfig } from 'astro'; const config: AstroUserConfig = { sitemap: true, sitemapFilter: (page: string) => !page.includes('secret-page'), }; export default config;
- #2767
2bb2c2f7
Thanks @natemoo-re! - Update@astrojs/compiler
to0.12.0
- #2705
72c2c86e
Thanks @natemoo-re! - Fixes the static build to write to 404.html
- #2705
72c2c86e
Thanks @natemoo-re! - Fixes use of private .env variables with the static build
- #2750
79fc3204
Thanks @FredKSchott! - update esbuild@0.14.25
- #2737
e8d4e568
Thanks @natemoo-re! - Astro's logger has been redesigned for an improved experience! In addition to deduping identical messages, we've surfaced more error details and exposed new events likeupdate
(for in-place HMR) andreload
(for full-reload HMR).
- #2733
6bf124fb
Thanks @FredKSchott! - Remove a bad dev warning
- #2758
499fb6a3
Thanks @natemoo-re! - Add CLI warnings when running a prerelease or outdated version of Astro
- #2705
72c2c86e
Thanks @natemoo-re! - Replacesend
dependency withsirv
- #2732
0ae96bb7
Thanks @bholmesdev! - Update server start message to use localhost for local hostnames
- #2743
a14075e2
Thanks @bholmesdev! - Fix - show 404 for bad static paths with console message, rather than a 500
0.24.0-next.2
Patch Changes
-
#2755
10843aba
Thanks @natemoo-re! - Add user-configurablesitemapFilter
option.This option can be used to ensure certain pages are excluded from your final sitemap.
// astro.config.ts import type { AstroUserConfig } from 'astro'; const config: AstroUserConfig = { sitemap: true, sitemapFilter: (page: string) => !page.includes('secret-page'), }; export default config;
- #2750
79fc3204
Thanks @FredKSchott! - update esbuild@0.14.25
- #2758
499fb6a3
Thanks @natemoo-re! - Add CLI warnings when running a prerelease or outdated version of Astro
- #2743
a14075e2
Thanks @bholmesdev! - Fix - show 404 for bad static paths with console message, rather than a 500
0.24.0-next.1
Minor Changes
-
af075d81
Thanks @natemoo-re! - Visual redesign of theastro dev
CLI, including newastro --help
andastro --version
outputs.These changes introduce a new startup screen, make it more obvious when a file triggers in-place HMR (
update
) or a full reload (reload
), and improve the way Astro surfaces errors during dev.
- #2747
05b66bd6
Thanks @natemoo-re! - Escape HTML inside of expressions by default. Please see our migration guide for more details.
Patch Changes
-
#2695
ae8d9256
Thanks @natemoo-re! - UpdateAstro.slots
API with new publichas
andrender
methods.This is a backwards-compatible change—
Astro.slots.default
will still betrue
if the component has been passed adefault
slot.if (Astro.slots.has('default')) { const content = await Astro.slots.render('default'); }
- #2705
72c2c86e
Thanks @natemoo-re! - Fixes the static build to write to 404.html
- #2737
e8d4e568
Thanks @natemoo-re! - Astro's logger has been redesigned for an improved experience! In addition to deduping identical messages, we've surfaced more error details and exposed new events likeupdate
(for in-place HMR) andreload
(for full-reload HMR).
- #2733
6bf124fb
Thanks @FredKSchott! - Remove a bad dev warning
- #2732
0ae96bb7
Thanks @bholmesdev! - Update server start message to use localhost for local hostnames
0.24.0-next.0
Minor Changes
-
#2705
8ce63ee6
Thanks @natemoo-re! - New default build strategyThis change marks the "static build" as the new default build strategy. If you are unfamiliar with this build strategy check out the migration guide on how to change your code to be compatible with this new bulid strategy.
If you'd like to keep using the old build strategy, use the flag
--legacy-build
both in yourastro dev
andastro build
scripts, for ex:{ "scripts": { "build": "astro build --legacy-build" } }
Note that the legacy build is deprecated and will be removed in a future version. You should only use this flag until you have the time to migration your code.
- Updated
<head>
and<body>
behavior
Since
astro@0.21
, Astro placed certain restrictions on what files could use<head>
or<body>
tags. Inastro@0.24
, the restrictions have been lifted. Astro will be able to correctly handle<head>
and<body>
tags in any component, not just those insrc/pages/
orsrc/layouts/
. - Updated
Patch Changes
- #2705
176d4082
Thanks @natemoo-re! - Fixes use of private .env variables with the static build
- #2705
a483c044
Thanks @natemoo-re! - Replacesend
dependency withsirv
0.23.7
Patch Changes
- Updated dependencies [
0d37f8e0
]:- @astrojs/renderer-svelte@0.5.1
0.23.6
Patch Changes
- Updated dependencies [
5f91e007
]:- @astrojs/renderer-svelte@0.5.0
0.23.5
Patch Changes
-
#2706
b2c37385
Thanks @JuanM04! - Changeddata-astro-raw
tois:raw
internally -
Updated dependencies [
b2c37385
]:- @astrojs/markdown-remark@0.6.4
0.23.4
Patch Changes
- #2697
91765d79
Thanks @FredKSchott! - Improve build performance by processingssrPreload
in serial rather than in parallel
-
#2684
c7bbb112
Thanks @natemoo-re! - Fix issue where HMR could be triggered duringastro build
-
Updated dependencies [
91765d79
]:- @astrojs/markdown-remark@0.6.3
0.23.3
Patch Changes
- #2681
046af364
Thanks @natemoo-re! - Fix HMR regression related to fine-grained.astro
HMR. This fixes HMR for Tailwind and CSS styles when.astro
files are edited.
0.23.2
Patch Changes
- #2665
0494f74e
Thanks @natemoo-re! - Improve compatability with third-party Astro packages
- #2656
fca64073
Thanks @FredKSchott! - fix astro scoping of "@import" inside of style tags
0.23.1
Patch Changes
ac6d2e8c
Thanks @FredKSchott! - Fix issue with Non-HTML pages in static build for dev
- #2653
17032cd0
Thanks @natemoo-re! - Update@astrojs/compiler
, fixing a bug with self-closing tags that need special consideration like<title />
and<script />
- #2654
a0fc5cb5
Thanks @FredKSchott! - Fix an issue where utf8 encoding was skipped in the dev server.
- #2649
5091d788
Thanks @natemoo-re! - Add fine-grained HMR support for Astro files
-
#2645
2e5c3b51
Thanks @xavikortes! - Fix issue when process.env.LANG was longer than 5 characters -
Updated dependencies [
9b7e2ab2
]:- @astrojs/markdown-remark@0.6.2
0.23.0
Minor Changes
-
#2489
618a16f5
Thanks @natemoo-re! - Add support for theset:html
andset:text
directives.With the introduction of these directives, unescaped HTML content in expressions is now deprecated. Please migrate to
set:html
in order to continue injecting unescaped HTML in future versions of Astro—you can use<Fragment set:html={content}>
to avoid a wrapper element.set:text
allows you to opt-in to escaping now, but it will soon become the default.
-
#2494
d7149f9b
Thanks @FredKSchott! - Refactor dev server to use vite server internally.This should be an invisible change, and no breaking changes are expected from this change. However, it is a big enough refactor that some unexpected changes may occur. If you've experienced a regression in the dev server, it is most likely a bug!
-
#2586
d6d35bca
Thanks @tony-sull! - Support for non-HTML pages⚠️ This feature is currently only supported with the
--experimental-static-build
CLI flag. This feature may be refined over the next few weeks/months as SSR support is finalized.This adds support for generating non-HTML pages form
.js
and.ts
pages during the build. Built file and extensions are based on the source file's name, ex:src/pages/data.json.ts
will be built todist/data.json
.Is this different from SSR? Yes! This feature allows JSON, XML, etc. files to be output at build time. Keep an eye out for full SSR support if you need to build similar files when requested, for example as a serverless function in your deployment host.
Examples
// src/pages/company.json.ts export async function get() { return { body: JSON.stringify({ name: 'Astro Technology Company', url: 'https://astro.build/', }), }; }
What about
getStaticPaths()
? It just works™.export async function getStaticPaths() { return [ { params: { slug: 'thing1' }}, { params: { slug: 'thing2' }} ] } export async function get(params) { const { slug } = params return { body: // ...JSON.stringify() } }
-
#2424
1abb9ed0
Thanks @natemoo-re! - Upgradevite
to2.8.x
, unvendoringvite
and bringing Astro's dependencies up-to-date.This is a low-level change that you shouldn't have to worry about too much, but it should fix many, many issues with CJS/ESM interoperability. It also allows Astro to stay up-to-date with the
vite
ecosystem. If you run into any unexpected problems, please let us know by opening an issue.
-
#2471
c9bb1147
Thanks @FredKSchott! - Standardize trailing subpath behavior in config.Most users are not aware of the subtle differences between
/foo
and/foo/
. Internally, we have to handle both which means that we are constantly worrying about the format of the URL, needing to add/remove trailing slashes when we go to work with this property, etc. This change transforms allsite
values to use a trailing slash internally, which should help reduce bugs for both users and maintainers.
-
#2548
ba5e2b5e
Thanks @matthewp! - Experimental SSR Support⚠️ If you are a user of Astro and see this PR and think that you can start deploying your app to a server and get SSR, slow down a second! This is only the initial flag and very basic support. Styles are not loading correctly at this point, for example. Like we did with the
--experimental-static-build
flag, this feature will be refined over the next few weeks/months and we'll let you know when its ready for community testing.Changes
-
This adds a new
--experimental-ssr
flag toastro build
which will result indist/server/
anddist/client/
directories. -
SSR can be used through this API:
import { createServer } from 'http'; import { loadApp } from 'astro/app/node'; const app = await loadApp(new URL('./dist/server/', import.meta.url)); createServer((req, res) => { const route = app.match(req); if (route) { let html = await app.render(req, route); } }).listen(8080);
-
This API will be refined over time.
-
This only works in Node.js at the moment.
-
Many features will likely not work correctly, but rendering HTML at least should.
-
Patch Changes
- #2424
1abb9ed0
Thanks @natemoo-re! - Fixes HMR of CSS that is imported from astro, when using the static build flag
- #2506
187d5128
Thanks @jonathantneal! - Fix an issue rendering content within HTMLElement
- #2599
929fae68
Thanks @natemoo-re! - Update@astrojs/compiler
tov0.11.0
, which moves from TinyGo to Go's built-in WASM output. This will be a significant improvement for stability and memory safety.
-
#2552
e81bc3cf
Thanks @matthewp! - Fixes build slowness on large appsThis fixes slowness on large apps, particularly during the static build. Fix is to prevent the Vite dev server plugin from being run during build, as it is not needed.
- #2588
10216176
Thanks @matthewp! - Fix for passing children to client component when the component does not render them
- #2531
ef1d81ef
Thanks @FredKSchott! - Fix issue where hostname was not passed to dev server
- #2537
b0666286
Thanks @FredKSchott! - Improve debug logs
- #2511
3d2c1849
Thanks @matthewp! - Bug fix fordefine:vars
with the --experimental-static-build flag
- #2518
2bc91543
Thanks @JuanM04! - Added the ability to use custom themes and langs with Shiki (<Code />
and@astrojs/markdown-remark
)
-
#2612
39cbe500
Thanks @natemoo-re! - Improve suppport forimport.meta.env
.Prior to this change, all variables defined in
.env
files had to include thePUBLIC_
prefix, meaning that they could potentially be visible to the client if referenced.Now, Astro includes any referenced variables defined in
.env
files onimport.meta.env
during server-side rendering, but only referencedPUBLIC_
variables on the client.
-
#2471
c9bb1147
Thanks @FredKSchott! - Respect subpath URL paths in the fetchContent url property.This fixes an issue where fetchContent() URL property did not include the buildOptions.site path in it.
-
#2538
16d532fe
Thanks @natemoo-re! - Fix rendering of HTML boolean attributes likeopen
andasync
.Fix rendering of HTML and SVG enumerated attributes like
contenteditable
andspellcheck
.
- #2581
ec6f148f
Thanks @matthewp! - Fix for resolving relative imports from hoisted scripts in the static build.
- #2593
40c0e2b3
Thanks @tony-sull! - Dynamic route params should ignore param order when matching paths
-
#2594
085468e9
Thanks @natemoo-re! - Upgrade@astrojs/compiler
tov0.10.2
-
Updated dependencies [
a907a73b
,cfeaa941
,2bc91543
,6fe1b027
,2bc91543
,d71c4620
]:- @astrojs/renderer-preact@0.5.0
- @astrojs/renderer-react@0.5.0
- @astrojs/renderer-svelte@0.4.0
- @astrojs/renderer-vue@0.4.0
- @astrojs/markdown-remark@0.6.1
0.23.0-next.10
Patch Changes
0.23.0-next.9
Patch Changes
- #2599
929fae68
Thanks @natemoo-re! - Update@astrojs/compiler
tov0.11.0
, which moves from TinyGo to Go's built-in WASM output. This will be a significant improvement for stability and memory safety.
0.23.0-next.8
Patch Changes
- #2588
10216176
Thanks @matthewp! - Fix for passing children to client component when the component does not render them
- #2593
40c0e2b3
Thanks @tony-sull! - Dynamic route params should ignore param order when matching paths
0.23.0-next.7
Patch Changes
-
#2586
d6d35bca
Thanks @tony-sull! - Support for non-HTML pages⚠️ This feature is currently only supported with the
--experimental-static-build
CLI flag. This feature may be refined over the next few weeks/months as SSR support is finalized.This adds support for generating non-HTML pages form
.js
and.ts
pages during the build. Built file and extensions are based on the source file's name, ex:src/pages/data.json.ts
will be built todist/data.json
.Is this different from SSR? Yes! This feature allows JSON, XML, etc. files to be output at build time. Keep an eye out for full SSR support if you need to build similar files when requested, for example as a serverless function in your deployment host.
Examples
// src/pages/company.json.ts export async function get() { return { body: JSON.stringify({ name: 'Astro Technology Company', url: 'https://astro.build/', }), }; }
What about
getStaticPaths()
? It just works™.export async function getStaticPaths() { return [ { params: { slug: 'thing1' }}, { params: { slug: 'thing2' }} ] } export async function get(params) { const { slug } = params return { body: // ...JSON.stringify() } }
-
#2548
ba5e2b5e
Thanks @matthewp! - Experimental SSR Support⚠️ If you are a user of Astro and see this PR and think that you can start deploying your app to a server and get SSR, slow down a second! This is only the initial flag and very basic support. Styles are not loading correctly at this point, for example. Like we did with the
--experimental-static-build
flag, this feature will be refined over the next few weeks/months and we'll let you know when its ready for community testing.Changes
-
This adds a new
--experimental-ssr
flag toastro build
which will result indist/server/
anddist/client/
directories. -
SSR can be used through this API:
import { createServer } from 'http'; import { loadApp } from 'astro/app/node'; const app = await loadApp(new URL('./dist/server/', import.meta.url)); createServer((req, res) => { const route = app.match(req); if (route) { let html = await app.render(req, route); } }).listen(8080);
-
This API will be refined over time.
-
This only works in Node.js at the moment.
-
Many features will likely not work correctly, but rendering HTML at least should.
-
- #2581
ec6f148f
Thanks @matthewp! - Fix for resolving relative imports from hoisted scripts in the static build.
- #2594
085468e9
Thanks @natemoo-re! - Upgrade@astrojs/compiler
tov0.10.2
0.23.0-next.6
Patch Changes
0.23.0-next.5
Patch Changes
-
#2569
82544e41
Thanks @matthewp! - Fixes pageUrlFormat: 'file' in the static build -
Updated dependencies [
d71c4620
]:- @astrojs/markdown-remark@0.6.1-next.2
0.23.0-next.4
Minor Changes
-
#2424
1abb9ed0
Thanks @natemoo-re! - Upgradevite
to2.8.x
, unvendoringvite
and bringing Astro's dependencies up-to-date.This is a low-level change that you shouldn't have to worry about too much, but it should fix many, many issues with CJS/ESM interoperability. It also allows Astro to stay up-to-date with the
vite
ecosystem. If you run into any unexpected problems, please let us know by opening an issue.
Patch Changes
-
#2424
1abb9ed0
Thanks @natemoo-re! - Fixes HMR of CSS that is imported from astro, when using the static build flag -
Updated dependencies [
a907a73b
]:- @astrojs/renderer-preact@0.5.0-next.0
- @astrojs/renderer-react@0.5.0-next.0
- @astrojs/renderer-svelte@0.4.0-next.0
- @astrojs/renderer-vue@0.4.0-next.0
0.23.0-next.3
Patch Changes
-
#2552
e81bc3cf
Thanks @matthewp! - Fixes build slowness on large appsThis fixes slowness on large apps, particularly during the static build. Fix is to prevent the Vite dev server plugin from being run during build, as it is not needed.
0.23.0-next.2
Patch Changes
- #2531
ef1d81ef
Thanks @FredKSchott! - Fix issue where hostname was not passed to dev server
- #2537
b0666286
Thanks @FredKSchott! - Improve debug logs
- #2518
2bc91543
Thanks @JuanM04! - Added the ability to use custom themes and langs with Shiki (<Code />
and@astrojs/markdown-remark
)
-
#2538
16d532fe
Thanks @natemoo-re! - Fix rendering of HTML boolean attributes likeopen
andasync
.Fix rendering of HTML and SVG enumerated attributes like
contenteditable
andspellcheck
. -
Updated dependencies [
cfeaa941
,2bc91543
,2bc91543
]:- @astrojs/markdown-remark@0.6.1-next.1
0.23.0-next.1
Patch Changes
0.23.0-next.0
Minor Changes
-
#2489
618a16f5
Thanks @natemoo-re! - Add support for theset:html
andset:text
directives.With the introduction of these directives, unescaped HTML content in expressions is now deprecated. Please migrate to
set:html
in order to continue injecting unescaped HTML in future versions of Astro—you can use<Fragment set:html={content}>
to avoid a wrapper element.set:text
allows you to opt-in to escaping now, but it will soon become the default.
-
#2494
d7149f9b
Thanks @FredKSchott! - Refactor dev server to use vite server internally.This should be an invisible change, and no breaking changes are expected from this change. However, it is a big enough refactor that some unexpected changes may occur. If you've experienced a regression in the dev server, it is most likely a bug!
-
#2471
c9bb1147
Thanks @FredKSchott! - Standardize trailing subpath behavior in config.Most users are not aware of the subtle differences between
/foo
and/foo/
. Internally, we have to handle both which means that we are constantly worrying about the format of the URL, needing to add/remove trailing slashes when we go to work with this property, etc. This change transforms allsite
values to use a trailing slash internally, which should help reduce bugs for both users and maintainers.
Patch Changes
- #2506
187d5128
Thanks @jonathantneal! - Fix an issue rendering content within HTMLElement
- #2511
3d2c1849
Thanks @matthewp! - Bug fix fordefine:vars
with the --experimental-static-build flag
-
#2471
c9bb1147
Thanks @FredKSchott! - Respect subpath URL paths in the fetchContent url property.This fixes an issue where fetchContent() URL property did not include the buildOptions.site path in it.
-
Updated dependencies [
6fe1b027
]:- @astrojs/markdown-remark@0.6.1-next.0
0.22.20
Patch Changes
- #2491
c7a6ed9a
Thanks @jonathantneal! - Fixed top-level await and other es features with the static build
- #2479
005751a9
Thanks @natemoo-re! - Add theescapeHTML
utility toastro/internal
- #2491
c7a6ed9a
Thanks @jonathantneal! - Renders server-side HTMLElement as HTML tag
0.22.19
Patch Changes
- #2440
462e3159
Thanks @matthewp! - Fixes HMR of CSS that is imported from astro, when using the static build flag
0.22.18
Patch Changes
- #2443
ed0b46f9
Thanks @natemoo-re! - Fix bug with RSS feed generation.rss()
can now be called multiple times and URLs can now be fully qualified.
0.22.17
Patch Changes
0.22.16
Patch Changes
0.22.15
Patch Changes
- #2371
85ad1aab
Thanks @natemoo-re! - Add support for styled RSS feeds using the newstylesheet
option
-
#2392
24aa3245
Thanks @obnoxiousnerd! - Support markdown draft pages. Markdown draft pages are markdown pages which havedraft
set in their frontmatter. By default, these will not be built by Astro while runningastro build
. To disable this behavior, you need to setbuildOptions.drafts
totrue
or pass the--drafts
flag while runningastro build
. An exaple of a markdown draft page is:--- # src/pages/blog-post.md title: My Blog Post draft: true --- This is my blog post which is currently incomplete.
0.22.14
Patch Changes
0.22.13
Patch Changes
- #2391
c8a257ad
Thanks @matthewp! - Improvements performance for building sites with thousands of pages with the static build
0.22.12
Patch Changes
-
#2373
92532b88
Thanks @matthewp! - Hydrated component fix with the static build -
Updated dependencies [
20eaddb2
]:- @astrojs/renderer-react@0.4.1
0.22.11
Patch Changes
0.22.10
Patch Changes
- #2335
f008a19c
Thanks @jonathantneal! - Preserve pathnames for sitemap.xml
- #2323
69af658b
Thanks @jonathantneal! - Fix issue with plugins running twice in dev and build
- #2338
c0cb7eea
Thanks @jonathantneal! - Fix preview issues triggered by pageUrlFormat & trailingSlash options
0.22.9
Patch Changes
0.22.8
Patch Changes
0.22.7
Patch Changes
- #2324
77ef43e6
Thanks @natemoo-re! - Update compiler to remove console.log (sorry everyone!)
e0de21ef
Thanks @FredKSchott! - Add<guid>
to RSS feed.
- #2318
c0204c0a
Thanks @natemoo-re! - Update@astrojs/compiler
to0.7.3
- #2319
e6379d51
Thanks @jonathantneal! - Updated @astropub/webapi
0.22.6
Patch Changes
- #2299
5fbdd56f
Thanks @tadeuzagallo! - Fix dynamic routes for sites with subpath
- #2308
e98659b7
Thanks @natemoo-re! - Update the Astro compiler, fixing a number of bugs
0.22.5
Patch Changes
-
#2305
193ca60f
Thanks @matthewp! - Fixesastro check
errors with import.meta usage -
Updated dependencies [
34486676
]:- @astrojs/renderer-svelte@0.3.1
0.22.4
Patch Changes
0.22.3
Patch Changes
- #2292
2e55dc26
Thanks @matthewp! - Rolls back a feature flag feature that was breaking the docs site
0.22.2
Patch Changes
0.22.1
Patch Changes
0.22.0
Minor Changes
- #2202
45cea6ae
Thanks @jonathantneal! - Officially drop support for Node v12. The minimum supported version is now Node v14.15+,
c5a7305f
Thanks @natemoo-re! - Replacefetch
detection via Vite plugin with a more resilientglobalThis
polyfill
Patch Changes
-
#2240
e07c1cbd
Thanks @FredKSchott! - Pin vite to v2.6, since that is the version that we have vendored. -
Updated dependencies [
45cea6ae
]:- @astrojs/prism@0.4.0
- @astrojs/renderer-preact@0.4.0
- @astrojs/renderer-react@0.4.0
- @astrojs/renderer-svelte@0.3.0
- @astrojs/renderer-vue@0.3.0
- @astrojs/markdown-remark@0.6.0
0.21.13
Patch Changes
- Updated dependencies [
b8c821a0
]:- @astrojs/renderer-svelte@0.2.3
0.21.12
Patch Changes
- #2115
0ef682c9
Thanks @FredKSchott! - Improve error message on bad JS/TS frontmatter
0.21.11
Patch Changes
- #2137
cc1dae55
Thanks @natemoo-re! - Exclude 404 pages from sitemap generation
- #2135
77c3fda3
Thanks @natemoo-re! - Patchfetch
support to prioritize authored code. Existingfetch
imports and declarations are respected.
0.21.10
Patch Changes
-
#2117
8346a1f2
Thanks @natemoo-re! - Fixes regression introduced in@astrojs/compiler
related to active formatting elementsSee CHANGELOG.
0.21.9
Patch Changes
-
#2107
4c444676
Thanks @matthewp! - Fixes regression in build caused by use of URL moduleUsing this module breaks the build because Vite tries to shim it, incorrectly.
0.21.8
Patch Changes
- #2096
11798a32
Thanks @jonathantneal! - Updates @astro/compiler and @astro/language-server.
0.21.7
Patch Changes
- #2078
ac3e8702
Thanks @natemoo-re! - Fix behavior of renderers when no children are passed in
- #2064
5bda895f
Thanks @jonathantneal! - Fixes an issue where void elements are rendered with opening and closing tags.
- #2076
920d3da1
Thanks @tony-sull! - Improving build validation and error messages for client hydration directives
-
#2075
b348ca6c
Thanks @drwpow! - Bugfix: allow dynamic importing of rehype plugins -
Updated dependencies [
ac3e8702
]:- @astrojs/renderer-preact@0.3.1
- @astrojs/renderer-react@0.3.1
- @astrojs/renderer-svelte@0.2.2
- @astrojs/renderer-vue@0.2.1
0.21.6
Patch Changes
- #2050
4e06767c
Thanks @natemoo-re! - Fixastro preview
port retry logic
0.21.5
Patch Changes
-
341ec3cd
: Fixes dev errors in hydrated componentsThe errors would occur when there was state changes in hydrated components. This only occurs in dev but does result in the hydrated component not working. This fixes the underlying issue.
-
4436592d
: Fix crash with unexpected file types in pages directory -
50f3b8d7
: Bugfix: improve style and script injection for partial pages -
fad6bd09
: Fixes use ofPUBLIC_
to reference env varsPreviously
PUBLIC_
worked in server-only components such as .astro components. However if you had a client-side component you had to useVITE_
. This was a bug with our build that is now fixed.
0.21.4
Patch Changes
76559faa
: Chore: update compiler
0.21.3
Patch Changes
8a5de030
: Fix client:visible with multiple copies of same component9ed6b3c0
: Update compiler with the following patches:- Fix components supporting only one style or script
- Fix regression where leading
<style>
elements could break generated tags - Fix case-sensitivity of void elements
- Fix expressions not working within SVG elements
- Fix panic when preprocessed style is empty
7a7427e4
: Fix CSS URLs on Windows- Updated dependencies [
4cec1256
]- @astrojs/renderer-svelte@0.2.1
0.21.2
Patch Changes
22dd6bf6
: Supportlang="postcss"
in addition tolang="pcss"
d3476f24
: Bump Sass dependency version679d4395
: AddedMarkdownParser
andMarkdownParserResponse
to@types
e4945232
: Fix a host of compiler bugs, including:- CSS scoping of
*
character inside ofcalc()
expressions - Encoding of double quotes inside of quoted attributes
- Expressions inside of
<table>
elements
- CSS scoping of
8cb77959
: Fixes building of non-hoisted scriptsfc5f4163
: Fix regression withastro build
404.astro output- Updated dependencies [
679d4395
]- @astrojs/markdown-remark@0.5.0
0.21.1
Patch Changes
8775730e
: Fix CSS scanning bug that could lead to infinite loopsaec4e8da
: Fix client:only behavior when only a single renderer is configured
0.21.0
Minor Changes
-
e6aaeff5
: Astro 0.21 is here! Read the complete migration guide.This new version of Astro includes:
- A new, faster, Go-based compiler
- A completely new runtime backed by Vite, with significantly dev experience improvements
- Improved support for loading Astro config files, including
.cjs
,.js
, and.ts
files - And many more features!
Patch Changes
- Updated dependencies [
e6aaeff5
] - Updated dependencies [
e6aaeff5
] - Updated dependencies [
e6aaeff5
]- @astrojs/renderer-preact@0.3.0
- @astrojs/renderer-react@0.3.0
- @astrojs/renderer-svelte@0.2.0
- @astrojs/renderer-vue@0.2.0
- @astrojs/markdown-remark@0.4.0
- @astrojs/prism@0.3.0
0.21.0-next.12
Patch Changes
0.21.0-next.11
Patch Changes
00d2b625
: Add Vite dependencies to astro- Updated dependencies [
00d2b625
]- @astrojs/markdown-remark@0.4.0-next.2
0.21.0-next.10
Patch Changes
c7682168
: Fix build by making vendored vite resolve to copy
0.21.0-next.9
Patch Changes
0.21.0-next.8
Patch Changes
c82ceff7
: Bug fix for Debug when passed JSON contain HTML strings53d9cf5e
: Fixes dev server not stopping cleanly8986d33b
: Improve error display- Updated dependencies [
8986d33b
]- @astrojs/renderer-vue@0.2.0-next.2
0.21.0-next.7
Patch Changes
dbc49ed6
: Fix HMR regression6b598b24
: Fix middleware order0ce86dfd
: Fixes Vue scoped styles when built
0.21.0-next.6
Patch Changes
dbc49ed6
: Fix HMR regression6b598b24
: Fix middleware order0ce86dfd
: Fixes Vue scoped styles when built
0.21.0-next.5
Patch Changes
0f9c1910
: Fixes routing regression in next.4. Subpath support was inadvertedly prevent any non-index routes from working when not using a subpath.
0.21.0-next.4
Patch Changes
-
b958088c
: Make astro-root be a display: contents element -
65d17857
: Fixes hoisted scripts to be bundled during the build -
3b8f201c
: Add build output -
824c1f20
: Re-implement client:only support -
3cd1458a
: Bugfix: Bundled CSS missing files on Windows -
4e55be90
: Fixes layout file detection on non-unix environments -
fca1a99d
: Provides first-class support for a site deployed to a subpathNow you can deploy your site to a subpath more easily. Astro will use your
buildOptions.site
URL and host the dev server from there.If your site config is
http://example.com/blog
you will need to go tohttp://localhost:3000/blog/
in dev and when usingastro preview
.Includes a helpful 404 page when encountering this in dev and preview.
-
65216ef9
: Bugfix: PostCSS not working in all contexts -
Updated dependencies [
3cd1458a
]- @astrojs/renderer-preact@0.3.0-next.1
- @astrojs/renderer-react@0.3.0-next.1
- @astrojs/renderer-svelte@0.2.0-next.1
- @astrojs/renderer-vue@0.2.0-next.1
0.21.0-next.3
Patch Changes
7eaabbb0
: Fix error with Markdown content attribute parsingfd52bcee
: Update the build to build/bundle assets7eaabbb0
: Fix bug with attribute serialization- Updated dependencies [
7eaabbb0
]- @astrojs/markdown-remark@0.4.0-next.1
0.21.0-next.2
Patch Changes
fbae2bc5
: Improve support for Astro config files.
In addition to properly loading .cjs
and .js
files in all cases, Astro now supports astro.config.ts
files.
For convenience, you may now also move your astro.config.js
file to a top-level config/
directory.
2e1bded7
: Improve Tailwind HMR indev
mode- Fix bug when using
<Markdown></Markdown>
with no content - Support
PUBLIC_
prefixed.env
variables - Respect
tsconfig.json
andjsconfig.json
paths as aliases
0.21.0-next.1
Patch Changes
-
11ee158a
: Fix issue withstyle
andscript
processing where siblings would be skippedFix
Fragment
and<>
handling for backwards compatabilityFix CSS
--custom-proprty
parsing when using scoped CSS
0.21.0-next.0
Minor Changes
-
d84bfe71
: Astro 0.21 Beta release! This introduces the new version of Astro that includes:- A new, faster, Go-based compiler
- A runtime backed by Vite, with faster dev experience
- New features
See more at https://astro.build/blog/astro-021-preview/
Patch Changes
- Updated dependencies [
d84bfe71
] - Updated dependencies [
d84bfe71
] - Updated dependencies [
d84bfe71
]- @astrojs/prism@0.3.0-next.0
- @astrojs/markdown-remark@0.4.0-next.0
- @astrojs/renderer-preact@0.3.0-next.0
- @astrojs/renderer-react@0.3.0-next.0
- @astrojs/renderer-svelte@0.2.0-next.0
- @astrojs/renderer-vue@0.2.0-next.0
0.20.12
Patch Changes
- Updated dependencies [
31d06880
]- @astrojs/renderer-vue@0.1.9
0.20.11
Patch Changes
6813106a
: Improve getStaticPaths memoization to successfully store values in the cache
0.20.10
Patch Changes
-
dbd2f507
: Adds theastro check
commandThis adds a new command,
astro check
which runs diagnostics on a project. The same diagnostics run within the Astro VSCode plugin! Just run:astro check
Which works a lot like
tsc
and will give you error messages, if any were found. We recommend adding this to your CI setup to prevent errors from being merged.
0.20.9
Patch Changes
- Updated dependencies [
756e3769
]- @astrojs/renderer-react@0.2.2
0.20.8
Patch Changes
30835635
: Fixed props shadowing
0.20.7
Patch Changes
0.20.6
Patch Changes
dd92871f
: During CSS bundling separate processing ofrel="preload"
from normal loading stylesheets, to preserve preloads, and source element attributes likemedia
.d771dad6
: Remove check for referenced files9cf2df81
: Improve stats logging to usepretty-bytes
so that 20B doesn't get output as 0kB, which is accurate, but confusing09b2f0e4
: Fix passing Markdown content through props (#1259)- Updated dependencies [
97d37f8f
]- @astrojs/renderer-preact@0.2.2
- @astrojs/renderer-react@0.2.1
- @astrojs/renderer-svelte@0.1.2
- @astrojs/renderer-vue@0.1.8
0.20.5
Patch Changes
b03f8771
: Add human readable config verification errorsb03f8771
: Sitemaps will not create entries for 404.html pagesb03f8771
: Fix parsing of an empty<pre></pre>
tag in markdown files, which expected the pre tag to have a childb03f8771
: Add new<Code>
component, powered by the more modern shiki syntax highlighter.b03f8771
: Fix astro bin bug in some pre-ESM versions of Node v14.x- Updated dependencies [
b03f8771
] - Updated dependencies [
b03f8771
]- @astrojs/markdown-support@0.3.1
0.20.4
Patch Changes
231964f0
: Adds interfaces for built-in components
0.20.3
Patch Changes
290f2032
: Fix knownEntrypoint warning for __astro_hoisted_scripts.js
0.20.2
Patch Changes
-
788c769d
: # Hoisted scriptsThis change adds support for hoisted scripts, allowing you to bundle scripts together for a page and hoist them to the top (in the head):
-
Updated dependencies [
5d2ea578
]- @astrojs/parser@0.20.2
0.20.1
Patch Changes
ff92be63
: Add a new "astro preview" command
0.20.0
Minor Changes
-
affcd04f
: [BREAKING CHANGE] stop bundling, building, and processing public files. This fixes an issue where we weren't actually honoring the "do not process" property of the public directory.If you were using the
public/
directory as expected and not using it to build files for you, then this should not be a breaking change. However, will notice that these files are no longer bundled.If you were using the
public/
directory to build files (for example, likepublic/index.scss
) then you can expect this to no longer work. As per the correct Astro documentation.
Patch Changes
- Updated dependencies [
397d8f3d
]- @astrojs/markdown-support@0.3.0
0.19.4
Patch Changes
44fb8ebc
: Remove non-null assertions, fix lint issues and enable lint in CI.9482fade
: Makes sure Astro.resolve works in nested component folders
0.19.3
Patch Changes
f9cd0310
: Fix TypeScript "types" reference in package.jsonf9cd0310
: Improve schema validation using zodefb41f22
: Add<Debug>
component for JavaScript-free client-side debugging.
0.19.2
Patch Changes
3e605d7e
: Add real-world check for ESM-CJS compatability to preflight check1e0e2f41
: Including Prism'slanguage-
class on code block<pre>
tags166c9ed6
: Fix an issue where getStaticPaths is called multiple times per buildc06da5dd
: Add configuration options for url format behavior: buildOptions.pageDirectoryUrl & trailingSlashc06da5dd
: Move 404.html output from /404/index.html to /404.html
0.19.1
Patch Changes
ece0953a
: Fix CSS :global() selector bug- Updated dependencies [
a421329f
]- @astrojs/markdown-support@0.2.4
0.19.0
Minor Changes
-
239065e2
: [BREAKING] Replace the Collections API with new file-based routing.This is a breaking change which impacts collections, pagination, and RSS support. Runtime warnings have been added to help you migrate old code to the new API. If you have trouble upgrading, reach out on https://astro.build/chat
This change was made due to confusion around our Collection API, which many users found difficult to use. The new file-based routing approach should feel more familiar to anyone who has used Next.js or SvelteKit.
Documentation added:
-
239065e2
: Adds support for Astro.resolveAstro.resolve()
helps with creating URLs relative to the current Astro file, allowing you to reference files within yoursrc/
folder.Astro does not resolve relative links within HTML, such as images:
<img src="../images/penguin.png" />
The above will be sent to the browser as-is and the browser will resolve it relative to the current page. If you want it to be resolved relative to the .astro file you are working in, use
Astro.resolve
. -
239065e2
: Adds support for client:only hydratorThe new
client:only
hydrator allows you to define a component that should be skipped during the build and only hydrated in the browser.In most cases it is best to render placeholder content during the build, but that may not always be feasible if an NPM dependency attempts to use browser APIs as soon as is imported.
Note If more than one renderer is included in your Astro config, you need to include a hint to determine which renderer to use. Renderers will be matched to the name provided in your Astro config, similar to
<MyComponent client:only="@astrojs/renderer-react" />
. Shorthand can be used for@astrojs
renderers, i.e.<MyComponent client:only="react" />
will use@astrojs/renderer-react
.An example usage:
--- import BarChart from '../components/BarChart.jsx'; --- <BarChart client:only /> /** * If multiple renderers are included in the Astro config, * this will ensure that the component is hydrated with * the Preact renderer. */ <BarChart client:only="preact" /> /** * If a custom renderer is required, use the same name * provided in the Astro config. */ <BarChart client:only="my-custom-renderer" />
This allows you to import a chart component dependent on d3.js while making sure that the component isn't rendered at all at build time.
Patch Changes
- @astrojs/parser@0.18.6
0.19.0-next.3
Minor Changes
-
1971ab3c
: Adds support for client:only hydratorThe new
client:only
hydrator allows you to define a component that should be skipped during the build and only hydrated in the browser.In most cases it is best to render placeholder content during the build, but that may not always be feasible if an NPM dependency attempts to use browser APIs as soon as is imported.
Note If more than one renderer is included in your Astro config, you need to include a hint to determine which renderer to use. Renderers will be matched to the name provided in your Astro config, similar to
<MyComponent client:only="@astrojs/renderer-react" />
. Shorthand can be used for@astrojs
renderers, i.e.<MyComponent client:only="react" />
will use@astrojs/renderer-react
.An example usage:
--- import BarChart from '../components/BarChart.jsx'; --- <BarChart client:only /> /** * If multiple renderers are included in the Astro config, * this will ensure that the component is hydrated with * the Preact renderer. */ <BarChart client:only="preact" /> /** * If a custom renderer is required, use the same name * provided in the Astro config. */ <BarChart client:only="my-custom-renderer" />
This allows you to import a chart component dependent on d3.js while making sure that the component isn't rendered at all at build time.
Patch Changes
-
1f13e403
: Fix CSS scoping issue -
78b5bde1
: Adds support for Astro.resolveAstro.resolve()
helps with creating URLs relative to the current Astro file, allowing you to reference files within yoursrc/
folder.Astro does not resolve relative links within HTML, such as images:
<img src="../images/penguin.png" />
The above will be sent to the browser as-is and the browser will resolve it relative to the current page. If you want it to be resolved relative to the .astro file you are working in, use
Astro.resolve
:
0.19.0-next.2
Patch Changes
089d1e7a
: update dependencies, and fix a bad .flat() call
0.19.0-next.1
Patch Changes
0.19.0-next.0
Minor Changes
-
0f0cc2b9
: [BREAKING] Replace the Collections API with new file-based routing.This is a breaking change which impacts collections, pagination, and RSS support. Runtime warnings have been added to help you migrate old code to the new API. If you have trouble upgrading, reach out on https://astro.build/chat
This change was made due to confusion around our Collection API, which many users found difficult to use. The new file-based routing approach should feel more familiar to anyone who has used Next.js or SvelteKit.
Documentation added:
0.18.10
Patch Changes
2321b577
: - Allow Markdown with scoped styles to coexist happily with code syntax highlighting via Prism618ea3a8
: Properly escapes script tags with nested client:load directives when passing Astro components into framework components via props. Browsers interpret script end tags in strings as script end tags, resulting in syntax errors.939b9d01
: Allow dev server port to be set byPORT
environment variable- Updated dependencies [
1339d5e3
]- @astrojs/renderer-vue@0.1.7
0.18.9
Patch Changes
8cf0e65a
: Fixes a previous revert, makes sure head content is injected into the right place8cf0e65a
: Refactor the CLI entrypoint to support stackblitz and improve the runtime check
0.18.8
Patch Changes
b1959f0f
: Reverts a change to head content that was breaking docs site
0.18.7
Patch Changes
268a36f3
: Fixes issue with head content being rendered in the wrong place39df7952
: Makesfetch
available in all framework components- Updated dependencies [
f7e86150
]- @astrojs/renderer-preact@0.2.1
0.18.6
Patch Changes
0.18.5
Patch Changes
a1491cc6
: Fix Vue components nesting- Updated dependencies [
cd2b5df4
] - Updated dependencies [
a1491cc6
]- @astrojs/parser@0.18.5
- @astrojs/renderer-vue@0.1.6
0.18.4
Patch Changes
- Updated dependencies [
460e625
]- @astrojs/markdown-support@0.2.3
0.18.3
Patch Changes
- Updated dependencies [
7015356
]- @astrojs/markdown-support@0.2.2
0.18.2
Patch Changes
829d5ba
: Fix TSX issue with JSX multi-rendering23b0d2d
: Adds support for image srcset to the build- Updated dependencies [
70f0a09
] - Updated dependencies [
fdb1c15
]- @astrojs/markdown-support@0.2.1
- @astrojs/renderer-vue@0.1.5
0.18.1
Patch Changes
d8cebb0
: Removes a warning in Svelte hydrated componentse90615f
: Fixes warnings for Astro internals for fetch-content and slots
0.18.0
Minor Changes
-
f67e8f5
: New Collections API (createCollection)BREAKING CHANGE: The expected return format from createCollection() has been changed. Visit https://docs.astro.build/core-concepts/collections to learn the new API.
This feature was implemented with backwards-compatible deprecation warnings, to help you find and update pages that are using the legacy API.
-
40c882a
: Fix url to find page with "index" at the end file name -
0340b0f
: Adds support for the client:media hydratorThe new
client:media
hydrator allows you to define a component that should only be loaded when a media query matches. An example usage:--- import Sidebar from '../components/Sidebar.jsx'; --- <Sidebar client:media="(max-width: 700px)" />
This allows you to define components which, for example, only run on mobile devices. A common example is a slide-in sidebar that is needed to add navigation to a mobile app, but is never displayed in desktop view.
Since Astro components can have expressions, you can move common media queries to a module for sharing. For example here are defining:
media.js
export const MOBILE = '(max-width: 700px)';
And then you can reference this in your page:
index.astro
import Sidebar from '../components/Sidebar.jsx'; import { MOBILE } from '../media.js'; ---(<Sidebar client:media={MOBILE} />);
Patch Changes
-
e89a99f
: This includes the props passed to a hydration component when generating the hash/id. This prevents multiple instances of the same component with differing props to be treated as the same component when hydrated by Astro. -
b8af49f
: Added sass support -
a7e6666
: compile javascript to target Node v12.x -
fb8bf7e
: Allow multiple Astro servers to be running simultaneously by choosing random ports if the defaults are taken. -
294a656
: Adds support for global style blocks via<style global>
Be careful with this escape hatch! This is best reserved for uses like importing styling libraries like Tailwind, or changing global CSS variables.
-
8f4562a
: Improve slot support, adding support for named slots and fallback content withinslot
elements.See the new Slots documentation for more information.
-
4a601ad
: Restores the ability to use Fragment in astro components -
0e761b9
: Add ability to specify hostname in devOptions -
164489f
: Fix forfalse
being rendered in conditionals -
e3182c7
: Adds a missing dependency -
af935c1
: Fix error when no renderers are passed -
4726e34
: Fixes cases where buildOptions.site is not respected -
c82e6be
: Fix unfound ./snowpack-plugin-jsx.cjs error -
007c220
: Remove custom Astro.fetchContent() glob implementation, useimport.meta.globEager
internally instead. -
9859f53
: Correcting typo in ReadMe -
b85e68a
: Fixes case where custom elements are not handled within JSX expressions -
Updated dependencies [
a7e6666
] -
Updated dependencies [
294a656
] -
Updated dependencies [
bd18e14
] -
Updated dependencies [
bd18e14
] -
Updated dependencies [
1f79144
] -
Updated dependencies [
b85e68a
]- @astrojs/parser@0.18.0
- @astrojs/renderer-preact@0.2.0
- @astrojs/renderer-react@0.2.0
- @astrojs/renderer-vue@0.1.4
0.18.0-next.7
Patch Changes
e89a99f
: This includes the props passed to a hydration component when generating the hash/id. This prevents multiple instances of the same component with differing props to be treated as the same component when hydrated by Astro.b8af49f
: Added sass support4726e34
: Fixes cases where buildOptions.site is not respected
0.18.0-next.6
Patch Changes
- Updated dependencies [
1f79144
]- @astrojs/renderer-vue@0.1.4-next.0
0.18.0-next.5
Patch Changes
-
294a656
: Adds support for global style blocks via<style global>
Be careful with this escape hatch! This is best reserved for uses like importing styling libraries like Tailwind, or changing global CSS variables.
-
164489f
: Fix forfalse
being rendered in conditionals -
af935c1
: Fix error when no renderers are passed -
Updated dependencies [
294a656
]- @astrojs/parser@0.18.0-next.5
0.18.0-next.4
Patch Changes
c82e6be
: Fix unfound ./snowpack-plugin-jsx.cjs error
0.18.0-next.3
Minor Changes
- Add support for the new JSX transform for React 17 and Preact.
- Add support for Solid when using the new
@astrojs/renderer-solid
package.
Patch Changes
4a601ad
: Restores the ability to use Fragment in astro components- Updated dependencies [
bd18e14
] - Updated dependencies [
bd18e14
]- @astrojs/renderer-preact@0.2.0-next.0
- @astrojs/renderer-react@0.2.0-next.0
0.18.0-next.2
Minor Changes
-
f67e8f5
: New Collections API (createCollection)BREAKING CHANGE: The expected return format from createCollection() has been changed. Visit https://docs.astro.build/core-concepts/collections to learn the new API.
This feature was implemented with backwards-compatible deprecation warnings, to help you find and update pages that are using the legacy API.
-
40c882a
: Fix url to find page with "index" at the end file name
Patch Changes
a7e6666
: compile javascript to target Node v12.xfb8bf7e
: Allow multiple Astro servers to be running simultaneously by choosing random ports if the defaults are taken.0e761b9
: Add ability to specify hostname in devOptions007c220
: Remove custom Astro.fetchContent() glob implementation, useimport.meta.globEager
internally instead.b85e68a
: Fixes case where custom elements are not handled within JSX expressions- Updated dependencies [
a7e6666
] - Updated dependencies [
b85e68a
]- @astrojs/parser@0.18.0-next.2
0.18.0-next.1
Patch Changes
e3182c7
: Adds a missing dependency
0.18.0-next.0
Minor Changes
-
0340b0f
: Adds support for the client:media hydratorThe new
client:media
hydrator allows you to define a component that should only be loaded when a media query matches. An example usage:--- import Sidebar from '../components/Sidebar.jsx'; --- <Sidebar client:media="(max-width: 700px)" />
This allows you to define components which, for example, only run on mobile devices. A common example is a slide-in sidebar that is needed to add navigation to a mobile app, but is never displayed in desktop view.
Since Astro components can have expressions, you can move common media queries to a module for sharing. For example here are defining:
media.js
export const MOBILE = '(max-width: 700px)';
And then you can reference this in your page:
index.astro
import Sidebar from '../components/Sidebar.jsx'; import { MOBILE } from '../media.js'; ---(<Sidebar client:media={MOBILE} />);
Patch Changes
-
8f4562a
: Improve slot support, adding support for named slots and fallback content withinslot
elements.See the new Slots documentation for more information.
-
9859f53
: Correcting typo in ReadMe
0.17.3
Patch Changes
- [release/0.17] Update compile target to better support Node v12.
0.17.2
Patch Changes
1b73f95
: Only show the buildOptions.site notice if not already setfb78b76
: Improve error handling for unsupported Node versionsd93f768
: Add support for components defined in Frontmatter.
0.17.1
Patch Changes
-
1e01251
: Fixes bug with React renderer that would not hydrate correctly -
42a6ace
: Add support for components defined in Frontmatter. -
Updated dependencies [
1e01251
]- @astrojs/renderer-react@0.1.5
0.17.0
Minor Changes
-
0a7b6de
: ## Adds directive syntax for component hydrationThis change updates the syntax for partial hydration from
<Button:load />
to<Button client:load />
.Why?
Partial hydration is about to get super powers! This clears the way for more dynamic partial hydration, i.e.
<MobileMenu client:media="(max-width: 40em)" />
.How to upgrade
Just update
:load
,:idle
, and:visible
to match theclient:load
format, thats it! Don't worry, the original syntax is still supported but it's recommended to future-proof your project by updating to the newer syntax.
0.16.3
Patch Changes
5d1ff62
: Hotfix for snowpack regression
0.16.2
Patch Changes
20b4a60
: Bugfix: do not override useralias
passed into snowpack config42a1fd7
: Add command line flag--silent
to astro to set no output.
0.16.1
Patch Changes
2d3e369
: Fix for using the snowpack polyfillNode option
0.16.0
Minor Changes
-
d396943
: Add support forremark
andrehype
plugins for both.md
pages and.astro
pages using the<Markdown>
component.For example, the
astro.config.mjs
could be updated to include the following. Read the Markdown documentation for more information.Note
Enabling custom
remarkPlugins
orrehypePlugins
removes Astro's built-in support for GitHub-flavored Markdown support, Footnotes syntax, Smartypants. You must explicitly add these plugins to yourastro.config.mjs
file, if desired.export default { markdownOptions: { remarkPlugins: ['remark-slug', ['remark-autolink-headings', { behavior: 'prepend' }]], rehypePlugins: ['rehype-slug', ['rehype-autolink-headings', { behavior: 'prepend' }]], }, };
Patch Changes
0.15.5
Patch Changes
-
7b4c97c
: Adds support forhydrationPolyfills
in renderersRenderers can not specify polyfills that must run before the component code runs for hydration:
export default { name: '@matthewp/my-renderer', server: './server.js', client: './client.js', hydrationPolyfills: ['./my-polyfill.js'], };
These will still wait for hydration to occur, but will run before the component script does.
0.15.4
Patch Changes
6a660f1
: Adds low-level custom element support that renderers can use to enable server side rendering. This will be used in renderers such as a Lit renderer.- Updated dependencies [
6a660f1
]- @astrojs/parser@0.15.4
0.15.3
Patch Changes
17579c2
: Improves the error message when attempting to usewindow
in a component.
0.15.2
Patch Changes
1e735bb
: Allows passing in a class to a child component which will be scopede28d5cb
: Improve error handling within.astro
files (#526)aa86057
: Updates collections to match URLs by exact template filenamef721275
: Fix issue where Markdown could close it's parent element early (#494)
0.15.1
Patch Changes
8865158
: Fixes postcss bug with the 'from' property
0.15.0
Minor Changes
-
a136c85
: This is a breaking change!Astro props are now accessed from the
Astro.props
global. This change is meant to make prop definitions more ergonomic, leaning into JavaScript patterns you already know (destructuring and defaults). Astro components previously used a prop syntax borrowed from Svelte, but it became clear that this was pretty confusing for most users.--- + const { text = 'Hello world!' } = Astro.props; - export let text = 'Hello world!'; --- <div>{text}</div>
Read more about the
.astro
syntax
How do I define what props my component accepts?
Astro frontmatter scripts are TypeScript! Because of this, we can leverage TypeScript types to define the shape of your props.
--- export interface Props { text?: string; } const { text = 'Hello world!' } = Astro.props as Props; ---
Note
Casting
Astro.props as Props
is a temporary workaround. We expect our Language Server to handle this automatically soon!How do I access props I haven't explicitly defined?
One of the great things about this change is that it's straight-forward to access any props. Just use
...props
!--- export interface Props { text?: string; [attr: string]: unknown; } const { text = 'Hello world!', ...props } = Astro.props as Props; ---
What about prop validation?
We considered building prop validation into Astro, but decided to leave that implementation up to you! This way, you can use any set of tools you like.
--- const { text = 'Hello world!' } = Astro.props; if (typeof text !== 'string') throw new Error(`Expected "text" to be of type "string" but recieved "${typeof string}"!`); ---
Patch Changes
4cd84c6
: #528 Removes unused trapWarn functionfeb9a31
: Fixes livereload on static pages47ac2cc
: Fix #521, allowing{...spread}
props to work again5629349
: Bugfix: PostCSS errors in internal Snowpack PostCSS plugin- Updated dependencies [
21dc28c
] - Updated dependencies [
47ac2cc
]- @astrojs/renderer-react@0.1.4
- @astrojs/parser@0.15.0
0.14.1
Patch Changes
3f3e4f1
: AllowpageSize: Infinity
when creating a collection44f429a
: Allow node: prefix to load builtins
0.14.0
Minor Changes
09b5779
: Removes mounting the project folder and adds asrc
root option
0.13.12
Rolling back to 0.13.10 to prevent a regression in the dev server output.
0.13.11
Patch Changes
6573bea
: Fixed README header aspect ratio2671b6f
: Fix 472 by not injectingastro-*
scoped class unless it is actually usedb547892
: Makes providing a head element on pages optionalb547892
: Allows astro documents to omit the head element0abd251
: Allows renderers to provide knownEntrypoint config values- Updated dependencies [
0abd251
]- @astrojs/renderer-preact@0.1.3
- @astrojs/renderer-react@0.1.3
- @astrojs/renderer-vue@0.1.3
0.13.10
Patch Changes
233fbcd
: Fix race condition caused by parallel build- Updated dependencies [
7f8d586
]- @astrojs/parser@0.13.10
0.13.9
Patch Changes
3ada25d
: Pass configured Tailwind config file to the tailwindcss pluginf9f2da4
: Add repository key to all package.json- Updated dependencies [
f9f2da4
]- @astrojs/parser@0.13.9
- @astrojs/prism@0.2.2
- @astrojs/markdown-support@0.1.2