Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
[email protected]
Minor Changes
#11657
a23c69d
Thanks @bluwy! - Deprecates the option for route-generating files to export a dynamic value forprerender
. Only static values are now supported (e.g.export const prerender = true
or= false
). This allows for better treeshaking and bundling configuration in the future.Adds a new
"astro:route:setup"
hook to the Integrations API to allow you to dynamically set options for a route at build or request time through an integration, such as enabling on-demand server rendering.To migrate from a dynamic export to the new hook, update or remove any dynamic
prerender
exports from individual routing files:// src/pages/blog/[slug].astro - export const prerender = import.meta.env.PRERENDER
Instead, create an integration with the
"astro:route:setup"
hook and update the route'sprerender
option:#11360
a79a8b0
Thanks @ascorbic! - Adds a newinjectTypes()
utility to the Integration API and refactors how type generation worksUse
injectTypes()
in theastro:config:done
hook to inject types into your user's project by adding a new a*.d.ts
file.The
filename
property will be used to generate a file at/.astro/integrations/<normalized_integration_name>/<normalized_filename>.d.ts
and must end with".d.ts"
.The
content
property will create the body of the file, and must be valid TypeScript.Additionally,
injectTypes()
returns a URL to the normalized path so you can overwrite its content later on, or manipulate it in any way you want.Codegen has been refactored. Although
src/env.d.ts
will continue to work as is, we recommend you update it:#11605
d3d99fb
Thanks @jcayzac! - Adds a new propertymeta
to Astro's built-in<Code />
component.This allows you to provide a value for Shiki's
meta
attribute to pass options to transformers.The following example passes an option to highlight lines 1 and 3 to Shiki's
tranformerMetaHighlight
:#11360
a79a8b0
Thanks @ascorbic! - Adds support for Intellisense features (e.g. code completion, quick hints) for your content collection entries in compatible editors under theexperimental.contentIntellisense
flag.When enabled, this feature will generate and add JSON schemas to the
.astro
directory in your project. These files can be used by the Astro language server to provide Intellisense inside content files (.md
,.mdx
,.mdoc
).Note that at this time, this also require enabling the
astro.content-intellisense
option in your editor, or passing thecontentIntellisense: true
initialization parameter to the Astro language server for editors using it directly.See the experimental content Intellisense docs for more information updates as this feature develops.
#11360
a79a8b0
Thanks @ascorbic! - Adds experimental support for the Content Layer API.The new Content Layer API builds upon content collections, taking them beyond local files in
src/content/
and allowing you to fetch content from anywhere, including remote APIs. These new collections work alongside your existing content collections, and you can migrate them to the new API at your own pace. There are significant improvements to performance with large collections of local files.Getting started
To try out the new Content Layer API, enable it in your Astro config:
You can then create collections in your
src/content/config.ts
using the Content Layer API.Loading your content
The core of the new Content Layer API is the loader, a function that fetches content from a source and caches it in a local data store. Astro 4.14 ships with built-in
glob()
andfile()
loaders to handle your local Markdown, MDX, Markdoc, and JSON files:You can then query using the existing content collections functions, and enjoy a simplified
render()
function to display your content:Creating a loader
You're not restricted to the built-in loaders – we hope you'll try building your own. You can fetch content from anywhere and return an array of entries:
For more advanced loading logic, you can define an object loader. This allows incremental updates and conditional loading, and gives full access to the data store. It also allows a loader to define its own schema, including generating it dynamically based on the source API. See the the Content Layer API RFC for more details.
Sharing your loaders
Loaders are better when they're shared. You can create a package that exports a loader and publish it to npm, and then anyone can use it on their site. We're excited to see what the community comes up with! To get started, take a look at some examples. Here's how to load content using an RSS/Atom feed loader:
Learn more
To find out more about using the Content Layer API, check out the Content Layer RFC and share your feedback.
Patch Changes
#11716
f4057c1
Thanks @florian-lefebvre! - Fixes content types sync in dev#11645
849e4c6
Thanks @bluwy! - Refactors internally to usenode:util
parseArgs
instead ofyargs-parser
#11712
791d809
Thanks @matthewp! - Fix mixed use of base + trailingSlash in Server Islands#11709
3d8ae76
Thanks @matthewp! - Fix adapter causing Netlify to break@astrojs/[email protected]
Minor Changes
#11360
a79a8b0
Thanks @ascorbic! - Changes how type generation worksThe generated
.d.ts
file is now at a new location:The following line can now be removed from
src/env.d.ts
:- /// <reference path="../.astro/db-types.d.ts" />
Patch Changes
#11645
849e4c6
Thanks @bluwy! - Refactors internally to usenode:util
parseArgs
instead ofyargs-parser
Updated dependencies []:
[email protected]
Patch Changes
849e4c6
Thanks @bluwy! - Refactors internally to usenode:util
parseArgs
instead ofarg
@astrojs/[email protected]
Patch Changes
849e4c6
,a79a8b0
]:@astrojs/[email protected]
Patch Changes
849e4c6
Thanks @bluwy! - Refactors internally to usenode:util
parseArgs
instead ofarg