diff --git a/.changeset/calm-shrimps-peel.md b/.changeset/calm-shrimps-peel.md new file mode 100644 index 000000000000..d64766f1ca51 --- /dev/null +++ b/.changeset/calm-shrimps-peel.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes middleware HMR not responding to changes in imported modules. Previously, only direct edits to the middleware file would trigger a reload. diff --git a/.changeset/cf-custom-image-endpoint.md b/.changeset/cf-custom-image-endpoint.md deleted file mode 100644 index a9d1b5ebca84..000000000000 --- a/.changeset/cf-custom-image-endpoint.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@astrojs/cloudflare': patch ---- - -Fixes `/_image` returning 500 in dev mode when using `imageService: 'custom'`. Astro's default dev image endpoint imports `vite` and `node:fs`, which cannot be loaded inside workerd. The `custom` and fallback cases now use the generic fetch-based endpoint in dev, matching the other image service modes. A user-configured `image.endpoint` is left untouched. - -Additionally, a dev-time warning is now logged when `imageService: 'custom'` resolves to the Sharp service (including when no `image.service` is configured), since Sharp's native binding cannot run inside workerd in dev or production. diff --git a/.changeset/clever-mammals-work.md b/.changeset/clever-mammals-work.md deleted file mode 100644 index 2e51f8577895..000000000000 --- a/.changeset/clever-mammals-work.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/solid-js': patch ---- - -Fixes a build crash when a Solid island imports a package that ships pre-compiled browser artifacts via the `exports.solid` condition (e.g. `@kobalte/core`). Solid ecosystem packages are now bundled in non-client environments so that Vite resolves the correct export condition during prerendering. diff --git a/.changeset/cloudflare-immutable-cache-headers.md b/.changeset/cloudflare-immutable-cache-headers.md deleted file mode 100644 index 80a39ea8a6cd..000000000000 --- a/.changeset/cloudflare-immutable-cache-headers.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/cloudflare': patch ---- - -Fixes a crash on `/_image` cache hits when the Cloudflare cache provider is enabled. Responses served from the Workers Cache API have immutable headers, and the request handler crashed with "Can't modify immutable headers" when applying its default `Cloudflare-CDN-Cache-Control: no-store` header to them. The handler now rebuilds the response with mutable headers when needed. diff --git a/.changeset/common-lions-end.md b/.changeset/common-lions-end.md deleted file mode 100644 index 27aa606ebeb0..000000000000 --- a/.changeset/common-lions-end.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Improves `logger.entrypoint` reference docs diff --git a/.changeset/eighty-donkeys-repeat.md b/.changeset/eighty-donkeys-repeat.md deleted file mode 100644 index e862fb01b62b..000000000000 --- a/.changeset/eighty-donkeys-repeat.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'astro': patch ---- - -Fixes `astro dev` crashing with `Invalid URL` when `--host` is set to a specific non-loopback address - -Vite only reports a `local` URL for loopback hosts. When the dev server was started with `--host ` bound to a specific non-loopback address (a LAN or Tailscale IP, for example), the URL was reported under `network` and `local` was empty, so writing the dev lock file threw `Invalid URL` and killed a server that had already started successfully. - -The lock file URL now falls back to the network URL, and a server that exposes no URL at all is left untracked rather than being taken down by lock file bookkeeping. diff --git a/.changeset/fix-cloudflare-binding-image-optimization.md b/.changeset/fix-cloudflare-binding-image-optimization.md deleted file mode 100644 index 45552612b6c9..000000000000 --- a/.changeset/fix-cloudflare-binding-image-optimization.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -'@astrojs/cloudflare': minor ---- - -Adds opt-in build-time image optimization for the `cloudflare-binding` image service. - -When enabled, the Cloudflare IMAGES binding transforms static images in the workerd prerender environment, and the optimized bytes are written directly to the output directory. If the binding fails, it falls back to Sharp. - -To opt in, use the compound configuration form: - -```js -export default defineConfig({ - adapter: cloudflare({ - imageService: { build: 'cloudflare-binding', runtime: 'cloudflare-binding' }, - }), -}); -``` - -The string shorthand `imageService: 'cloudflare-binding'` preserves the current runtime-only behavior and is unaffected. diff --git a/.changeset/fix-googleicons-glyphs.md b/.changeset/fix-googleicons-glyphs.md deleted file mode 100644 index b2773cd05a43..000000000000 --- a/.changeset/fix-googleicons-glyphs.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes `fontProviders.googleicons()` returning the full icon font (~3.9MB) instead of only the requested glyphs when multiple `experimental.glyphs` are specified diff --git a/.changeset/fix-preserve-url-pathname.md b/.changeset/fix-preserve-url-pathname.md deleted file mode 100644 index d6ac09193fa0..000000000000 --- a/.changeset/fix-preserve-url-pathname.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes `Astro.url.pathname` for non-index pages when using `build.format: 'preserve'`. Previously, a page like `src/pages/about-me.astro` would output to `dist/about-me.html` but `Astro.url.pathname` would incorrectly return `/about-me/` instead of `/about-me.html`. diff --git a/.changeset/friendly-vue-devtools.md b/.changeset/friendly-vue-devtools.md deleted file mode 100644 index 49bde506b36c..000000000000 --- a/.changeset/friendly-vue-devtools.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/vue': patch ---- - -Fix dev server crashes when Vue devtools are enabled with Vite 8. diff --git a/.changeset/fruity-news-post.md b/.changeset/fruity-news-post.md deleted file mode 100644 index 65374e557943..000000000000 --- a/.changeset/fruity-news-post.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/cloudflare': patch ---- - -Fixes `imageService: 'compile'` producing unoptimized images when `prerenderEnvironment` is set to `'node'` diff --git a/.changeset/giant-pets-take.md b/.changeset/giant-pets-take.md deleted file mode 100644 index 81bcfe8555b7..000000000000 --- a/.changeset/giant-pets-take.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -'astro': minor ---- - -Adds the `astro preview --background` flag to start preview servers as background processes. - -This makes preview servers easier to manage from scripts and AI coding agents because the command returns after the server is ready instead of keeping the terminal attached to the long-running process. - -```sh -astro preview --background -``` - -When a preview server is running in the background, you can inspect or stop it with new `astro preview` subcommands: - -```sh -astro preview status -astro preview logs -astro preview logs --follow -astro preview stop -``` - -If Astro detects that `astro preview` is being run by an AI coding agent, background mode is enabled automatically. This matches the existing behavior for `astro dev`, allowing agents to continue working after the preview server starts while still receiving the server URL and process ID. - -To opt out of automatic background mode for preview servers, set `ASTRO_PREVIEW_BACKGROUND=0` before running `astro preview`. diff --git a/.changeset/hip-gifts-try.md b/.changeset/hip-gifts-try.md deleted file mode 100644 index 2146244e346f..000000000000 --- a/.changeset/hip-gifts-try.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes a Content Layer build crash that could occur when another dependency causes an older version of `neotraverse` to be hoisted to the project root diff --git a/.changeset/hip-tools-tie.md b/.changeset/hip-tools-tie.md deleted file mode 100644 index 14a3c80a8f3f..000000000000 --- a/.changeset/hip-tools-tie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes cookies set via `Astro.cookies.set()` inside a custom `404.astro` or `500.astro` error page being silently dropped from the final response diff --git a/.changeset/logger-relative-entrypoint.md b/.changeset/logger-relative-entrypoint.md deleted file mode 100644 index eb80834fe119..000000000000 --- a/.changeset/logger-relative-entrypoint.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'astro': minor ---- - -Adds support for paths relative to your project root in `logger.entrypoint` - -Previously, pointing `logger.entrypoint` at a custom log handler living in your own project required building an absolute `URL`. You can now write the path directly: - -```diff -// astro.config.mjs -import { defineConfig } from 'astro/config'; - -export default defineConfig({ - logger: { -- entrypoint: new URL('./src/logger.js', import.meta.url), -+ entrypoint: './src/logger.js', - }, -}); -``` - -Paths starting with `./` or `../` are resolved against your project root. Package specifiers such as `@org/astro-logger`, absolute paths, and `URL` entrypoints keep working as before. diff --git a/.changeset/neat-grapes-tease.md b/.changeset/neat-grapes-tease.md deleted file mode 100644 index 455f75d73bfc..000000000000 --- a/.changeset/neat-grapes-tease.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -'astro': minor ---- - -Widens the `AstroPrerenderer` `render()` return type so prerenderers can report incremental-build metadata - -A prerenderer's `render()` may now resolve to either a `Response` (as before) or a `PrerenderResult` object that pairs the response with the content entries and optimized-image transforms the page resolved. This lets prerenderers that render out of process (for example, in an adapter's runtime like workerd) report those dependencies back to the build, so [incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/) can track and replay them for skipped pages. - -```ts -import type { AstroPrerenderer, PrerenderResult } from 'astro'; - -const prerenderer: AstroPrerenderer = { - name: 'my-adapter:prerenderer', - getStaticPaths, - async render(request, { routeData }): Promise { - const { response, metadata } = await renderInRuntime(request, routeData); - return { response, metadata }; - }, -}; -``` - -This is a non-breaking widening: prerenderers that return a bare `Response` continue to work unchanged, and in-process prerenderers can keep returning a `Response` since the build collects their metadata directly. diff --git a/.changeset/orange-doors-agree.md b/.changeset/orange-doors-agree.md deleted file mode 100644 index 955d1185389f..000000000000 --- a/.changeset/orange-doors-agree.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/node': patch ---- - -Fixes middleware mode routing when a prerendered dynamic route sorts before an on-demand fallback diff --git a/.changeset/session-false-cloudflare.md b/.changeset/session-false-cloudflare.md deleted file mode 100644 index 65ea3345d12d..000000000000 --- a/.changeset/session-false-cloudflare.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/cloudflare': minor ---- - -When `session: false` is set in `astro.config`, the adapter no longer auto-wires the Cloudflare KV session driver. Combined with the matching `astro` change, this lets the session runtime tree-shake out of the Worker bundle. diff --git a/.changeset/session-false-netlify.md b/.changeset/session-false-netlify.md deleted file mode 100644 index bdfc5870733c..000000000000 --- a/.changeset/session-false-netlify.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/netlify': minor ---- - -When `session: false` is set in `astro.config`, the adapter no longer auto-wires the Netlify Blobs session driver. Combined with the matching `astro` change, this lets the session runtime tree-shake out of the function bundle. diff --git a/.changeset/session-false-node.md b/.changeset/session-false-node.md deleted file mode 100644 index 37fd41edbc40..000000000000 --- a/.changeset/session-false-node.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/node': minor ---- - -When `session: false` is set in `astro.config`, the adapter no longer auto-wires the filesystem session driver. Combined with the matching `astro` change, this lets the session runtime tree-shake out of the server bundle. diff --git a/.changeset/session-false-opt-out.md b/.changeset/session-false-opt-out.md deleted file mode 100644 index 123a7922a399..000000000000 --- a/.changeset/session-false-opt-out.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'astro': minor ---- - -Adds `session: false` in `astro.config` to opt out of session support. Projects that do not set `session: false` see no behavior change. - -```js title="astro.config.mjs" -import { defineConfig } from 'astro/config'; - -export default defineConfig({ - session: false, -}); -``` - -The session runtime and dependencies (`unstorage`) are now tree-shaken out of the SSR bundle for any project where no session driver is wired via: - -* `session: false` -* no `session` config at all -* a `session` config without a driver - -Useful for serverless/edge runtimes where cold-start parse time is sensitive. diff --git a/.changeset/shiny-plums-brush.md b/.changeset/shiny-plums-brush.md deleted file mode 100644 index 66aeebd55a17..000000000000 --- a/.changeset/shiny-plums-brush.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@astrojs/upgrade': patch -'astro': patch ---- - -Supports the `devEngines` field in package.json when detecting the package manager for install commands diff --git a/.changeset/smooth-birds-smell.md b/.changeset/smooth-birds-smell.md deleted file mode 100644 index ebe17a584552..000000000000 --- a/.changeset/smooth-birds-smell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/cloudflare': minor ---- - -Supports Astro's experimental [incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/). When `experimental.incrementalBuild` is enabled, the adapter skips unchanged pages between builds. diff --git a/.changeset/social-lemons-cheat.md b/.changeset/social-lemons-cheat.md deleted file mode 100644 index 9b773ffc92e2..000000000000 --- a/.changeset/social-lemons-cheat.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -'astro': minor ---- - -Adds experimental support for incremental static builds with `experimental.incrementalBuild`. - -When enabled, Astro can skip regenerating static pages from dynamic routes when both the page's module dependencies and its data cache key are unchanged from the previous build. This currently applies to pages returned from `getStaticPaths()` that include a `cacheKey`. - -```js -// astro.config.mjs -import { defineConfig } from 'astro/config'; - -export default defineConfig({ - experimental: { - incrementalBuild: true, - }, -}); -``` - -Return a `cacheKey` for each generated page from `getStaticPaths()`: - -```astro ---- -export async function getStaticPaths() { - const posts = await fetchPosts(); - - return posts.map((post) => ({ - params: { slug: post.slug }, - props: { post }, - cacheKey: post.digest, - })); -} ---- -``` - -For incremental builds to skip rendering in CI, Astro's cache directory must be preserved between builds. Astro empties the output directory on each build and restores skipped pages from the cache directory, so only that directory needs to persist. For the default config, cache and restore `node_modules/.astro/` before running `astro build`. - -See the [experimental incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/) documentation for more information. diff --git a/.changeset/solid-steaks-enjoy.md b/.changeset/solid-steaks-enjoy.md deleted file mode 100644 index 51bba89bf994..000000000000 --- a/.changeset/solid-steaks-enjoy.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/cloudflare': patch ---- - -Fixes a type-checking error when using `app.use(cf())` from `@astrojs/cloudflare/hono` in projects with `wrangler types`-generated `ExecutionContext` declarations diff --git a/.changeset/thin-donuts-cheer.md b/.changeset/thin-donuts-cheer.md deleted file mode 100644 index 724cf89828f3..000000000000 --- a/.changeset/thin-donuts-cheer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/vercel': patch ---- - -Prevents `astro build` from crashing with `EEXIST` when `.vercel/output/server/` already exists by creating it with `{ recursive: true }`, matching the sibling `static/` directory call diff --git a/.changeset/tidy-plums-attend.md b/.changeset/tidy-plums-attend.md deleted file mode 100644 index 63fdf3ea646a..000000000000 --- a/.changeset/tidy-plums-attend.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes `popover` being rendered as `popover="true"`/`popover="false"` on custom elements (tag names containing a hyphen). Per the Popover API, the attribute only accepts `"auto"`, `"manual"`, or being absent, so boolean values are now always rendered as a bare `popover` attribute (or omitted), regardless of the tag name. diff --git a/.changeset/wide-pets-bow.md b/.changeset/wide-pets-bow.md deleted file mode 100644 index d92ee2da9c8e..000000000000 --- a/.changeset/wide-pets-bow.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'astro': minor ---- - -Adds the optional `digest` property to content collection entries. - -Loaders can provide an opaque digest value that changes when an entry changes. This is now reflected in the `CollectionEntry` type returned by `getCollection()` and `getEntry()`, making it easier to detect content changes without re-hashing large entry bodies. - -```astro ---- -import { getCollection } from 'astro:content'; - -const posts = await getCollection('blog'); - -for (const post of posts) { - console.log(post.digest); -} ---- -``` - -The property is optional because not every loader provides a digest. See [incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/) for how `digest` can be used as a `cacheKey`. diff --git a/examples/advanced-routing/package.json b/examples/advanced-routing/package.json index 1b8210ecd54e..b41f1a65cd19 100644 --- a/examples/advanced-routing/package.json +++ b/examples/advanced-routing/package.json @@ -13,8 +13,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^11.0.3", - "astro": "^7.1.6", + "@astrojs/node": "^11.1.0", + "astro": "^7.2.0", "hono": "^4.12.14" } } diff --git a/examples/basics/package.json b/examples/basics/package.json index 631cb4b5a66b..60146f0df390 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -13,6 +13,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^7.1.6" + "astro": "^7.2.0" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index f9aaf20683c5..d8eff0b2afdf 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -16,7 +16,7 @@ "@astrojs/mdx": "^7.0.5", "@astrojs/rss": "^4.0.19", "@astrojs/sitemap": "^3.7.3", - "astro": "^7.1.6", + "astro": "^7.2.0", "sharp": "^0.35.0" } } diff --git a/examples/component/package.json b/examples/component/package.json index 507d5101d8f0..bb0dae041a88 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -18,7 +18,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^7.1.6" + "astro": "^7.2.0" }, "peerDependencies": { "astro": "^5.0.0 || ^6.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index bfbe056673b8..3f2fbedc8da3 100644 --- a/examples/container-with-vitest/package.json +++ b/examples/container-with-vitest/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@astrojs/react": "^6.0.2", - "astro": "^7.1.6", + "astro": "^7.2.0", "react": "^18.3.1", "react-dom": "^18.3.1", "vitest": "^4.1.0" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 30bfdc2e3bd5..ca276a016199 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -16,6 +16,6 @@ "@astrojs/alpinejs": "^1.0.0", "@types/alpinejs": "^3.13.11", "alpinejs": "^3.15.8", - "astro": "^7.1.6" + "astro": "^7.2.0" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 4ac948abba94..a48ad69c9504 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -15,12 +15,12 @@ "dependencies": { "@astrojs/preact": "^6.0.2", "@astrojs/react": "^6.0.2", - "@astrojs/solid-js": "^7.0.1", + "@astrojs/solid-js": "^7.0.2", "@astrojs/svelte": "^9.0.1", - "@astrojs/vue": "^7.0.1", + "@astrojs/vue": "^7.0.2", "@types/react": "^18.3.28", "@types/react-dom": "^18.3.7", - "astro": "^7.1.6", + "astro": "^7.2.0", "preact": "^10.28.4", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 5ccf5d71479d..98edeb980630 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -15,7 +15,7 @@ "dependencies": { "@astrojs/preact": "^6.0.2", "@preact/signals": "^2.8.1", - "astro": "^7.1.6", + "astro": "^7.2.0", "preact": "^10.28.4" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 7cfa0423aedb..45a6074adb98 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -16,7 +16,7 @@ "@astrojs/react": "^6.0.2", "@types/react": "^18.3.28", "@types/react-dom": "^18.3.7", - "astro": "^7.1.6", + "astro": "^7.2.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 fec409467a91..d29bdc8d045d 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -13,8 +13,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/solid-js": "^7.0.1", - "astro": "^7.1.6", + "@astrojs/solid-js": "^7.0.2", + "astro": "^7.2.0", "solid-js": "^1.9.11" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index c55206fb24f8..bc361c2ec5a2 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@astrojs/svelte": "^9.0.1", - "astro": "^7.1.6", + "astro": "^7.2.0", "svelte": "^5.53.5" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 7b9bb9b5426f..d2d75e828726 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -13,8 +13,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/vue": "^7.0.1", - "astro": "^7.1.6", + "@astrojs/vue": "^7.0.2", + "astro": "^7.2.0", "vue": "^3.5.29" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index a529843b5ed0..4af6bd88b18b 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -13,7 +13,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^11.0.3", - "astro": "^7.1.6" + "@astrojs/node": "^11.1.0", + "astro": "^7.2.0" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 7cb90c431d2f..91d3fb67e9ad 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -18,7 +18,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^7.1.6" + "astro": "^7.2.0" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 884f5880efc4..4aa56155040b 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -13,6 +13,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^7.1.6" + "astro": "^7.2.0" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 7570eeb6f225..7a1b66cf11f5 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -13,6 +13,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^7.1.6" + "astro": "^7.2.0" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 957dc5add1a9..7db9c304054b 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -14,9 +14,9 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^11.0.3", + "@astrojs/node": "^11.1.0", "@astrojs/svelte": "^9.0.1", - "astro": "^7.1.6", + "astro": "^7.2.0", "svelte": "^5.53.5" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index 9b9510ed8b70..66ed08c3e569 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -9,7 +9,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^7.1.6", + "astro": "^7.2.0", "sass": "^1.97.3", "sharp": "^0.35.0" }, diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index 90dff30e4e6c..b586e27bb6ec 100644 --- a/examples/toolbar-app/package.json +++ b/examples/toolbar-app/package.json @@ -16,7 +16,7 @@ }, "devDependencies": { "@types/node": "^22.10.6", - "astro": "^7.1.6" + "astro": "^7.2.0" }, "engines": { "node": ">=22.12.0" diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 06d86f46e25d..113ace74a967 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -14,6 +14,6 @@ }, "dependencies": { "@astrojs/markdoc": "^2.0.6", - "astro": "^7.1.6" + "astro": "^7.2.0" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index c14bcd096586..eb207ef419a1 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -15,7 +15,7 @@ "dependencies": { "@astrojs/mdx": "^7.0.5", "@astrojs/preact": "^6.0.2", - "astro": "^7.1.6", + "astro": "^7.2.0", "preact": "^10.28.4" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 17a414522f45..aa27f64936da 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -15,7 +15,7 @@ "dependencies": { "@astrojs/preact": "^6.0.2", "@nanostores/preact": "^1.0.0", - "astro": "^7.1.6", + "astro": "^7.2.0", "nanostores": "^1.1.1", "preact": "^10.28.4" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 0f06d4f2004c..f78db62ffdbd 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -16,7 +16,7 @@ "@astrojs/mdx": "^7.0.5", "@tailwindcss/vite": "^4.2.1", "@types/canvas-confetti": "^1.9.0", - "astro": "^7.1.6", + "astro": "^7.2.0", "canvas-confetti": "^1.9.4", "tailwindcss": "^4.2.1", "vite": "^8.0.13" diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index bc2b41bacaeb..7aee9e8220a0 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -14,7 +14,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^7.1.6", + "astro": "^7.2.0", "vitest": "^5.0.0-beta.2" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 9e12ddf002ce..aa517c645a57 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,160 @@ # astro +## 7.2.0 + +### Minor Changes + +- [#17174](https://github.com/withastro/astro/pull/17174) [`0224a3a`](https://github.com/withastro/astro/commit/0224a3a356c1f2956075b77c3667bc67cf027d8c) Thanks [@matthewp](https://github.com/matthewp)! - Adds the `astro preview --background` flag to start preview servers as background processes. + + This makes preview servers easier to manage from scripts and AI coding agents because the command returns after the server is ready instead of keeping the terminal attached to the long-running process. + + ```sh + astro preview --background + ``` + + When a preview server is running in the background, you can inspect or stop it with new `astro preview` subcommands: + + ```sh + astro preview status + astro preview logs + astro preview logs --follow + astro preview stop + ``` + + If Astro detects that `astro preview` is being run by an AI coding agent, background mode is enabled automatically. This matches the existing behavior for `astro dev`, allowing agents to continue working after the preview server starts while still receiving the server URL and process ID. + + To opt out of automatic background mode for preview servers, set `ASTRO_PREVIEW_BACKGROUND=0` before running `astro preview`. + +- [#17532](https://github.com/withastro/astro/pull/17532) [`7f94895`](https://github.com/withastro/astro/commit/7f94895f8c28fc4d6977c9bfb1f90e80a9cfaa08) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds support for paths relative to your project root in `logger.entrypoint` + + Previously, pointing `logger.entrypoint` at a custom log handler living in your own project required building an absolute `URL`. You can now write the path directly: + + ```diff + // astro.config.mjs + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + logger: { + - entrypoint: new URL('./src/logger.js', import.meta.url), + + entrypoint: './src/logger.js', + }, + }); + ``` + + Paths starting with `./` or `../` are resolved against your project root. Package specifiers such as `@org/astro-logger`, absolute paths, and `URL` entrypoints keep working as before. + +- [#17084](https://github.com/withastro/astro/pull/17084) [`961bbe5`](https://github.com/withastro/astro/commit/961bbe5fdf4a761adb479595dfb94dc2e80f2957) Thanks [@matthewp](https://github.com/matthewp)! - Widens the `AstroPrerenderer` `render()` return type so prerenderers can report incremental-build metadata + + A prerenderer's `render()` may now resolve to either a `Response` (as before) or a `PrerenderResult` object that pairs the response with the content entries and optimized-image transforms the page resolved. This lets prerenderers that render out of process (for example, in an adapter's runtime like workerd) report those dependencies back to the build, so [incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/) can track and replay them for skipped pages. + + ```ts + import type { AstroPrerenderer, PrerenderResult } from 'astro'; + + const prerenderer: AstroPrerenderer = { + name: 'my-adapter:prerenderer', + getStaticPaths, + async render(request, { routeData }): Promise { + const { response, metadata } = await renderInRuntime(request, routeData); + return { response, metadata }; + }, + }; + ``` + + This is a non-breaking widening: prerenderers that return a bare `Response` continue to work unchanged, and in-process prerenderers can keep returning a `Response` since the build collects their metadata directly. + +- [#16871](https://github.com/withastro/astro/pull/16871) [`90c98ae`](https://github.com/withastro/astro/commit/90c98ae21ef0444a4088b7081676b0f97915001f) Thanks [@adamchal](https://github.com/adamchal)! - Adds `session: false` in `astro.config` to opt out of session support. Projects that do not set `session: false` see no behavior change. + + ```js title="astro.config.mjs" + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + session: false, + }); + ``` + + The session runtime and dependencies (`unstorage`) are now tree-shaken out of the SSR bundle for any project where no session driver is wired via: + + - `session: false` + - no `session` config at all + - a `session` config without a driver + + Useful for serverless/edge runtimes where cold-start parse time is sensitive. + +- [#17084](https://github.com/withastro/astro/pull/17084) [`961bbe5`](https://github.com/withastro/astro/commit/961bbe5fdf4a761adb479595dfb94dc2e80f2957) Thanks [@matthewp](https://github.com/matthewp)! - Adds experimental support for incremental static builds with `experimental.incrementalBuild`. + + When enabled, Astro can skip regenerating static pages from dynamic routes when both the page's module dependencies and its data cache key are unchanged from the previous build. This currently applies to pages returned from `getStaticPaths()` that include a `cacheKey`. + + ```js + // astro.config.mjs + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + experimental: { + incrementalBuild: true, + }, + }); + ``` + + Return a `cacheKey` for each generated page from `getStaticPaths()`: + + ```astro + --- + export async function getStaticPaths() { + const posts = await fetchPosts(); + + return posts.map((post) => ({ + params: { slug: post.slug }, + props: { post }, + cacheKey: post.digest, + })); + } + --- + ``` + + For incremental builds to skip rendering in CI, Astro's cache directory must be preserved between builds. Astro empties the output directory on each build and restores skipped pages from the cache directory, so only that directory needs to persist. For the default config, cache and restore `node_modules/.astro/` before running `astro build`. + + See the [experimental incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/) documentation for more information. + +- [#17084](https://github.com/withastro/astro/pull/17084) [`961bbe5`](https://github.com/withastro/astro/commit/961bbe5fdf4a761adb479595dfb94dc2e80f2957) Thanks [@matthewp](https://github.com/matthewp)! - Adds the optional `digest` property to content collection entries. + + Loaders can provide an opaque digest value that changes when an entry changes. This is now reflected in the `CollectionEntry` type returned by `getCollection()` and `getEntry()`, making it easier to detect content changes without re-hashing large entry bodies. + + ```astro + --- + import { getCollection } from 'astro:content'; + + const posts = await getCollection('blog'); + + for (const post of posts) { + console.log(post.digest); + } + --- + ``` + + The property is optional because not every loader provides a digest. See [incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/) for how `digest` can be used as a `cacheKey`. + +### Patch Changes + +- [#17534](https://github.com/withastro/astro/pull/17534) [`5a5337e`](https://github.com/withastro/astro/commit/5a5337ea718ab32401a37cdddc52e944289e8b66) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Improves `logger.entrypoint` reference docs + +- [#17529](https://github.com/withastro/astro/pull/17529) [`d52a787`](https://github.com/withastro/astro/commit/d52a787b321b67a0491f33d87e670b59ba16f9fe) Thanks [@QVinto](https://github.com/QVinto)! - Fixes `astro dev` crashing with `Invalid URL` when `--host` is set to a specific non-loopback address + + Vite only reports a `local` URL for loopback hosts. When the dev server was started with `--host ` bound to a specific non-loopback address (a LAN or Tailscale IP, for example), the URL was reported under `network` and `local` was empty, so writing the dev lock file threw `Invalid URL` and killed a server that had already started successfully. + + The lock file URL now falls back to the network URL, and a server that exposes no URL at all is left untracked rather than being taken down by lock file bookkeeping. + +- [#17566](https://github.com/withastro/astro/pull/17566) [`296248c`](https://github.com/withastro/astro/commit/296248cb39e9e2cc3c0896441df75edb2d3b3959) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Fixes `fontProviders.googleicons()` returning the full icon font (~3.9MB) instead of only the requested glyphs when multiple `experimental.glyphs` are specified + +- [#17560](https://github.com/withastro/astro/pull/17560) [`ef45de1`](https://github.com/withastro/astro/commit/ef45de17d21a0303fe50d7ca50fc8deef15856a7) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Fixes `Astro.url.pathname` for non-index pages when using `build.format: 'preserve'`. Previously, a page like `src/pages/about-me.astro` would output to `dist/about-me.html` but `Astro.url.pathname` would incorrectly return `/about-me/` instead of `/about-me.html`. + +- [#17573](https://github.com/withastro/astro/pull/17573) [`0089f83`](https://github.com/withastro/astro/commit/0089f836320ec2aefdb6c448af31e56754115c5c) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Fixes a Content Layer build crash that could occur when another dependency causes an older version of `neotraverse` to be hoisted to the project root + +- [#17571](https://github.com/withastro/astro/pull/17571) [`116f700`](https://github.com/withastro/astro/commit/116f700d63b314467256d1913d544415d109f3bc) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Fixes cookies set via `Astro.cookies.set()` inside a custom `404.astro` or `500.astro` error page being silently dropped from the final response + +- [#17579](https://github.com/withastro/astro/pull/17579) [`3ea55ce`](https://github.com/withastro/astro/commit/3ea55ce24024af7dc6ec3dcdde2f8af6ab5707d8) Thanks [@bluwy](https://github.com/bluwy)! - Supports the `devEngines` field in package.json when detecting the package manager for install commands + +- [#17422](https://github.com/withastro/astro/pull/17422) [`e4e2037`](https://github.com/withastro/astro/commit/e4e20374f55c3338e4bd22275a8ad265f1c24cbf) Thanks [@jiwonyoon-dev](https://github.com/jiwonyoon-dev)! - Fixes `popover` being rendered as `popover="true"`/`popover="false"` on custom elements (tag names containing a hyphen). Per the Popover API, the attribute only accepts `"auto"`, `"manual"`, or being absent, so boolean values are now always rendered as a bare `popover` attribute (or omitted), regardless of the tag name. + ## 7.1.6 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 2c2809255eef..325fc7c520c9 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "7.1.6", + "version": "7.2.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/astro/src/core/middleware/vite-plugin.ts b/packages/astro/src/core/middleware/vite-plugin.ts index d98bfc5128c3..58c21744e4a6 100644 --- a/packages/astro/src/core/middleware/vite-plugin.ts +++ b/packages/astro/src/core/middleware/vite-plugin.ts @@ -1,9 +1,4 @@ -import { fileURLToPath } from 'node:url'; -import { - normalizePath as viteNormalizePath, - type ViteDevServer, - type Plugin as VitePlugin, -} from 'vite'; +import type { Plugin as VitePlugin } from 'vite'; import { getServerOutputDirectory } from '../../prerender/utils.js'; import type { AstroSettings } from '../../types/astro.js'; import { addRolldownInput } from '../build/add-rolldown-input.js'; @@ -13,6 +8,7 @@ import { ASTRO_VITE_ENVIRONMENT_NAMES, MIDDLEWARE_PATH_SEGMENT_NAME } from '../c import { MissingMiddlewareForInternationalization } from '../errors/errors-data.js'; import { AstroError } from '../errors/index.js'; import { normalizePath } from '../viteUtils.js'; +import { isAstroServerEnvironment } from '../../environments.js'; // This module name is used in Cloudflare's optimizedDeps configuration, // if th name changes that needs to be updated as well. @@ -33,8 +29,6 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): settings.middlewares.pre.length > 0 || settings.middlewares.post.length > 0; let userMiddlewareIsPresent = false; - const normalizedSrcDir = viteNormalizePath(fileURLToPath(settings.config.srcDir)); - return { name: '@astro/plugin-middleware', applyToEnvironment(environment) { @@ -44,29 +38,18 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender ); }, - configureServer(server: ViteDevServer) { - server.watcher.on('change', (path) => { - const normalizedPath = viteNormalizePath(path); - // Check if the changed file is a middleware file under srcDir - if (!normalizedPath.startsWith(normalizedSrcDir)) return; - const relativePath = normalizedPath.slice(normalizedSrcDir.length); - if (!isMiddlewarePath(relativePath)) return; - - for (const name of [ - ASTRO_VITE_ENVIRONMENT_NAMES.ssr, - ASTRO_VITE_ENVIRONMENT_NAMES.astro, - ] as const) { - const environment = server.environments[name]; - if (!environment) continue; - - const virtualMod = environment.moduleGraph.getModuleById(MIDDLEWARE_RESOLVED_MODULE_ID); - if (virtualMod) { - environment.moduleGraph.invalidateModule(virtualMod); - } + hotUpdate: { + handler() { + if (!isAstroServerEnvironment(this.environment)) return; - environment.hot.send('astro:middleware-updated', {}); - } - }); + const middlewareVirtualMod = this.environment.moduleGraph.getModuleById( + MIDDLEWARE_RESOLVED_MODULE_ID, + ); + if (!middlewareVirtualMod) return; + + this.environment.moduleGraph.invalidateModule(middlewareVirtualMod); + this.environment.hot.send('astro:middleware-updated', {}); + }, }, resolveId: { filter: { diff --git a/packages/astro/test/fixtures/hmr-middleware/astro.config.mjs b/packages/astro/test/fixtures/hmr-middleware/astro.config.mjs new file mode 100644 index 000000000000..86dbfb924824 --- /dev/null +++ b/packages/astro/test/fixtures/hmr-middleware/astro.config.mjs @@ -0,0 +1,3 @@ +import { defineConfig } from 'astro/config'; + +export default defineConfig({}); diff --git a/packages/astro/test/fixtures/hmr-middleware/package.json b/packages/astro/test/fixtures/hmr-middleware/package.json new file mode 100644 index 000000000000..1893ec9cb9c2 --- /dev/null +++ b/packages/astro/test/fixtures/hmr-middleware/package.json @@ -0,0 +1,8 @@ +{ + "name": "@test/hmr-middleware", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*" + } +} diff --git a/packages/astro/test/fixtures/hmr-middleware/src/middleware.js b/packages/astro/test/fixtures/hmr-middleware/src/middleware.js new file mode 100644 index 000000000000..2d9d6d81db3d --- /dev/null +++ b/packages/astro/test/fixtures/hmr-middleware/src/middleware.js @@ -0,0 +1,16 @@ +import { defineMiddleware } from "astro:middleware"; +import { MiscUtils } from "./utils/misc"; + +let executed = 0; + +export const onRequest = defineMiddleware(async (context, next) => { + context.locals.utils = new MiscUtils(); + + // add newline here + executed += 1; + + return next().then((res) => { + res.headers.set("x-test-executed", executed); + res.headers.set("x-test-other-count", context.locals.utils.nestedImportCount()) + }); +}); diff --git a/packages/astro/test/fixtures/hmr-middleware/src/pages/index.astro b/packages/astro/test/fixtures/hmr-middleware/src/pages/index.astro new file mode 100644 index 000000000000..37d55e639ed6 --- /dev/null +++ b/packages/astro/test/fixtures/hmr-middleware/src/pages/index.astro @@ -0,0 +1,17 @@ +--- +const title = Astro.locals.utils.arrayToString(["Hello", "Astro"]); +--- + + + + + + + + + {title} + + +

{title}

+ + diff --git a/packages/astro/test/fixtures/hmr-middleware/src/utils/misc.js b/packages/astro/test/fixtures/hmr-middleware/src/utils/misc.js new file mode 100644 index 000000000000..d537a9e33041 --- /dev/null +++ b/packages/astro/test/fixtures/hmr-middleware/src/utils/misc.js @@ -0,0 +1,11 @@ +import { getCount } from "./other"; + +export class MiscUtils { + nestedImportCount() { + return getCount(); + } + + arrayToString(arr) { + return arr.join(" "); + } +} diff --git a/packages/astro/test/fixtures/hmr-middleware/src/utils/other.js b/packages/astro/test/fixtures/hmr-middleware/src/utils/other.js new file mode 100644 index 000000000000..c3e0c3c50664 --- /dev/null +++ b/packages/astro/test/fixtures/hmr-middleware/src/utils/other.js @@ -0,0 +1,6 @@ +let count = 0; + +export const getCount = () => { + count += 1; + return count; +} diff --git a/packages/astro/test/middleware.test.ts b/packages/astro/test/middleware.test.ts index 53f1527a481a..33a801fc1e54 100644 --- a/packages/astro/test/middleware.test.ts +++ b/packages/astro/test/middleware.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { existsSync, readFileSync } from 'node:fs'; -import { after, before, describe, it } from 'node:test'; +import { after, afterEach, before, beforeEach, describe, it } from 'node:test'; import { fileURLToPath } from 'node:url'; import * as cheerio from 'cheerio'; import testAdapter from './test-adapter.ts'; @@ -196,3 +196,84 @@ describe('Middleware with tailwind', () => { assert.equal(bundledCSS.includes('--tw'), true); }); }); + +describe('Middleware HMR', () => { + let fixture: Fixture; + let devServer: DevServer; + + beforeEach(async () => { + fixture = await loadFixture({ + root: './fixtures/hmr-middleware/', + outDir: './dist/middleware-middleware-hmr/', + }); + + devServer = await fixture.startDevServer(); + }); + + afterEach(async () => { + await devServer.stop(); + fixture.resetAllFiles(); + }); + + const fetchAndAssertTwice = async () => { + let response = await fixture.fetch('/'); + assert.equal(response.headers.get('x-test-executed'), '1'); + assert.equal(response.headers.get('x-test-other-count'), '1'); + + response = await fixture.fetch('/'); + assert.equal(response.headers.get('x-test-executed'), '2'); + assert.equal(response.headers.get('x-test-other-count'), '2'); + + return response; + }; + + it('should perform HMR on middleware.js', async () => { + await fetchAndAssertTwice(); + + await fixture.editFile('./src/middleware.js', (original) => + original.replace('add newline here', 'add newline here\n'), + ); + + await new Promise((resolve) => setTimeout(resolve, 2000)); + + // src/middleware.js should reload + // src/utils/other.js shouldn't reload + const response = await fixture.fetch('/'); + assert.equal(response.headers.get('x-test-executed'), '1'); + assert.equal(response.headers.get('x-test-other-count'), '3'); + }); + + it('should perform HMR on modules imported by middleware.js', async () => { + let response = await fetchAndAssertTwice(); + assert.ok((await response.text()).includes('Hello Astro')); + + await fixture.editFile('./src/utils/misc.js', (original) => + original.replace('join(" ")', 'join(" - ")'), + ); + + await new Promise((resolve) => setTimeout(resolve, 2000)); + + // src/utils/misc.js should reload, as should src/middleware.js + // src/pages/index.astro should therefore receive the new instance of MiscUtils + // src/utils/other.js shouldn't reload + response = await fixture.fetch('/'); + assert.equal(response.headers.get('x-test-executed'), '1'); + assert.equal(response.headers.get('x-test-other-count'), '3'); + assert.ok((await response.text()).includes('Hello - Astro')); + }); + + it('should perform HMR on nested modules imported by middleware.js', async () => { + await fetchAndAssertTwice(); + + await fixture.editFile('./src/utils/other.js', (original) => + original.replace('let count = 0;', 'let count = 0;\n//foo\n'), + ); + + await new Promise((resolve) => setTimeout(resolve, 2000)); + + // src/utils/other.js should reload, as should src/middleware.js + const response = await fixture.fetch('/'); + assert.equal(response.headers.get('x-test-executed'), '1'); + assert.equal(response.headers.get('x-test-other-count'), '1'); + }); +}); diff --git a/packages/integrations/cloudflare/CHANGELOG.md b/packages/integrations/cloudflare/CHANGELOG.md index 29c3ca85a4c9..c5bb4354a238 100644 --- a/packages/integrations/cloudflare/CHANGELOG.md +++ b/packages/integrations/cloudflare/CHANGELOG.md @@ -1,5 +1,44 @@ # @astrojs/cloudflare +## 14.2.0 + +### Minor Changes + +- [#16194](https://github.com/withastro/astro/pull/16194) [`2a59663`](https://github.com/withastro/astro/commit/2a59663984cfc33e96ff8e1019805c396030b01d) Thanks [@Daedalus-Icarus](https://github.com/Daedalus-Icarus)! - Adds opt-in build-time image optimization for the `cloudflare-binding` image service. + + When enabled, the Cloudflare IMAGES binding transforms static images in the workerd prerender environment, and the optimized bytes are written directly to the output directory. If the binding fails, it falls back to Sharp. + + To opt in, use the compound configuration form: + + ```js + export default defineConfig({ + adapter: cloudflare({ + imageService: { build: 'cloudflare-binding', runtime: 'cloudflare-binding' }, + }), + }); + ``` + + The string shorthand `imageService: 'cloudflare-binding'` preserves the current runtime-only behavior and is unaffected. + +- [#16871](https://github.com/withastro/astro/pull/16871) [`90c98ae`](https://github.com/withastro/astro/commit/90c98ae21ef0444a4088b7081676b0f97915001f) Thanks [@adamchal](https://github.com/adamchal)! - When `session: false` is set in `astro.config`, the adapter no longer auto-wires the Cloudflare KV session driver. Combined with the matching `astro` change, this lets the session runtime tree-shake out of the Worker bundle. + +- [#17084](https://github.com/withastro/astro/pull/17084) [`961bbe5`](https://github.com/withastro/astro/commit/961bbe5fdf4a761adb479595dfb94dc2e80f2957) Thanks [@matthewp](https://github.com/matthewp)! - Supports Astro's experimental [incremental static builds](https://docs.astro.build/en/reference/experimental-flags/incremental-build/). When `experimental.incrementalBuild` is enabled, the adapter skips unchanged pages between builds. + +### Patch Changes + +- [#17576](https://github.com/withastro/astro/pull/17576) [`0a79753`](https://github.com/withastro/astro/commit/0a79753610ff4960ae6c9e6e334115f6ea0bc954) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes `/_image` returning 500 in dev mode when using `imageService: 'custom'`. Astro's default dev image endpoint imports `vite` and `node:fs`, which cannot be loaded inside workerd. The `custom` and fallback cases now use the generic fetch-based endpoint in dev, matching the other image service modes. A user-configured `image.endpoint` is left untouched. + + Additionally, a dev-time warning is now logged when `imageService: 'custom'` resolves to the Sharp service (including when no `image.service` is configured), since Sharp's native binding cannot run inside workerd in dev or production. + +- [#17481](https://github.com/withastro/astro/pull/17481) [`0c32649`](https://github.com/withastro/astro/commit/0c32649d378600884f3977300d21cabe58090a97) Thanks [@ondraulehla](https://github.com/ondraulehla)! - Fixes a crash on `/_image` cache hits when the Cloudflare cache provider is enabled. Responses served from the Workers Cache API have immutable headers, and the request handler crashed with "Can't modify immutable headers" when applying its default `Cloudflare-CDN-Cache-Control: no-store` header to them. The handler now rebuilds the response with mutable headers when needed. + +- [#17347](https://github.com/withastro/astro/pull/17347) [`ce83c39`](https://github.com/withastro/astro/commit/ce83c3974447dbc0f84ddb7f10ff8b5aaceeab59) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Fixes `imageService: 'compile'` producing unoptimized images when `prerenderEnvironment` is set to `'node'` + +- [#17594](https://github.com/withastro/astro/pull/17594) [`2b8915a`](https://github.com/withastro/astro/commit/2b8915a6482f6a5f0ab76e14816080b9fa1b7aae) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Fixes a type-checking error when using `app.use(cf())` from `@astrojs/cloudflare/hono` in projects with `wrangler types`-generated `ExecutionContext` declarations + +- Updated dependencies []: + - @astrojs/underscore-redirects@1.0.3 + ## 14.1.7 ### Patch Changes diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index a102aed9795e..2e9258ec394b 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/cloudflare", "description": "Deploy your site to Cloudflare Workers", - "version": "14.1.7", + "version": "14.2.0", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/integrations/netlify/CHANGELOG.md b/packages/integrations/netlify/CHANGELOG.md index fd52711c1b7b..2e452a3fcdab 100644 --- a/packages/integrations/netlify/CHANGELOG.md +++ b/packages/integrations/netlify/CHANGELOG.md @@ -1,5 +1,16 @@ # @astrojs/netlify +## 8.2.0 + +### Minor Changes + +- [#16871](https://github.com/withastro/astro/pull/16871) [`90c98ae`](https://github.com/withastro/astro/commit/90c98ae21ef0444a4088b7081676b0f97915001f) Thanks [@adamchal](https://github.com/adamchal)! - When `session: false` is set in `astro.config`, the adapter no longer auto-wires the Netlify Blobs session driver. Combined with the matching `astro` change, this lets the session runtime tree-shake out of the function bundle. + +### Patch Changes + +- Updated dependencies []: + - @astrojs/underscore-redirects@1.0.3 + ## 8.1.3 ### Patch Changes diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index b86b27de032a..fee3efa30c6c 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/netlify", "description": "Deploy your site to Netlify", - "version": "8.1.3", + "version": "8.2.0", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index a52f4a545898..ac266385d139 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,15 @@ # @astrojs/node +## 11.1.0 + +### Minor Changes + +- [#16871](https://github.com/withastro/astro/pull/16871) [`90c98ae`](https://github.com/withastro/astro/commit/90c98ae21ef0444a4088b7081676b0f97915001f) Thanks [@adamchal](https://github.com/adamchal)! - When `session: false` is set in `astro.config`, the adapter no longer auto-wires the filesystem session driver. Combined with the matching `astro` change, this lets the session runtime tree-shake out of the server bundle. + +### Patch Changes + +- [#17564](https://github.com/withastro/astro/pull/17564) [`004fb0a`](https://github.com/withastro/astro/commit/004fb0a01ebf8ca05035de705e8f84a3bc965b5d) Thanks [@dmgawel](https://github.com/dmgawel)! - Fixes middleware mode routing when a prerendered dynamic route sorts before an on-demand fallback + ## 11.0.3 ### Patch Changes diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 3c4d07f5cf02..672d4df7b96c 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/node", "description": "Deploy your site to a Node.js server", - "version": "11.0.3", + "version": "11.1.0", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/integrations/solid/CHANGELOG.md b/packages/integrations/solid/CHANGELOG.md index 8f86bb7fd469..4ee613136310 100644 --- a/packages/integrations/solid/CHANGELOG.md +++ b/packages/integrations/solid/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/solid-js +## 7.0.2 + +### Patch Changes + +- [#17584](https://github.com/withastro/astro/pull/17584) [`5462b81`](https://github.com/withastro/astro/commit/5462b81b8c13552a78131494ccf649b2d92b2968) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Fixes a build crash when a Solid island imports a package that ships pre-compiled browser artifacts via the `exports.solid` condition (e.g. `@kobalte/core`). Solid ecosystem packages are now bundled in non-client environments so that Vite resolves the correct export condition during prerendering. + ## 7.0.1 ### Patch Changes diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json index 008caca734a9..f71ce1645e9a 100644 --- a/packages/integrations/solid/package.json +++ b/packages/integrations/solid/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/solid-js", - "version": "7.0.1", + "version": "7.0.2", "description": "Use Solid components within Astro", "type": "module", "author": "withastro", diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md index 57572a81ca67..89b94d516155 100644 --- a/packages/integrations/vercel/CHANGELOG.md +++ b/packages/integrations/vercel/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/vercel +## 11.0.5 + +### Patch Changes + +- [#17569](https://github.com/withastro/astro/pull/17569) [`d1bb7fa`](https://github.com/withastro/astro/commit/d1bb7fa0059a04ed8039ce92660c7c07a8b04914) Thanks [@lazerg](https://github.com/lazerg)! - Prevents `astro build` from crashing with `EEXIST` when `.vercel/output/server/` already exists by creating it with `{ recursive: true }`, matching the sibling `static/` directory call + ## 11.0.4 ### Patch Changes diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index e1006d2886bd..a0e30894d39f 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/vercel", "description": "Deploy your site to Vercel", - "version": "11.0.4", + "version": "11.0.5", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/integrations/vue/CHANGELOG.md b/packages/integrations/vue/CHANGELOG.md index 94f2bd7d548b..3287a2ee5323 100644 --- a/packages/integrations/vue/CHANGELOG.md +++ b/packages/integrations/vue/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/vue +## 7.0.2 + +### Patch Changes + +- [#17515](https://github.com/withastro/astro/pull/17515) [`023e7be`](https://github.com/withastro/astro/commit/023e7be21edd9327a9966651a706dcadd5aa9893) Thanks [@barry166](https://github.com/barry166)! - Fix dev server crashes when Vue devtools are enabled with Vite 8. + ## 7.0.1 ### Patch Changes diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index d8e34390db0f..cd7cd6c75ee2 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/vue", - "version": "7.0.1", + "version": "7.0.2", "description": "Use Vue components within Astro", "type": "module", "author": "withastro", diff --git a/packages/upgrade/CHANGELOG.md b/packages/upgrade/CHANGELOG.md index d5d7873ee7cc..cdd3ce252c98 100644 --- a/packages/upgrade/CHANGELOG.md +++ b/packages/upgrade/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/upgrade +## 0.7.4 + +### Patch Changes + +- [#17579](https://github.com/withastro/astro/pull/17579) [`3ea55ce`](https://github.com/withastro/astro/commit/3ea55ce24024af7dc6ec3dcdde2f8af6ab5707d8) Thanks [@bluwy](https://github.com/bluwy)! - Supports the `devEngines` field in package.json when detecting the package manager for install commands + ## 0.7.3 ### Patch Changes diff --git a/packages/upgrade/package.json b/packages/upgrade/package.json index 313295449f0e..ab712f89dc93 100644 --- a/packages/upgrade/package.json +++ b/packages/upgrade/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/upgrade", - "version": "0.7.3", + "version": "0.7.4", "type": "module", "author": "withastro", "license": "MIT", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f3a884a759d..023d6a45f7be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -385,10 +385,10 @@ importers: examples/advanced-routing: dependencies: '@astrojs/node': - specifier: ^11.0.3 + specifier: ^11.1.0 version: link:../../packages/integrations/node astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro hono: specifier: ^4.12.14 @@ -397,7 +397,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/blog: @@ -412,7 +412,7 @@ importers: specifier: ^3.7.3 version: link:../../packages/integrations/sitemap astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro sharp: specifier: ^0.35.0 @@ -421,7 +421,7 @@ importers: examples/component: devDependencies: astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/container-with-vitest: @@ -430,7 +430,7 @@ importers: specifier: ^6.0.2 version: link:../../packages/integrations/react astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -461,7 +461,7 @@ importers: specifier: ^3.15.8 version: 3.15.8 astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/framework-multiple: @@ -473,13 +473,13 @@ importers: specifier: ^6.0.2 version: link:../../packages/integrations/react '@astrojs/solid-js': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/solid '@astrojs/svelte': specifier: ^9.0.1 version: link:../../packages/integrations/svelte '@astrojs/vue': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/vue '@types/react': specifier: ^18.3.28 @@ -488,7 +488,7 @@ importers: specifier: ^18.3.7 version: 18.3.7(@types/react@18.3.28) astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro preact: specifier: ^10.28.4 @@ -518,7 +518,7 @@ importers: specifier: ^2.8.1 version: 2.8.2(preact@10.29.0) astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro preact: specifier: ^10.28.4 @@ -536,7 +536,7 @@ importers: specifier: ^18.3.7 version: 18.3.7(@types/react@18.3.28) astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -548,10 +548,10 @@ importers: examples/framework-solid: dependencies: '@astrojs/solid-js': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/solid astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro solid-js: specifier: ^1.9.11 @@ -563,7 +563,7 @@ importers: specifier: ^9.0.1 version: link:../../packages/integrations/svelte astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro svelte: specifier: ^5.53.5 @@ -572,10 +572,10 @@ importers: examples/framework-vue: dependencies: '@astrojs/vue': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/vue astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro vue: specifier: ^3.5.29 @@ -584,40 +584,40 @@ importers: examples/hackernews: dependencies: '@astrojs/node': - specifier: ^11.0.3 + specifier: ^11.1.0 version: link:../../packages/integrations/node astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/minimal: dependencies: astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/ssr: dependencies: '@astrojs/node': - specifier: ^11.0.3 + specifier: ^11.1.0 version: link:../../packages/integrations/node '@astrojs/svelte': specifier: ^9.0.1 version: link:../../packages/integrations/svelte astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro svelte: specifier: ^5.53.5 @@ -626,7 +626,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro sass: specifier: ^1.97.3 @@ -641,7 +641,7 @@ importers: specifier: ^22.19.0 version: 22.19.19 astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/with-markdoc: @@ -650,7 +650,7 @@ importers: specifier: ^2.0.6 version: link:../../packages/integrations/markdoc astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro examples/with-mdx: @@ -662,7 +662,7 @@ importers: specifier: ^6.0.2 version: link:../../packages/integrations/preact astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro preact: specifier: ^10.28.4 @@ -677,7 +677,7 @@ importers: specifier: ^1.0.0 version: 1.0.0(nanostores@1.1.1)(preact@10.29.0) astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro nanostores: specifier: ^1.1.1 @@ -698,7 +698,7 @@ importers: specifier: ^1.9.0 version: 1.9.0 astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro canvas-confetti: specifier: ^1.9.4 @@ -713,7 +713,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^7.1.6 + specifier: ^7.2.0 version: link:../../packages/astro vitest: specifier: ^5.0.0-beta.2 @@ -3408,6 +3408,12 @@ importers: specifier: workspace:* version: link:../../.. + packages/astro/test/fixtures/hmr-middleware: + dependencies: + astro: + specifier: workspace:* + version: link:../../.. + packages/astro/test/fixtures/hmr-new-page: dependencies: astro: