diff options
author | 2024-08-29 04:50:49 -0700 | |
---|---|---|
committer | 2024-08-29 13:50:49 +0200 | |
commit | 17f71278f4bf9b749d9170023e82bd46cbb7edd5 (patch) | |
tree | e8e5c567d4662cac40e906a13819fddcb96efab8 | |
parent | 9da5b3dab2abfac8867957434574fbfed40f71f5 (diff) | |
download | astro-17f71278f4bf9b749d9170023e82bd46cbb7edd5.tar.gz astro-17f71278f4bf9b749d9170023e82bd46cbb7edd5.tar.zst astro-17f71278f4bf9b749d9170023e82bd46cbb7edd5.zip |
[ci] release (#11857)astro@4.15.0@astrojs/web-vitals@3.0.0@astrojs/db@0.14.0
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
49 files changed, 263 insertions, 278 deletions
diff --git a/.changeset/afraid-apricots-develop.md b/.changeset/afraid-apricots-develop.md deleted file mode 100644 index acf897149..000000000 --- a/.changeset/afraid-apricots-develop.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'astro': minor ---- - -Adds a new variant `sync` for the `astro:config:setup` hook's `command` property. This value is set when calling the command `astro sync`. - -If your integration previously relied on knowing how many variants existed for the `command` property, you must update your logic to account for this new option. diff --git a/.changeset/blue-pens-divide.md b/.changeset/blue-pens-divide.md deleted file mode 100644 index a295fe7b1..000000000 --- a/.changeset/blue-pens-divide.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -'astro': patch ---- - -Fixes a bug in the logic of `Astro.rewrite()` which led to the value for `base`, if configured, being automatically prepended to the rewrite URL passed. This was unintended behavior and has been corrected, and Astro now processes the URLs exactly as passed. - -If you use the `rewrite()` function on a project that has `base` configured, you must now prepend the base to your existing rewrite URL: - -```js -// astro.config.mjs -export default defineConfig({ - base: '/blog' -}) -``` - -```diff -// src/middleware.js -export function onRequest(ctx, next) { -- return ctx.rewrite("/about") -+ return ctx.rewrite("/blog/about") -} -``` diff --git a/.changeset/chilled-timers-shave.md b/.changeset/chilled-timers-shave.md deleted file mode 100644 index 1866eab85..000000000 --- a/.changeset/chilled-timers-shave.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -'astro': patch ---- - -**BREAKING CHANGE to experimental content layer loaders only!** - -Passes `AstroConfig` instead of `AstroSettings` object to content layer loaders. - -This will not affect you unless you have created a loader that uses the `settings` object. If you have, you will need to update your loader to use the `config` object instead. - -```diff -export default function myLoader() { - return { - name: 'my-loader' -- async load({ settings }) { -- const base = settings.config.base; -+ async load({ config }) { -+ const base = config.base; - // ... - } - } -} - -``` - -Other properties of the settings object are private internals, and should not be accessed directly. If you think you need access to other properties, please open an issue to discuss your use case. diff --git a/.changeset/clever-emus-roll.md b/.changeset/clever-emus-roll.md deleted file mode 100644 index 5b9b2ee69..000000000 --- a/.changeset/clever-emus-roll.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -'astro': minor ---- - -Adds a new, optional property `timeout` for the `client:idle` directive. - -This value allows you to specify a maximum time to wait, in milliseconds, before hydrating a UI framework component, even if the page is not yet done with its initial load. This means you can delay hydration for lower-priority UI elements with more control to ensure your element is interactive within a specified time frame. - -```astro -<ShowHideButton client:idle={{timeout: 500}} /> -``` diff --git a/.changeset/eight-balloons-cover.md b/.changeset/eight-balloons-cover.md deleted file mode 100644 index ea6364668..000000000 --- a/.changeset/eight-balloons-cover.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Uses `magicast` to update the config for `astro add` diff --git a/.changeset/four-beans-remember.md b/.changeset/four-beans-remember.md deleted file mode 100644 index cdef7197d..000000000 --- a/.changeset/four-beans-remember.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Replaces `execa` with `tinyexec` internally diff --git a/.changeset/healthy-boxes-poke.md b/.changeset/healthy-boxes-poke.md deleted file mode 100644 index d4c1e4302..000000000 --- a/.changeset/healthy-boxes-poke.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -'@astrojs/db': minor ---- - -Adds support for connecting Astro DB to any remote LibSQL server. This allows Astro DB to be used with self-hosting and air-gapped deployments. - -To connect Astro DB to a remote LibSQL server instead of Studio, set the following environment variables: - -- `ASTRO_DB_REMOTE_URL`: the connection URL to your LibSQL server -- `ASTRO_DB_APP_TOKEN`: the auth token to your LibSQL server - -Details of the LibSQL connection can be configured using the connection URL. For example, `memory:?syncUrl=libsql%3A%2F%2Fdb-server.example.com` would create an in-memory embedded replica for the LibSQL DB on `libsql://db-server.example.com`. - -For more details, please visit [the Astro DB documentation](https://docs.astro.build/en/guides/astro-db/#libsql) diff --git a/.changeset/lazy-feet-join.md b/.changeset/lazy-feet-join.md deleted file mode 100644 index e2b0a4077..000000000 --- a/.changeset/lazy-feet-join.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -'astro': minor ---- - -Adds a new option `fallbackType` to `i18n.routing` configuration that allows you to control how fallback pages are handled. - -When `i18n.fallback` is configured, this new routing option controls whether to [redirect](https://docs.astro.build/en/guides/routing/#redirects) to the fallback page, or to [rewrite](https://docs.astro.build/en/guides/routing/#rewrites) the fallback page's content in place. - -The `"redirect"` option is the default value and matches the current behavior of the existing fallback system. - -The option `"rewrite"` uses the new [rewriting system](https://docs.astro.build/en/guides/routing/#rewrites) to create fallback pages that render content on the original, requested URL without a browser refresh. - -For example, the following configuration will generate a page `/fr/index.html` that will contain the same HTML rendered by the page `/en/index.html` when `src/pages/fr/index.astro` does not exist. - -```js -// astro.config.mjs -export default defineConfig({ - i18n: { - locals: ["en", "fr"], - defaultLocale: "en", - routing: { - prefixDefaultLocale: true, - fallbackType: "rewrite" - }, - fallback: { - fr: "en" - }, - } -}) -``` - - diff --git a/.changeset/new-monkeys-sit.md b/.changeset/new-monkeys-sit.md deleted file mode 100644 index d71ab0b55..000000000 --- a/.changeset/new-monkeys-sit.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -'astro': minor ---- - -Adds a new object `swapFunctions` to expose the necessary utility functions on `astro:transitions/client` that allow you to build custom swap functions to be used with view transitions. - -The example below uses these functions to replace Astro's built-in default `swap` function with one that only swaps the `<main>` part of the page: - -```html -<script> -import { swapFunctions } from 'astro:transitions/client'; - -document.addEventListener('astro:before-swap', (e) => { e.swap = () => swapMainOnly(e.newDocument) }); - -function swapMainOnly(doc: Document) { - swapFunctions.deselectScripts(doc); - swapFunctions.swapRootAttributes(doc); - swapFunctions.swapHeadElements(doc); - const restoreFocusFunction = swapFunctions.saveFocus(); - const newMain = doc.querySelector('main'); - const oldMain = document.querySelector('main'); - if (newMain && oldMain) { - swapFunctions.swapBodyElement(newMain, oldMain); - } else { - swapFunctions.swapBodyElement(doc.body, document.body); - } - restoreFocusFunction(); -}; -</script> -``` - -See the [view transitions guide](https://docs.astro.build/en/guides/view-transitions/#astrobefore-swap) for more information about hooking into the `astro:before-swap` lifecycle event and adding a custom swap implementation. diff --git a/.changeset/perfect-wasps-grow.md b/.changeset/perfect-wasps-grow.md deleted file mode 100644 index 855c70983..000000000 --- a/.changeset/perfect-wasps-grow.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -'astro': minor ---- - -Exposes `z` from the new `astro:schema` module. This is the new recommended import source for all Zod utilities when using Astro Actions. - -## Migration for Astro Actions users - -`z` will no longer be exposed from `astro:actions`. To use `z` in your actions, import it from `astro:schema` instead: - -```diff -import { - defineAction, -- z, -} from 'astro:actions'; -+ import { z } from 'astro:schema'; -``` diff --git a/.changeset/rich-kings-wait.md b/.changeset/rich-kings-wait.md deleted file mode 100644 index 7f5aa677f..000000000 --- a/.changeset/rich-kings-wait.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Correctly resolves content layer images when filePath is not set diff --git a/.changeset/spicy-suits-explode.md b/.changeset/spicy-suits-explode.md deleted file mode 100644 index 1e43ca4a2..000000000 --- a/.changeset/spicy-suits-explode.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -"astro": minor ---- - -The Astro Actions API introduced behind a flag in [v4.8.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#480) is no longer experimental and is available for general use. - -Astro Actions allow you to define and call backend functions with type-safety, performing data fetching, JSON parsing, and input validation for you. - -Actions can be called from client-side components and HTML forms. This gives you to flexibility to build apps using any technology: React, Svelte, HTMX, or just plain Astro components. This example calls a newsletter action and renders the result using an Astro component: - -```astro ---- -// src/pages/newsletter.astro -import { actions } from 'astro:actions'; -const result = Astro.getActionResult(actions.newsletter); ---- -{result && !result.error && <p>Thanks for signing up!</p>} -<form method="POST" action={actions.newsletter}> - <input type="email" name="email" /> - <button>Sign up</button> -</form> -``` - -If you were previously using this feature, please remove the experimental flag from your Astro config: - -```diff -import { defineConfig } from 'astro' - -export default defineConfig({ -- experimental: { -- actions: true, -- } -}) -``` - -If you have been waiting for stabilization before using Actions, you can now do so. - -For more information and usage examples, see our [brand new Actions guide](https://docs.astro.build/en/guides/actions). diff --git a/examples/basics/package.json b/examples/basics/package.json index 91c830f61..62d441121 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 195d814f1..92c6fe574 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^3.1.5", "@astrojs/rss": "^4.0.7", "@astrojs/sitemap": "^3.1.6", - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/component/package.json b/examples/component/package.json index 7363dc96b..e32084872 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index ba9f3ab48..85b3c8ce8 100644 --- a/examples/container-with-vitest/package.json +++ b/examples/container-with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest run" }, "dependencies": { - "astro": "^4.14.6", + "astro": "^4.15.0", "@astrojs/react": "^3.6.2", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index f1987880f..b27c9984f 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -14,6 +14,6 @@ "@astrojs/alpinejs": "^0.4.0", "@types/alpinejs": "^3.13.10", "alpinejs": "^3.14.1", - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index dbd216190..532f954bf 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/lit": "^4.3.0", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^4.14.6", + "astro": "^4.15.0", "lit": "^3.2.0" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 54c6399bb..947ffb60c 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -18,7 +18,7 @@ "@astrojs/vue": "^4.5.0", "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "preact": "^10.23.2", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 00cb44365..2a50ccaca 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.2", "@preact/signals": "^1.3.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "preact": "^10.23.2" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index fe90c765a..88f04f255 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -14,7 +14,7 @@ "@astrojs/react": "^3.6.2", "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 4e3d60b67..100db427c 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^4.4.1", - "astro": "^4.14.6", + "astro": "^4.15.0", "solid-js": "^1.8.22" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 2ce16f70f..518271d9e 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^5.7.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "svelte": "^4.2.19" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index adc9e85c4..0b200a078 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/vue": "^4.5.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "vue": "^3.4.38" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 0f844a371..d2e72a827 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/node": "^8.3.3", - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index c9b95aeed..1cd67a6ba 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index e1a86dce3..f619c480c 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@astrojs/node": "^8.3.3", - "astro": "^4.14.6", + "astro": "^4.15.0", "html-minifier": "^4.0.0" }, "devDependencies": { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 8bcf5cd5c..3ed31d789 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index cdba337de..8c5507f09 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index a1483ce7a..2d8ca98d8 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/server-islands/package.json b/examples/server-islands/package.json index 3c98d2176..d066e29fd 100644 --- a/examples/server-islands/package.json +++ b/examples/server-islands/package.json @@ -17,7 +17,7 @@ "@tailwindcss/forms": "^0.5.7", "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "postcss": "^8.4.41", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 29a5d8d9e..620ff0e68 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -14,7 +14,7 @@ "dependencies": { "@astrojs/node": "^8.3.3", "@astrojs/svelte": "^5.7.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "svelte": "^4.2.19" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index bf16286c0..f36e7b116 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.14.6", + "astro": "^4.15.0", "sass": "^1.77.8", "sharp": "^0.33.3" } diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index 0619f8da6..11d8e6c7b 100644 --- a/examples/toolbar-app/package.json +++ b/examples/toolbar-app/package.json @@ -15,6 +15,6 @@ "./app": "./dist/app.js" }, "devDependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index faab3464c..06a1982ef 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -12,6 +12,6 @@ "devDependencies": { "@astrojs/tailwind": "^5.1.0", "@astrojs/node": "^8.3.3", - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 8785571b9..42aa5cbdf 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/markdoc": "^0.11.4", - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 3ac6539a5..38a8bf0f9 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^5.2.0", - "astro": "^4.14.6", + "astro": "^4.15.0", "hast-util-select": "^6.0.2", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 425e54449..1493661dc 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.14.6" + "astro": "^4.15.0" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 5c6c7c6df..fcd86b1c7 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/mdx": "^3.1.5", "@astrojs/preact": "^3.5.2", - "astro": "^4.14.6", + "astro": "^4.15.0", "preact": "^10.23.2" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 7c2a8bc2f..25818c565 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.2", "@nanostores/preact": "^0.5.2", - "astro": "^4.14.6", + "astro": "^4.15.0", "nanostores": "^0.11.3", "preact": "^10.23.2" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 713df62f8..77becb7d2 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^3.1.5", "@astrojs/tailwind": "^5.1.0", "@types/canvas-confetti": "^1.6.4", - "astro": "^4.14.6", + "astro": "^4.15.0", "autoprefixer": "^10.4.20", "canvas-confetti": "^1.9.3", "postcss": "^8.4.41", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index c15560eeb..6e43f9ca6 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.14.6", + "astro": "^4.15.0", "vitest": "^2.0.5" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 4646507c1..4b77a5074 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,177 @@ # astro +## 4.15.0 + +### Minor Changes + +- [#11729](https://github.com/withastro/astro/pull/11729) [`1c54e63`](https://github.com/withastro/astro/commit/1c54e633274ad47f6c83c9a16f375f0caa983fbe) Thanks [@ematipico](https://github.com/ematipico)! - Adds a new variant `sync` for the `astro:config:setup` hook's `command` property. This value is set when calling the command `astro sync`. + + If your integration previously relied on knowing how many variants existed for the `command` property, you must update your logic to account for this new option. + +- [#11743](https://github.com/withastro/astro/pull/11743) [`cce0894`](https://github.com/withastro/astro/commit/cce08945340312776a0480fc9ffe43929257639a) Thanks [@ph1p](https://github.com/ph1p)! - Adds a new, optional property `timeout` for the `client:idle` directive. + + This value allows you to specify a maximum time to wait, in milliseconds, before hydrating a UI framework component, even if the page is not yet done with its initial load. This means you can delay hydration for lower-priority UI elements with more control to ensure your element is interactive within a specified time frame. + + ```astro + <ShowHideButton client:idle={{ timeout: 500 }} /> + ``` + +- [#11677](https://github.com/withastro/astro/pull/11677) [`cb356a5`](https://github.com/withastro/astro/commit/cb356a5db6b1ec2799790a603f931a961883ab31) Thanks [@ematipico](https://github.com/ematipico)! - Adds a new option `fallbackType` to `i18n.routing` configuration that allows you to control how fallback pages are handled. + + When `i18n.fallback` is configured, this new routing option controls whether to [redirect](https://docs.astro.build/en/guides/routing/#redirects) to the fallback page, or to [rewrite](https://docs.astro.build/en/guides/routing/#rewrites) the fallback page's content in place. + + The `"redirect"` option is the default value and matches the current behavior of the existing fallback system. + + The option `"rewrite"` uses the new [rewriting system](https://docs.astro.build/en/guides/routing/#rewrites) to create fallback pages that render content on the original, requested URL without a browser refresh. + + For example, the following configuration will generate a page `/fr/index.html` that will contain the same HTML rendered by the page `/en/index.html` when `src/pages/fr/index.astro` does not exist. + + ```js + // astro.config.mjs + export default defineConfig({ + i18n: { + locals: ['en', 'fr'], + defaultLocale: 'en', + routing: { + prefixDefaultLocale: true, + fallbackType: 'rewrite', + }, + fallback: { + fr: 'en', + }, + }, + }); + ``` + +- [#11708](https://github.com/withastro/astro/pull/11708) [`62b0d20`](https://github.com/withastro/astro/commit/62b0d20b974dc932769221d210b751627fb4bbc6) Thanks [@martrapp](https://github.com/martrapp)! - Adds a new object `swapFunctions` to expose the necessary utility functions on `astro:transitions/client` that allow you to build custom swap functions to be used with view transitions. + + The example below uses these functions to replace Astro's built-in default `swap` function with one that only swaps the `<main>` part of the page: + + ```html + <script> + import { swapFunctions } from 'astro:transitions/client'; + + document.addEventListener('astro:before-swap', (e) => { e.swap = () => swapMainOnly(e.newDocument) }); + + function swapMainOnly(doc: Document) { + swapFunctions.deselectScripts(doc); + swapFunctions.swapRootAttributes(doc); + swapFunctions.swapHeadElements(doc); + const restoreFocusFunction = swapFunctions.saveFocus(); + const newMain = doc.querySelector('main'); + const oldMain = document.querySelector('main'); + if (newMain && oldMain) { + swapFunctions.swapBodyElement(newMain, oldMain); + } else { + swapFunctions.swapBodyElement(doc.body, document.body); + } + restoreFocusFunction(); + }; + </script> + ``` + + See the [view transitions guide](https://docs.astro.build/en/guides/view-transitions/#astrobefore-swap) for more information about hooking into the `astro:before-swap` lifecycle event and adding a custom swap implementation. + +- [#11843](https://github.com/withastro/astro/pull/11843) [`5b4070e`](https://github.com/withastro/astro/commit/5b4070efef877a77247bb05a4806b75f22e557c8) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Exposes `z` from the new `astro:schema` module. This is the new recommended import source for all Zod utilities when using Astro Actions. + + ## Migration for Astro Actions users + + `z` will no longer be exposed from `astro:actions`. To use `z` in your actions, import it from `astro:schema` instead: + + ```diff + import { + defineAction, + - z, + } from 'astro:actions'; + + import { z } from 'astro:schema'; + ``` + +- [#11843](https://github.com/withastro/astro/pull/11843) [`5b4070e`](https://github.com/withastro/astro/commit/5b4070efef877a77247bb05a4806b75f22e557c8) Thanks [@bholmesdev](https://github.com/bholmesdev)! - The Astro Actions API introduced behind a flag in [v4.8.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#480) is no longer experimental and is available for general use. + + Astro Actions allow you to define and call backend functions with type-safety, performing data fetching, JSON parsing, and input validation for you. + + Actions can be called from client-side components and HTML forms. This gives you to flexibility to build apps using any technology: React, Svelte, HTMX, or just plain Astro components. This example calls a newsletter action and renders the result using an Astro component: + + ```astro + --- + // src/pages/newsletter.astro + import { actions } from 'astro:actions'; + const result = Astro.getActionResult(actions.newsletter); + --- + + {result && !result.error && <p>Thanks for signing up!</p>} + <form method="POST" action={actions.newsletter}> + <input type="email" name="email" /> + <button>Sign up</button> + </form> + ``` + + If you were previously using this feature, please remove the experimental flag from your Astro config: + + ```diff + import { defineConfig } from 'astro' + + export default defineConfig({ + - experimental: { + - actions: true, + - } + }) + ``` + + If you have been waiting for stabilization before using Actions, you can now do so. + + For more information and usage examples, see our [brand new Actions guide](https://docs.astro.build/en/guides/actions). + +### Patch Changes + +- [#11677](https://github.com/withastro/astro/pull/11677) [`cb356a5`](https://github.com/withastro/astro/commit/cb356a5db6b1ec2799790a603f931a961883ab31) Thanks [@ematipico](https://github.com/ematipico)! - Fixes a bug in the logic of `Astro.rewrite()` which led to the value for `base`, if configured, being automatically prepended to the rewrite URL passed. This was unintended behavior and has been corrected, and Astro now processes the URLs exactly as passed. + + If you use the `rewrite()` function on a project that has `base` configured, you must now prepend the base to your existing rewrite URL: + + ```js + // astro.config.mjs + export default defineConfig({ + base: '/blog', + }); + ``` + + ```diff + // src/middleware.js + export function onRequest(ctx, next) { + - return ctx.rewrite("/about") + + return ctx.rewrite("/blog/about") + } + ``` + +- [#11862](https://github.com/withastro/astro/pull/11862) [`0e35afe`](https://github.com/withastro/astro/commit/0e35afe44f5a3c9f87b41dc89d5128b02e448895) Thanks [@ascorbic](https://github.com/ascorbic)! - **BREAKING CHANGE to experimental content layer loaders only!** + + Passes `AstroConfig` instead of `AstroSettings` object to content layer loaders. + + This will not affect you unless you have created a loader that uses the `settings` object. If you have, you will need to update your loader to use the `config` object instead. + + ```diff + export default function myLoader() { + return { + name: 'my-loader' + - async load({ settings }) { + - const base = settings.config.base; + + async load({ config }) { + + const base = config.base; + // ... + } + } + } + + ``` + + Other properties of the settings object are private internals, and should not be accessed directly. If you think you need access to other properties, please open an issue to discuss your use case. + +- [#11772](https://github.com/withastro/astro/pull/11772) [`6272e6c`](https://github.com/withastro/astro/commit/6272e6cec07778e81f853754bffaac40e658c700) Thanks [@bluwy](https://github.com/bluwy)! - Uses `magicast` to update the config for `astro add` + +- [#11845](https://github.com/withastro/astro/pull/11845) [`440a4be`](https://github.com/withastro/astro/commit/440a4be0a6ca135e47b0d37124c1be03735ba7ff) Thanks [@bluwy](https://github.com/bluwy)! - Replaces `execa` with `tinyexec` internally + +- [#11858](https://github.com/withastro/astro/pull/11858) [`8bab233`](https://github.com/withastro/astro/commit/8bab2339374763d19dbc4cc2c7ce4ad8a2a49694) Thanks [@ascorbic](https://github.com/ascorbic)! - Correctly resolves content layer images when filePath is not set + ## 4.14.6 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index f2b232ecc..faf4dfb5e 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.14.6", + "version": "4.15.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/db/CHANGELOG.md b/packages/db/CHANGELOG.md index 87c2df6e1..734768c05 100644 --- a/packages/db/CHANGELOG.md +++ b/packages/db/CHANGELOG.md @@ -1,5 +1,25 @@ # @astrojs/db +## 0.14.0 + +### Minor Changes + +- [#11385](https://github.com/withastro/astro/pull/11385) [`d6611e8`](https://github.com/withastro/astro/commit/d6611e8bb05e7d913aeb5e59e90906b8b919d48e) Thanks [@Fryuni](https://github.com/Fryuni)! - Adds support for connecting Astro DB to any remote LibSQL server. This allows Astro DB to be used with self-hosting and air-gapped deployments. + + To connect Astro DB to a remote LibSQL server instead of Studio, set the following environment variables: + + - `ASTRO_DB_REMOTE_URL`: the connection URL to your LibSQL server + - `ASTRO_DB_APP_TOKEN`: the auth token to your LibSQL server + + Details of the LibSQL connection can be configured using the connection URL. For example, `memory:?syncUrl=libsql%3A%2F%2Fdb-server.example.com` would create an in-memory embedded replica for the LibSQL DB on `libsql://db-server.example.com`. + + For more details, please visit [the Astro DB documentation](https://docs.astro.build/en/guides/astro-db/#libsql) + +### Patch Changes + +- Updated dependencies []: + - @astrojs/studio@0.1.1 + ## 0.13.2 ### Patch Changes diff --git a/packages/db/package.json b/packages/db/package.json index fbfb09d24..730d551f7 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/db", - "version": "0.13.2", + "version": "0.14.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 037e868a9..8e350c74e 100644 --- a/packages/integrations/web-vitals/CHANGELOG.md +++ b/packages/integrations/web-vitals/CHANGELOG.md @@ -1,5 +1,12 @@ # @astrojs/web-vitals +## 3.0.0 + +### Patch Changes + +- Updated dependencies [[`d6611e8`](https://github.com/withastro/astro/commit/d6611e8bb05e7d913aeb5e59e90906b8b919d48e)]: + - @astrojs/db@0.14.0 + ## 2.0.0 ### Patch Changes diff --git a/packages/integrations/web-vitals/package.json b/packages/integrations/web-vitals/package.json index fcf42d536..cebe1319b 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": "2.0.0", + "version": "3.0.0", "type": "module", "author": "withastro", "license": "MIT", @@ -35,7 +35,7 @@ "web-vitals": "^4.2.3" }, "peerDependencies": { - "@astrojs/db": "^0.13.0" + "@astrojs/db": "^0.14.0" }, "devDependencies": { "@astrojs/db": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac8d67daa..ef9e2f2c2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,7 +116,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/blog: @@ -131,13 +131,13 @@ importers: specifier: ^3.1.6 version: link:../../packages/integrations/sitemap astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/container-with-vitest: @@ -146,7 +146,7 @@ importers: specifier: ^3.6.2 version: link:../../packages/integrations/react astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -177,7 +177,7 @@ importers: specifier: ^3.14.1 version: 3.14.1 astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/framework-lit: @@ -189,7 +189,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro lit: specifier: ^3.2.0 @@ -219,7 +219,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro preact: specifier: ^10.23.2 @@ -249,7 +249,7 @@ importers: specifier: ^1.3.0 version: 1.3.0(preact@10.23.2) astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro preact: specifier: ^10.23.2 @@ -267,7 +267,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -282,7 +282,7 @@ importers: specifier: ^4.4.1 version: link:../../packages/integrations/solid astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro solid-js: specifier: ^1.8.22 @@ -294,7 +294,7 @@ importers: specifier: ^5.7.0 version: link:../../packages/integrations/svelte astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro svelte: specifier: ^4.2.19 @@ -306,7 +306,7 @@ importers: specifier: ^4.5.0 version: link:../../packages/integrations/vue astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro vue: specifier: ^3.4.38 @@ -318,13 +318,13 @@ importers: specifier: ^8.3.3 version: link:../../packages/integrations/node astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/middleware: @@ -333,7 +333,7 @@ importers: specifier: ^8.3.3 version: link:../../packages/integrations/node astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -346,19 +346,19 @@ importers: examples/minimal: dependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/server-islands: @@ -385,7 +385,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro postcss: specifier: ^8.4.41 @@ -409,7 +409,7 @@ importers: specifier: ^5.7.0 version: link:../../packages/integrations/svelte astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro svelte: specifier: ^4.2.19 @@ -418,7 +418,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro sass: specifier: ^1.77.8 @@ -430,7 +430,7 @@ importers: examples/toolbar-app: devDependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/view-transitions: @@ -442,7 +442,7 @@ importers: specifier: ^5.1.0 version: link:../../packages/integrations/tailwind astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/with-markdoc: @@ -451,7 +451,7 @@ importers: specifier: ^0.11.4 version: link:../../packages/integrations/markdoc astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/with-markdown-plugins: @@ -460,7 +460,7 @@ importers: specifier: ^5.2.0 version: link:../../packages/markdown/remark astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro hast-util-select: specifier: ^6.0.2 @@ -481,7 +481,7 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro examples/with-mdx: @@ -493,7 +493,7 @@ importers: specifier: ^3.5.2 version: link:../../packages/integrations/preact astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro preact: specifier: ^10.23.2 @@ -508,7 +508,7 @@ importers: specifier: ^0.5.2 version: 0.5.2(nanostores@0.11.3)(preact@10.23.2) astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro nanostores: specifier: ^0.11.3 @@ -529,7 +529,7 @@ importers: specifier: ^1.6.4 version: 1.6.4 astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro autoprefixer: specifier: ^10.4.20 @@ -547,7 +547,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^4.14.6 + specifier: ^4.15.0 version: link:../../packages/astro vitest: specifier: ^2.0.5 |