astro@4.1.0
版本发布时间: 2024-01-04 23:18:14
withastro/astro最新发布版本:astro@5.0.0-beta.2(2024-09-24 17:12:05)
Minor Changes
-
#9513
e44f6acf99195a3f29b8390fd9b2c06410551b74
Thanks @wtto00! - Adds a'load'
prefetch strategy to prefetch links on page load -
#9377
fe719e27a84c09e46b515252690678c174a25759
Thanks @bluwy! - Adds "Missing ARIA roles check" and "Unsupported ARIA roles check" audit rules for the dev toolbar -
#9573
2a8b9c56b9c6918531c57ec38b89474571331aee
Thanks @bluwy! - Allows passing a string to--open
andserver.open
to open a specific URL on startup in development -
#9544
b8a6fa8917ff7babd35dafb3d3dcd9a58cee836d
Thanks @bluwy! - Adds a helpful error for static sites when you use theastro preview
command if you have not previously runastro build
. -
#9546
08402ad5846c73b6887e74ed4575fd71a3e3c73d
Thanks @bluwy! - Adds an option for the Sharp image service to allow large images to be processed. SetlimitInputPixels: false
to bypass the default image size limit:// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ image: { service: { entrypoint: 'astro/assets/services/sharp', config: { limitInputPixels: false, }, }, }, });
-
#9596
fbc26976533bbcf2de9d6dba1aa3ea3dc6ce0853
Thanks @Princesseuh! - Adds the ability to set arootMargin
setting when using theclient:visible
directive. This allows a component to be hydrated when it is near the viewport, rather than hydrated when it has entered the viewport.<!-- Load component when it's within 200px away from entering the viewport --> <Component client:visible={{ rootMargin: '200px' }} />
-
#9063
f33fe3190b482a42ebc68cc5275fd7f2c49102e6
Thanks @alex-sherwin! - Cookie encoding / decoding can now be customizedAdds new
encode
anddecode
functions to allow customizing how cookies are encoded and decoded. For example, you can bypass the default encoding viaencodeURIComponent
when adding a URL as part of a cookie:--- import { encodeCookieValue } from './cookies'; Astro.cookies.set('url', Astro.url.toString(), { // Override the default encoding so that URI components are not encoded encode: (value) => encodeCookieValue(value), }); ---
Later, you can decode the URL in the same way:
--- import { decodeCookieValue } from './cookies'; const url = Astro.cookies.get('url', { decode: (value) => decodeCookieValue(value), }); ---
Patch Changes
-
#9593
3b4e629ac8c2fdb4b491bf01abc7794e2e100173
Thanks @bluwy! - Improvesastro add
error reporting when the dependencies fail to install -
#9563
d48ab90fb41fbc0589cd2df711682a41382c03aa
Thanks @martrapp! - Fixes back navigation to fragment links (e.g.#about
) in Firefox when using view transitionsCo-authored-by: Florian Lefebvre 69633530+florian-lefebvre@users.noreply.github.com Co-authored-by: Sarah Rainsberger sarah@rainsberger.ca
-
#9597
9fd24a546c45d48451da46637c14e7ed54dac76a
Thanks @lilnasy! - Fixes an issue where configuring trailingSlash had no effect on API routes. -
#9586
82bad5d6205672ed3f6a49d4de53d3a68367433e
Thanks @martrapp! - Fixes page titles in the browser's drop-down for back / forward navigation when using view transitions -
#9575
ab6049bd58e4d02f47d500f9db08a865bc7f09b8
Thanks @bluwy! - Sets correctprocess.env.NODE_ENV
default when using the JS API -
#9587
da307e4a080483f8763f1919a05fa2194bb14e22
Thanks @jjenzz! - Adds aCSSProperties
interface that allows extending the style attribute -
#9513
e44f6acf99195a3f29b8390fd9b2c06410551b74
Thanks @wtto00! - Ignores3g
in slow connection detection. Only2g
andslow-2g
are considered slow connections.