diff options
49 files changed, 339 insertions, 113 deletions
diff --git a/.changeset/pre.json b/.changeset/pre.json index 50eeffb37..9e9ee0ffa 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -32,15 +32,30 @@ "@astrojs/upgrade": "0.3.1" }, "changesets": [ + "blue-boats-relax", "chatty-teachers-sit", + "eighty-boxes-applaud", + "fair-rats-fail", + "healthy-ads-scream", + "itchy-toys-march", + "long-months-burn", + "many-garlics-lick", "mighty-trees-teach", + "modern-bears-deny", "new-pillows-kick", + "odd-donuts-impress", + "perfect-fans-fly", "poor-frogs-dream", "quick-ads-exercise", + "selfish-impalas-grin", "small-ties-sort", "smart-comics-doubt", + "smooth-melons-cough", "spicy-houses-fry", + "spotty-garlics-cheat", "ten-students-repair", - "weak-dancers-beam" + "tiny-lamps-lick", + "weak-dancers-beam", + "weak-masks-do" ] } diff --git a/examples/basics/package.json b/examples/basics/package.json index 3390c8634..a2ea00426 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index e3c9c3bb9..d71b25773 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^4.0.0-alpha.0", + "@astrojs/mdx": "^4.0.0-alpha.1", "@astrojs/rss": "^4.0.7", "@astrojs/sitemap": "^3.1.6", - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/component/package.json b/examples/component/package.json index 9ef977a49..95330b51d 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index b062065f6..d3bfa492e 100644 --- a/examples/container-with-vitest/package.json +++ b/examples/container-with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest run" }, "dependencies": { - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "@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 3d494a88f..3f708ecd2 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": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index ec4d835ec..d8401e1ea 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -18,7 +18,7 @@ "@astrojs/vue": "^5.0.0-alpha.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "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 c2635c093..3378f2176 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.1", "@preact/signals": "^1.3.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "preact": "^10.23.2" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index f1585c4c1..2169c8d1b 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.3", "@types/react-dom": "^18.3.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 05e6ec738..497e1c053 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": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "solid-js": "^1.8.21" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 1cec15cbc..1b574a393 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^6.0.0-alpha.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "svelte": "^4.2.18" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index ad8546684..a15c97ed9 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/vue": "^5.0.0-alpha.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "vue": "^3.4.38" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 4b6a2af10..16c6db424 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^9.0.0-alpha.0", - "astro": "^5.0.0-alpha.0" + "@astrojs/node": "^9.0.0-alpha.1", + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 2b5f62ef3..7932238e5 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index 4c7fa55de..6cb2acf33 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -12,8 +12,8 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^9.0.0-alpha.0", - "astro": "^5.0.0-alpha.0", + "@astrojs/node": "^9.0.0-alpha.1", + "astro": "^5.0.0-alpha.1", "html-minifier": "^4.0.0" }, "devDependencies": { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index d18bbd27a..e139db2f6 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index f5e09395a..a56c8c1cc 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index b0620901e..0d1550845 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/server-islands/package.json b/examples/server-islands/package.json index 96ac136ab..72b53fda8 100644 --- a/examples/server-islands/package.json +++ b/examples/server-islands/package.json @@ -10,14 +10,14 @@ "astro": "astro" }, "devDependencies": { - "@astrojs/node": "^9.0.0-alpha.0", + "@astrojs/node": "^9.0.0-alpha.1", "@astrojs/react": "^3.6.2", "@astrojs/tailwind": "^6.0.0-alpha.0", "@fortawesome/fontawesome-free": "^6.6.0", "@tailwindcss/forms": "^0.5.7", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "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 cb9e2a4cb..ba422fa90 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,9 +12,9 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^9.0.0-alpha.0", + "@astrojs/node": "^9.0.0-alpha.1", "@astrojs/svelte": "^6.0.0-alpha.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "svelte": "^4.2.18" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index 9e03a65ad..45d298fac 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "sass": "^1.77.8", "sharp": "^0.33.3" } diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index fb8551ae6..a7976df55 100644 --- a/examples/toolbar-app/package.json +++ b/examples/toolbar-app/package.json @@ -15,6 +15,6 @@ "./app": "./dist/app.js" }, "devDependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index f568ec7a1..3a3b67d8e 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@astrojs/tailwind": "^6.0.0-alpha.0", - "@astrojs/node": "^9.0.0-alpha.0", - "astro": "^5.0.0-alpha.0" + "@astrojs/node": "^9.0.0-alpha.1", + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 23a78a6ac..36fdb3422 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/markdoc": "^1.0.0-alpha.0", - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index f44497713..528121e74 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^6.0.0-alpha.0", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "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 1e5a875cc..978a76969 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.0" + "astro": "^5.0.0-alpha.1" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index d5d61d16d..3e16ae7e0 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^4.0.0-alpha.0", + "@astrojs/mdx": "^4.0.0-alpha.1", "@astrojs/preact": "^3.5.1", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "preact": "^10.23.2" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index db6080d09..801e23b91 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.1", "@nanostores/preact": "^0.5.2", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "nanostores": "^0.11.2", "preact": "^10.23.2" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 5fc07f1de..368c7ca9f 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -11,10 +11,10 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^4.0.0-alpha.0", + "@astrojs/mdx": "^4.0.0-alpha.1", "@astrojs/tailwind": "^6.0.0-alpha.0", "@types/canvas-confetti": "^1.6.4", - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "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 40ea3ea32..c8462a1d2 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^5.0.0-alpha.0", + "astro": "^5.0.0-alpha.1", "vitest": "^2.0.5" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 1a9256585..cbd3aedc0 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,136 @@ # astro +## 5.0.0-alpha.1 + +### Major Changes + +- [#11798](https://github.com/withastro/astro/pull/11798) [`e9e2139`](https://github.com/withastro/astro/commit/e9e2139bf788893566f5a3fe58daf1d24076f018) Thanks [@matthewp](https://github.com/matthewp)! - Unflag globalRoutePriority + + The previously [experimental feature `globalRoutePriority`](https://docs.astro.build/en/reference/configuration-reference/#experimentalglobalroutepriority) is now the default in Astro 5. + + This was a refactoring of route prioritization in Astro, making it so that injected routes, file-based routes, and redirects are all prioritized using the same logic. This feature has been enabled for all Starlight projects since it was added and should not affect most users. + +- [#11679](https://github.com/withastro/astro/pull/11679) [`ea71b90`](https://github.com/withastro/astro/commit/ea71b90c9c08ddd1d3397c78e2e273fb799f7dbd) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - The [`astro:env` feature introduced behind a flag](https://docs.astro.build/en/reference/configuration-reference/#experimentalglobalroutepriority) in [v4.10.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#x4100) is no longer experimental and is available for general use. If you have been waiting for stabilization before using `astro:env`, you can now do so. + + This feature lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. + + To configure a schema, add the `env` option to your Astro config and define your client and server variables. If you were previously using this feature, please remove the experimental flag from your Astro config and move your entire `env` configuration unchanged to a top-level option. + + ```js + import { defineConfig, envField } from 'astro/config'; + + export default defineConfig({ + env: { + schema: { + API_URL: envField.string({ context: 'client', access: 'public', optional: true }), + PORT: envField.number({ context: 'server', access: 'public', default: 4321 }), + API_SECRET: envField.string({ context: 'server', access: 'secret' }), + }, + }, + }); + ``` + + You can import and use your defined variables from the appropriate `/client` or `/server` module: + + ```astro + --- + import { API_URL } from 'astro:env/client'; + import { API_SECRET_TOKEN } from 'astro:env/server'; + + const data = await fetch(`${API_URL}/users`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${API_SECRET_TOKEN}`, + }, + }); + --- + + <script> + import { API_URL } from 'astro:env/client'; + + fetch(`${API_URL}/ping`); + </script> + ``` + + +- [#11788](https://github.com/withastro/astro/pull/11788) [`7c0ccfc`](https://github.com/withastro/astro/commit/7c0ccfc26947b178584e3476584bcaa490c6ba86) Thanks [@ematipico](https://github.com/ematipico)! - Updates the default value of `security.checkOrigin` to `true`, which enables Cross-Site Request Forgery (CSRF) protection by default for pages rendered on demand. + + If you had previously configured `security.checkOrigin: true`, you no longer need this set in your Astro config. This is now the default and it is safe to remove. + + To disable this behavior and opt out of automatically checking that the “origin” header matches the URL sent by each request, you must explicitly set `security.checkOrigin: false`: + + ```diff + export default defineConfig({ + + security: { + + checkOrigin: false + + } + }) + ``` + +- [#11741](https://github.com/withastro/astro/pull/11741) [`6617491`](https://github.com/withastro/astro/commit/6617491c3bc2bde87f7867d7dec2580781852cfc) Thanks [@bluwy](https://github.com/bluwy)! - Removes internal JSX handling and moves the responsibility to the `@astrojs/mdx` package directly. The following exports are also now removed: + + - `astro/jsx/babel.js` + - `astro/jsx/component.js` + - `astro/jsx/index.js` + - `astro/jsx/renderer.js` + - `astro/jsx/server.js` + - `astro/jsx/transform-options.js` + + If your project includes `.mdx` files, you must upgrade `@astrojs/mdx` to the latest version so that it doesn't rely on these entrypoints to handle your JSX. + +- [#11782](https://github.com/withastro/astro/pull/11782) [`9a2aaa0`](https://github.com/withastro/astro/commit/9a2aaa01ea427df3844bce8595207809a8d2cb94) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Makes the `compiledContent` property of Markdown content an async function, this change should fix underlying issues where sometimes when using a custom image service and images inside Markdown, Node would exit suddenly without any error message. + + ```diff + --- + import * as myPost from "../post.md"; + + - const content = myPost.compiledContent(); + + const content = await myPost.compiledContent(); + --- + + <Fragment set:html={content} /> + ``` + +- [#11770](https://github.com/withastro/astro/pull/11770) [`cfa6a47`](https://github.com/withastro/astro/commit/cfa6a47ac7a541f99fdad46a68d0cca6e5816cd5) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro. + + Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained. + + ```diff + - import { squooshImageService } from "astro/config"; + import { defineConfig } from "astro/config"; + + export default defineConfig({ + - image: { + - service: squooshImageService() + - } + }); + ``` + + If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh + +### Patch Changes + +- [#11780](https://github.com/withastro/astro/pull/11780) [`c6622ad`](https://github.com/withastro/astro/commit/c6622adaeb405e961b12c91f0e5d02c7333d01cf) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Deprecates the Squoosh image service, to be removed in Astro 5.0. We recommend migrating to the default Sharp service. + +- [#11732](https://github.com/withastro/astro/pull/11732) [`4cd6c43`](https://github.com/withastro/astro/commit/4cd6c43e221e40345dfb433f9c63395f886091fd) Thanks [@matthewp](https://github.com/matthewp)! - Use GET requests with preloading for Server Islands + + Server Island requests include the props used to render the island as well as any slots passed in (excluding the fallback slot). Since browsers have a max 4mb URL length we default to using a POST request to avoid overflowing this length. + + However in reality most usage of Server Islands are fairly isolated and won't exceed this limit, so a GET request is possible by passing this same information via search parameters. + + Using GET means we can also include a `<link rel="preload">` tag to speed up the request. + + This change implements this, with safe fallback to POST. + +- [#11773](https://github.com/withastro/astro/pull/11773) [`86a3391`](https://github.com/withastro/astro/commit/86a33915ff41b23ff6b35bcfb1805fefc0760ca7) Thanks [@ematipico](https://github.com/ematipico)! - Changes messages logged when using unsupported, deprecated, or experimental adapter features for clarity + +- [#11774](https://github.com/withastro/astro/pull/11774) [`c6400ab`](https://github.com/withastro/astro/commit/c6400ab99c5e5f4477bc6ef7e801b7869b0aa9ab) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes the path returned by `injectTypes` + +- [#11771](https://github.com/withastro/astro/pull/11771) [`49650a4`](https://github.com/withastro/astro/commit/49650a45550af46c70c6cf3f848b7b529103a649) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes an error thrown by `astro sync` when an `astro:env` virtual module is imported inside the Content Collections config + +- [#11744](https://github.com/withastro/astro/pull/11744) [`b677429`](https://github.com/withastro/astro/commit/b67742961a384c10e5cd04cf5b02d0f014ea7362) Thanks [@bluwy](https://github.com/bluwy)! - Disables the WebSocket server when creating a Vite server for loading config files + ## 5.0.0-alpha.0 ### Major Changes diff --git a/packages/astro/e2e/server-islands.test.js b/packages/astro/e2e/server-islands.test.js index 6fa92f40a..b45a58cd8 100644 --- a/packages/astro/e2e/server-islands.test.js +++ b/packages/astro/e2e/server-islands.test.js @@ -51,7 +51,10 @@ test.describe('Server islands', () => { await expect(el).toHaveCount(2); }); - test('Large islands that exceed URL length still work through POST', async ({ page, astro }) => { + test('Large islands that exceed URL length still work through POST', async ({ + page, + astro, + }) => { await page.goto(astro.resolveUrl('/base/')); let el = page.locator('#basics .island'); diff --git a/packages/astro/package.json b/packages/astro/package.json index 4dabd22c8..89034d6fa 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "5.0.0-alpha.0", + "version": "5.0.0-alpha.1", "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/config/schema.ts b/packages/astro/src/core/config/schema.ts index 067790a66..4e630b196 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -82,7 +82,7 @@ export const ASTRO_CONFIG_DEFAULTS = { legacy: {}, redirects: {}, security: { - checkOrigin: true + checkOrigin: true, }, env: { schema: {}, diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index e45c926af..858c2b9f2 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -500,13 +500,7 @@ export function createRouteManifest( const redirectRoutes = createRedirectRoutes(params, routeMap, logger); const routes: RouteData[] = [ - ...[ - ...fileBasedRoutes, - ...injectedRoutes, - ...redirectRoutes - ].sort( - routeComparator, - ), + ...[...fileBasedRoutes, ...injectedRoutes, ...redirectRoutes].sort(routeComparator), ]; // Report route collisions diff --git a/packages/astro/src/core/server-islands/endpoint.ts b/packages/astro/src/core/server-islands/endpoint.ts index 153b6837f..4c04f7a6f 100644 --- a/packages/astro/src/core/server-islands/endpoint.ts +++ b/packages/astro/src/core/server-islands/endpoint.ts @@ -57,12 +57,12 @@ function badRequest(reason: string) { } async function getRequestData(request: Request): Promise<Response | RenderOptions> { - switch(request.method) { + switch (request.method) { case 'GET': { const url = new URL(request.url); const params = url.searchParams; - if(!params.has('s') || !params.has('e') || !params.has('p')) { + if (!params.has('s') || !params.has('e') || !params.has('p')) { return badRequest('Missing required query parameters.'); } @@ -79,9 +79,9 @@ async function getRequestData(request: Request): Promise<Response | RenderOption } case 'POST': { try { - const raw = await request.text(); - const data = JSON.parse(raw) as RenderOptions; - return data; + const raw = await request.text(); + const data = JSON.parse(raw) as RenderOptions; + return data; } catch { return badRequest('Request format is invalid.'); } @@ -106,7 +106,7 @@ export function createEndpoint(manifest: SSRManifest) { // Get the request data from the body or search params const data = await getRequestData(result.request); - if(data instanceof Response) { + if (data instanceof Response) { return data; } diff --git a/packages/astro/src/runtime/server/render/server-islands.ts b/packages/astro/src/runtime/server/render/server-islands.ts index 7474c891a..720efb1e8 100644 --- a/packages/astro/src/runtime/server/render/server-islands.ts +++ b/packages/astro/src/runtime/server/render/server-islands.ts @@ -81,26 +81,33 @@ export function renderServerIsland( const hostId = crypto.randomUUID(); const slash = result.base.endsWith('/') ? '' : '/'; - let serverIslandUrl = `${result.base}${slash}_server-islands/${componentId}${result.trailingSlash === 'always' ? '/' : ''}`; + let serverIslandUrl = `${result.base}${slash}_server-islands/${componentId}${result.trailingSlash === 'always' ? '/' : ''}`; // Determine if its safe to use a GET request - const potentialSearchParams = createSearchParams(componentExport, propsEncrypted, safeJsonStringify(renderedSlots)); - const useGETRequest =isWithinURLLimit(serverIslandUrl, potentialSearchParams); - - if(useGETRequest) { - serverIslandUrl += ('?' + potentialSearchParams.toString()); - destination.write(`<link rel="preload" as="fetch" href="${serverIslandUrl}" crossorigin="anonymous">`); + const potentialSearchParams = createSearchParams( + componentExport, + propsEncrypted, + safeJsonStringify(renderedSlots), + ); + const useGETRequest = isWithinURLLimit(serverIslandUrl, potentialSearchParams); + + if (useGETRequest) { + serverIslandUrl += '?' + potentialSearchParams.toString(); + destination.write( + `<link rel="preload" as="fetch" href="${serverIslandUrl}" crossorigin="anonymous">`, + ); } - + destination.write(`<script async type="module" data-island-id="${hostId}"> let script = document.querySelector('script[data-island-id="${hostId}"]'); -${useGETRequest ? -// GET request -`let response = await fetch('${serverIslandUrl}'); -`: -// POST request -`let data = { +${ + useGETRequest + ? // GET request + `let response = await fetch('${serverIslandUrl}'); +` + : // POST request + `let data = { componentExport: ${safeJsonStringify(componentExport)}, encryptedProps: ${safeJsonStringify(propsEncrypted)}, slots: ${safeJsonStringify(renderedSlots)}, @@ -110,7 +117,8 @@ let response = await fetch('${serverIslandUrl}', { method: 'POST', body: JSON.stringify(data), }); -`} +` +} if(response.status === 200 && response.headers.get('content-type') === 'text/html') { let html = await response.text(); diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts index 7d1b38b87..b390f181a 100644 --- a/packages/astro/src/types/public/config.ts +++ b/packages/astro/src/types/public/config.ts @@ -1444,7 +1444,6 @@ export interface AstroUserConfig { validateSecrets?: boolean; }; - /** * @docs * @kind heading diff --git a/packages/db/CHANGELOG.md b/packages/db/CHANGELOG.md index 9fcc870d3..dc8d6ac8a 100644 --- a/packages/db/CHANGELOG.md +++ b/packages/db/CHANGELOG.md @@ -1,5 +1,14 @@ # @astrojs/db +## 0.13.2-alpha.0 + +### Patch Changes + +- [#11744](https://github.com/withastro/astro/pull/11744) [`b677429`](https://github.com/withastro/astro/commit/b67742961a384c10e5cd04cf5b02d0f014ea7362) Thanks [@bluwy](https://github.com/bluwy)! - Disables the WebSocket server when creating a Vite server for loading config files + +- Updated dependencies []: + - @astrojs/studio@0.1.1 + ## 0.13.1 ### Patch Changes diff --git a/packages/db/package.json b/packages/db/package.json index 5a73940b5..7ed5c756d 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/db", - "version": "0.13.1", + "version": "0.13.2-alpha.0", "description": "Add libSQL and Astro Studio support to your Astro site", "license": "MIT", "repository": { diff --git a/packages/integrations/mdx/CHANGELOG.md b/packages/integrations/mdx/CHANGELOG.md index 10c30fbf9..3087b7a27 100644 --- a/packages/integrations/mdx/CHANGELOG.md +++ b/packages/integrations/mdx/CHANGELOG.md @@ -1,5 +1,13 @@ # @astrojs/mdx +## 4.0.0-alpha.1 + +### Minor Changes + +- [#11741](https://github.com/withastro/astro/pull/11741) [`6617491`](https://github.com/withastro/astro/commit/6617491c3bc2bde87f7867d7dec2580781852cfc) Thanks [@bluwy](https://github.com/bluwy)! - Updates adapter server entrypoint to use `@astrojs/mdx/server.js` + + This is an internal change. Handling JSX in your `.mdx` files has been moved from Astro internals and is now the responsibility of this integration. You should not notice a change in your project, and no update to your code is required. + ## 4.0.0-alpha.0 ### Patch Changes diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index 61dc87170..7b45756f6 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/mdx", "description": "Add support for MDX pages in your Astro site", - "version": "4.0.0-alpha.0", + "version": "4.0.0-alpha.1", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index 15ee56a01..044cdbead 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,28 @@ # @astrojs/node +## 9.0.0-alpha.1 + +### Major Changes + +- [#11679](https://github.com/withastro/astro/pull/11679) [`ea71b90`](https://github.com/withastro/astro/commit/ea71b90c9c08ddd1d3397c78e2e273fb799f7dbd) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds stable support for `astro:env` + +- [#11770](https://github.com/withastro/astro/pull/11770) [`cfa6a47`](https://github.com/withastro/astro/commit/cfa6a47ac7a541f99fdad46a68d0cca6e5816cd5) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro. + + Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained. + + ```diff + - import { squooshImageService } from "astro/config"; + import { defineConfig } from "astro/config"; + + export default defineConfig({ + - image: { + - service: squooshImageService() + - } + }); + ``` + + If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh + ## 9.0.0-alpha.0 ### Patch Changes diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 0df2ba55a..1528a0f3e 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": "9.0.0-alpha.0", + "version": "9.0.0-alpha.1", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md index f05d7e730..bd284a12b 100644 --- a/packages/integrations/vercel/CHANGELOG.md +++ b/packages/integrations/vercel/CHANGELOG.md @@ -1,5 +1,34 @@ # @astrojs/vercel +## 8.0.0-alpha.1 + +### Major Changes + +- [#11679](https://github.com/withastro/astro/pull/11679) [`ea71b90`](https://github.com/withastro/astro/commit/ea71b90c9c08ddd1d3397c78e2e273fb799f7dbd) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds stable support for `astro:env` + +- [#11770](https://github.com/withastro/astro/pull/11770) [`cfa6a47`](https://github.com/withastro/astro/commit/cfa6a47ac7a541f99fdad46a68d0cca6e5816cd5) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro. + + Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained. + + ```diff + - import { squooshImageService } from "astro/config"; + import { defineConfig } from "astro/config"; + + export default defineConfig({ + - image: { + - service: squooshImageService() + - } + }); + ``` + + If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh + +### Patch Changes + +- [#11783](https://github.com/withastro/astro/pull/11783) [`fc81b01`](https://github.com/withastro/astro/commit/fc81b01bcdd43646bcc615b16bf0400a646445c8) Thanks [@matthewp](https://github.com/matthewp)! - Prevent race condition with Node 18 + + Using Node 18 there can be a race condition where polyfill for the `crypto` global is not applied in time. This change ensures the polyfills run first. + ## 8.0.0-alpha.0 ### Major Changes diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index 5adb8c68f..4fab75ed0 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": "8.0.0-alpha.0", + "version": "8.0.0-alpha.1", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/integrations/web-vitals/CHANGELOG.md b/packages/integrations/web-vitals/CHANGELOG.md index 037e868a9..7c1dedac2 100644 --- a/packages/integrations/web-vitals/CHANGELOG.md +++ b/packages/integrations/web-vitals/CHANGELOG.md @@ -1,5 +1,12 @@ # @astrojs/web-vitals +## 2.0.1-alpha.0 + +### Patch Changes + +- Updated dependencies [[`b677429`](https://github.com/withastro/astro/commit/b67742961a384c10e5cd04cf5b02d0f014ea7362)]: + - @astrojs/db@0.13.2-alpha.0 + ## 2.0.0 ### Patch Changes diff --git a/packages/integrations/web-vitals/package.json b/packages/integrations/web-vitals/package.json index fcf42d536..cd806a0aa 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": "2.0.1-alpha.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.13.2-alpha.0" }, "devDependencies": { "@astrojs/db": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4563fdae5..88359b6e9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,13 +116,13 @@ importers: examples/basics: dependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/blog: dependencies: '@astrojs/mdx': - specifier: ^4.0.0-alpha.0 + specifier: ^4.0.0-alpha.1 version: link:../../packages/integrations/mdx '@astrojs/rss': specifier: ^4.0.7 @@ -131,13 +131,13 @@ importers: specifier: ^3.1.6 version: link:../../packages/integrations/sitemap astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/container-with-vitest: @@ -146,7 +146,7 @@ importers: specifier: ^3.6.2 version: link:../../packages/integrations/react astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -177,7 +177,7 @@ importers: specifier: ^3.14.1 version: 3.14.1 astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/framework-multiple: @@ -204,7 +204,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro preact: specifier: ^10.23.2 @@ -234,7 +234,7 @@ importers: specifier: ^1.3.0 version: 1.3.0(preact@10.23.2) astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro preact: specifier: ^10.23.2 @@ -252,7 +252,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -267,7 +267,7 @@ importers: specifier: ^4.4.1 version: link:../../packages/integrations/solid astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro solid-js: specifier: ^1.8.21 @@ -279,7 +279,7 @@ importers: specifier: ^6.0.0-alpha.0 version: link:../../packages/integrations/svelte astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro svelte: specifier: ^4.2.18 @@ -291,7 +291,7 @@ importers: specifier: ^5.0.0-alpha.0 version: link:../../packages/integrations/vue astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro vue: specifier: ^3.4.38 @@ -300,25 +300,25 @@ importers: examples/hackernews: dependencies: '@astrojs/node': - specifier: ^9.0.0-alpha.0 + specifier: ^9.0.0-alpha.1 version: link:../../packages/integrations/node astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/middleware: dependencies: '@astrojs/node': - specifier: ^9.0.0-alpha.0 + specifier: ^9.0.0-alpha.1 version: link:../../packages/integrations/node astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -331,25 +331,25 @@ importers: examples/minimal: dependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/server-islands: devDependencies: '@astrojs/node': - specifier: ^9.0.0-alpha.0 + specifier: ^9.0.0-alpha.1 version: link:../../packages/integrations/node '@astrojs/react': specifier: ^3.6.2 @@ -370,7 +370,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro postcss: specifier: ^8.4.41 @@ -388,13 +388,13 @@ importers: examples/ssr: dependencies: '@astrojs/node': - specifier: ^9.0.0-alpha.0 + specifier: ^9.0.0-alpha.1 version: link:../../packages/integrations/node '@astrojs/svelte': specifier: ^6.0.0-alpha.0 version: link:../../packages/integrations/svelte astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro svelte: specifier: ^4.2.18 @@ -403,7 +403,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro sass: specifier: ^1.77.8 @@ -415,19 +415,19 @@ importers: examples/toolbar-app: devDependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/view-transitions: devDependencies: '@astrojs/node': - specifier: ^9.0.0-alpha.0 + specifier: ^9.0.0-alpha.1 version: link:../../packages/integrations/node '@astrojs/tailwind': specifier: ^6.0.0-alpha.0 version: link:../../packages/integrations/tailwind astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/with-markdoc: @@ -436,7 +436,7 @@ importers: specifier: ^1.0.0-alpha.0 version: link:../../packages/integrations/markdoc astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/with-markdown-plugins: @@ -445,7 +445,7 @@ importers: specifier: ^6.0.0-alpha.0 version: link:../../packages/markdown/remark astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro hast-util-select: specifier: ^6.0.2 @@ -466,19 +466,19 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro examples/with-mdx: dependencies: '@astrojs/mdx': - specifier: ^4.0.0-alpha.0 + specifier: ^4.0.0-alpha.1 version: link:../../packages/integrations/mdx '@astrojs/preact': specifier: ^3.5.1 version: link:../../packages/integrations/preact astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro preact: specifier: ^10.23.2 @@ -493,7 +493,7 @@ importers: specifier: ^0.5.2 version: 0.5.2(nanostores@0.11.2)(preact@10.23.2) astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro nanostores: specifier: ^0.11.2 @@ -505,7 +505,7 @@ importers: examples/with-tailwindcss: dependencies: '@astrojs/mdx': - specifier: ^4.0.0-alpha.0 + specifier: ^4.0.0-alpha.1 version: link:../../packages/integrations/mdx '@astrojs/tailwind': specifier: ^6.0.0-alpha.0 @@ -514,7 +514,7 @@ importers: specifier: ^1.6.4 version: 1.6.4 astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro autoprefixer: specifier: ^10.4.20 @@ -532,7 +532,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^5.0.0-alpha.0 + specifier: ^5.0.0-alpha.1 version: link:../../packages/astro vitest: specifier: ^2.0.5 |