diff options
author | 2024-08-15 02:48:37 -0700 | |
---|---|---|
committer | 2024-08-15 10:48:37 +0100 | |
commit | 40a1b3002cfd22d9de7179af00fe12ef5a28b707 (patch) | |
tree | 906ead7717faa235916705f07b7ccf8287669981 /packages | |
parent | f4057c18c91f969e3e508545fb988aff94c3ff08 (diff) | |
download | astro-78427727f3d09f164f0d715fc24960b4ee988bc9.tar.gz astro-78427727f3d09f164f0d715fc24960b4ee988bc9.tar.zst astro-78427727f3d09f164f0d715fc24960b4ee988bc9.zip |
[ci] release (#11699)create-astro@4.8.2astro@4.14.0@astrojs/web-vitals@2.0.0@astrojs/upgrade@0.3.2@astrojs/db@0.13.0
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'packages')
-rw-r--r-- | packages/astro/CHANGELOG.md | 222 | ||||
-rw-r--r-- | packages/astro/package.json | 2 | ||||
-rw-r--r-- | packages/create-astro/CHANGELOG.md | 6 | ||||
-rw-r--r-- | packages/create-astro/package.json | 2 | ||||
-rw-r--r-- | packages/db/CHANGELOG.md | 26 | ||||
-rw-r--r-- | packages/db/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/web-vitals/CHANGELOG.md | 7 | ||||
-rw-r--r-- | packages/integrations/web-vitals/package.json | 4 | ||||
-rw-r--r-- | packages/upgrade/CHANGELOG.md | 6 | ||||
-rw-r--r-- | packages/upgrade/package.json | 2 |
10 files changed, 273 insertions, 6 deletions
diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 9db8916b2..8f6e75407 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,227 @@ # astro +## 4.14.0 + +### Minor Changes + +- [#11657](https://github.com/withastro/astro/pull/11657) [`a23c69d`](https://github.com/withastro/astro/commit/a23c69d0d0bed229bee52a32e61f135f9ebf9122) Thanks [@bluwy](https://github.com/bluwy)! - Deprecates the option for route-generating files to export a dynamic value for `prerender`. 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](https://docs.astro.build/en/reference/integrations-reference/#astroroutesetup) 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](https://docs.astro.build/en/guides/server-side-rendering/#opting-in-to-pre-rendering-in-server-mode). + + To migrate from a dynamic export to the new hook, update or remove any dynamic `prerender` exports from individual routing files: + + ```diff + // 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's `prerender` option: + + ```js + // astro.config.mjs + import { defineConfig } from 'astro/config'; + import { loadEnv } from 'vite'; + + export default defineConfig({ + integrations: [setPrerender()], + }); + + function setPrerender() { + const { PRERENDER } = loadEnv(process.env.NODE_ENV, process.cwd(), ''); + + return { + name: 'set-prerender', + hooks: { + 'astro:route:setup': ({ route }) => { + if (route.component.endsWith('/blog/[slug].astro')) { + route.prerender = PRERENDER; + } + }, + }, + }; + } + ``` + +- [#11360](https://github.com/withastro/astro/pull/11360) [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7) Thanks [@ascorbic](https://github.com/ascorbic)! - Adds a new [`injectTypes()` utility](https://docs.astro.build/en/reference/integrations-reference/#injecttypes-options) to the Integration API and refactors how type generation works + + Use `injectTypes()` in the `astro: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. + + ```js + // my-integration/index.js + export default { + name: 'my-integration', + 'astro:config:done': ({ injectTypes }) => { + injectTypes({ + filename: 'types.d.ts', + content: "declare module 'virtual:my-integration' {}", + }); + }, + }; + ``` + + Codegen has been refactored. Although `src/env.d.ts` will continue to work as is, we recommend you update it: + + ```diff + - /// <reference types="astro/client" /> + + /// <reference path="../.astro/types.d.ts" /> + - /// <reference path="../.astro/env.d.ts" /> + - /// <reference path="../.astro/actions.d.ts" /> + ``` + +- [#11605](https://github.com/withastro/astro/pull/11605) [`d3d99fb`](https://github.com/withastro/astro/commit/d3d99fba269da9e812e748539a11dfed785ef8a4) Thanks [@jcayzac](https://github.com/jcayzac)! - Adds a new property `meta` to Astro's [built-in `<Code />` component](https://docs.astro.build/en/reference/api-reference/#code-). + + This allows you to provide a value for [Shiki's `meta` attribute](https://shiki.style/guide/transformers#meta) to pass options to transformers. + + The following example passes an option to highlight lines 1 and 3 to Shiki's `tranformerMetaHighlight`: + + ```astro + --- + // src/components/Card.astro + import { Code } from 'astro:components'; + import { transformerMetaHighlight } from '@shikijs/transformers'; + --- + + <Code code={code} lang="js" transformers={[transformerMetaHighlight()]} meta="{1,3}" /> + ``` + +- [#11360](https://github.com/withastro/astro/pull/11360) [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7) Thanks [@ascorbic](https://github.com/ascorbic)! - Adds support for Intellisense features (e.g. code completion, quick hints) for your content collection entries in compatible editors under the `experimental.contentIntellisense` flag. + + ```js + import { defineConfig } from 'astro'; + + export default defineConfig({ + experimental: { + contentIntellisense: true, + }, + }); + ``` + + 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 the `contentIntellisense: true` initialization parameter to the Astro language server for editors using it directly. + + See the [experimental content Intellisense docs](https://docs.astro.build/en/reference/configuration-reference/#experimentalcontentintellisense) for more information updates as this feature develops. + +- [#11360](https://github.com/withastro/astro/pull/11360) [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7) Thanks [@ascorbic](https://github.com/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: + + ```js + import { defineConfig } from 'astro'; + + export default defineConfig({ + experimental: { + contentLayer: true, + }, + }); + ``` + + 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()` and `file()` loaders to handle your local Markdown, MDX, Markdoc, and JSON files: + + ```ts {3,7} + // src/content/config.ts + import { defineCollection, z } from 'astro:content'; + import { glob } from 'astro/loaders'; + + const blog = defineCollection({ + // The ID is a slug generated from the path of the file relative to `base` + loader: glob({ pattern: '**/*.md', base: './src/data/blog' }), + schema: z.object({ + title: z.string(), + description: z.string(), + publishDate: z.coerce.date(), + }), + }); + + export const collections = { blog }; + ``` + + You can then query using the existing content collections functions, and enjoy a simplified `render()` function to display your content: + + ```astro + --- + import { getEntry, render } from 'astro:content'; + + const post = await getEntry('blog', Astro.params.slug); + + const { Content } = await render(entry); + --- + + <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: + + ```ts + // src/content/config.ts + const countries = defineCollection({ + loader: async () => { + const response = await fetch('https://restcountries.com/v3.1/all'); + const data = await response.json(); + // Must return an array of entries with an id property, + // or an object with IDs as keys and entries as values + return data.map((country) => ({ + id: country.cca3, + ...country, + })); + }, + // optionally add a schema to validate the data and make it type-safe for users + // schema: z.object... + }); + + export const collections = { countries }; + ``` + + 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](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md#loaders) 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](https://github.com/ascorbic/astro-loaders/). Here's how to load content using an RSS/Atom feed loader: + + ```ts + // src/content/config.ts + import { defineCollection } from 'astro:content'; + import { feedLoader } from '@ascorbic/feed-loader'; + + const podcasts = defineCollection({ + loader: feedLoader({ + url: 'https://feeds.99percentinvisible.org/99percentinvisible', + }), + }); + + export const collections = { podcasts }; + ``` + + ### Learn more + + To find out more about using the Content Layer API, check out [the Content Layer RFC](https://github.com/withastro/roadmap/blob/content-layer/proposals/0047-content-layer.md) and [share your feedback](https://github.com/withastro/roadmap/pull/982). + +### Patch Changes + +- [#11716](https://github.com/withastro/astro/pull/11716) [`f4057c1`](https://github.com/withastro/astro/commit/f4057c18c91f969e3e508545fb988aff94c3ff08) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes content types sync in dev + +- [#11645](https://github.com/withastro/astro/pull/11645) [`849e4c6`](https://github.com/withastro/astro/commit/849e4c6c23e61f7fa59f583419048b998bef2475) Thanks [@bluwy](https://github.com/bluwy)! - Refactors internally to use `node:util` `parseArgs` instead of `yargs-parser` + +- [#11712](https://github.com/withastro/astro/pull/11712) [`791d809`](https://github.com/withastro/astro/commit/791d809cbc22ed30dda1195ca026daa46a54b551) Thanks [@matthewp](https://github.com/matthewp)! - Fix mixed use of base + trailingSlash in Server Islands + +- [#11709](https://github.com/withastro/astro/pull/11709) [`3d8ae76`](https://github.com/withastro/astro/commit/3d8ae767fd4952af7332542b58fe98886eb2e99e) Thanks [@matthewp](https://github.com/matthewp)! - Fix adapter causing Netlify to break + ## 4.13.4 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 31591eb29..e8f53ee8f 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.13.4", + "version": "4.14.0", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/create-astro/CHANGELOG.md b/packages/create-astro/CHANGELOG.md index 5af50e312..600e9f8e6 100644 --- a/packages/create-astro/CHANGELOG.md +++ b/packages/create-astro/CHANGELOG.md @@ -1,5 +1,11 @@ # create-astro +## 4.8.2 + +### Patch Changes + +- [#11645](https://github.com/withastro/astro/pull/11645) [`849e4c6`](https://github.com/withastro/astro/commit/849e4c6c23e61f7fa59f583419048b998bef2475) Thanks [@bluwy](https://github.com/bluwy)! - Refactors internally to use `node:util` `parseArgs` instead of `arg` + ## 4.8.1 ### Patch Changes diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json index 4a2fc13ad..79cea9ce9 100644 --- a/packages/create-astro/package.json +++ b/packages/create-astro/package.json @@ -1,6 +1,6 @@ { "name": "create-astro", - "version": "4.8.1", + "version": "4.8.2", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/db/CHANGELOG.md b/packages/db/CHANGELOG.md index eb7978ead..046d3305b 100644 --- a/packages/db/CHANGELOG.md +++ b/packages/db/CHANGELOG.md @@ -1,5 +1,31 @@ # @astrojs/db +## 0.13.0 + +### Minor Changes + +- [#11360](https://github.com/withastro/astro/pull/11360) [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7) Thanks [@ascorbic](https://github.com/ascorbic)! - Changes how type generation works + + The generated `.d.ts` file is now at a new location: + + ```diff + - .astro/db-types.d.ts + + .astro/integrations/astro_db/db.d.ts + ``` + + The following line can now be removed from `src/env.d.ts`: + + ```diff + - /// <reference path="../.astro/db-types.d.ts" /> + ``` + +### Patch Changes + +- [#11645](https://github.com/withastro/astro/pull/11645) [`849e4c6`](https://github.com/withastro/astro/commit/849e4c6c23e61f7fa59f583419048b998bef2475) Thanks [@bluwy](https://github.com/bluwy)! - Refactors internally to use `node:util` `parseArgs` instead of `yargs-parser` + +- Updated dependencies []: + - @astrojs/studio@0.1.1 + ## 0.12.0 ### Minor Changes diff --git a/packages/db/package.json b/packages/db/package.json index 6dd5d5823..b92e47fe6 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/db", - "version": "0.12.0", + "version": "0.13.0", "description": "Add libSQL and Astro Studio support to your Astro site", "license": "MIT", "repository": { diff --git a/packages/integrations/web-vitals/CHANGELOG.md b/packages/integrations/web-vitals/CHANGELOG.md index 3d5628824..037e868a9 100644 --- a/packages/integrations/web-vitals/CHANGELOG.md +++ b/packages/integrations/web-vitals/CHANGELOG.md @@ -1,5 +1,12 @@ # @astrojs/web-vitals +## 2.0.0 + +### Patch Changes + +- Updated dependencies [[`849e4c6`](https://github.com/withastro/astro/commit/849e4c6c23e61f7fa59f583419048b998bef2475), [`a79a8b0`](https://github.com/withastro/astro/commit/a79a8b0230b06ed32ce1802f2a5f84a6cf92dbe7)]: + - @astrojs/db@0.13.0 + ## 1.0.0 ### Patch Changes diff --git a/packages/integrations/web-vitals/package.json b/packages/integrations/web-vitals/package.json index 7ae27f247..fcf42d536 100644 --- a/packages/integrations/web-vitals/package.json +++ b/packages/integrations/web-vitals/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/web-vitals", "description": "Track your website’s performance with Astro DB", - "version": "1.0.0", + "version": "2.0.0", "type": "module", "author": "withastro", "license": "MIT", @@ -35,7 +35,7 @@ "web-vitals": "^4.2.3" }, "peerDependencies": { - "@astrojs/db": "^0.12.0" + "@astrojs/db": "^0.13.0" }, "devDependencies": { "@astrojs/db": "workspace:*", diff --git a/packages/upgrade/CHANGELOG.md b/packages/upgrade/CHANGELOG.md index c4e7da9cf..b0c80a869 100644 --- a/packages/upgrade/CHANGELOG.md +++ b/packages/upgrade/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/upgrade +## 0.3.2 + +### Patch Changes + +- [#11645](https://github.com/withastro/astro/pull/11645) [`849e4c6`](https://github.com/withastro/astro/commit/849e4c6c23e61f7fa59f583419048b998bef2475) Thanks [@bluwy](https://github.com/bluwy)! - Refactors internally to use `node:util` `parseArgs` instead of `arg` + ## 0.3.1 ### Patch Changes diff --git a/packages/upgrade/package.json b/packages/upgrade/package.json index fe36ecd24..3f005e1f8 100644 --- a/packages/upgrade/package.json +++ b/packages/upgrade/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/upgrade", - "version": "0.3.1", + "version": "0.3.2", "type": "module", "author": "withastro", "license": "MIT", |