#2489 618a16f5
Thanks @natemoo-re! - Add support for the set:html
and set: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 to dist/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! - Upgrade vite
to 2.8.x
, unvendoring vite
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 all site
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 to astro build
which will result in dist/server/
and dist/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.
#2486 6bd165f8
Thanks @matthewp! - Fix for the static build when project contains a space
#2424 1abb9ed0
Thanks @natemoo-re! - Fixes HMR of CSS that is imported from astro, when using the static build flag
#2522 3e8844fa
Thanks @matthewp! - Fix for CSS superset support and HMR in the static build
#2506 187d5128
Thanks @jonathantneal! - Fix an issue rendering content within HTMLElement
#2606 96609d4c
Thanks @matthewp! - Fixes 404 to HMR script in the static build
#2599 929fae68
Thanks @natemoo-re! - Update @astrojs/compiler
to v0.11.0
, which moves from TinyGo to Go's built-in WASM output. This will be a significant improvement for stability and memory safety.
#2532 b210fd00
Thanks @matthewp! - Fixes HMR of .astro modules in astro@next
#2552 e81bc3cf
Thanks @matthewp! - Fixes build slowness on large apps
This 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.
#2605 87762410
Thanks @matthewp! - Fixes Astro style resolution in the static build
#2569 82544e41
Thanks @matthewp! - Fixes pageUrlFormat: 'file' in the static build
#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 for define: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 for import.meta.env
.
Prior to this change, all variables defined in .env
files had to include the PUBLIC_
prefix, meaning that they could potentially be visible to the client if referenced.
Now, Astro includes any referenced variables defined in .env
files on import.meta.env
during server-side rendering, but only referenced PUBLIC_
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 like open
and async
.
Fix rendering of HTML and SVG enumerated attributes like contenteditable
and spellcheck
.
#2570 34317bc0
Thanks @matthewp! - Fixes bug with astro/components not loading in the next release
#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
#2497 6fe1b027
Thanks @JuanM04! - Bumped Shiki version
#2594 085468e9
Thanks @natemoo-re! - Upgrade @astrojs/compiler
to v0.10.2
Updated dependencies [a907a73b
, cfeaa941
, 2bc91543
, 6fe1b027
, 2bc91543
, d71c4620
]: