From 0afd36b18fdbaea72ed0b7ebc250e6a4379d7e95 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 29 Aug 2024 17:01:49 +0000 Subject: [PATCH] [ci] release (alpha) --- .changeset/pre.json | 17 ++-- examples/basics/package.json | 2 +- examples/blog/package.json | 2 +- examples/component/package.json | 2 +- examples/container-with-vitest/package.json | 2 +- examples/framework-alpine/package.json | 2 +- examples/framework-multiple/package.json | 2 +- examples/framework-preact/package.json | 2 +- examples/framework-react/package.json | 2 +- examples/framework-solid/package.json | 2 +- examples/framework-svelte/package.json | 2 +- examples/framework-vue/package.json | 2 +- examples/hackernews/package.json | 2 +- examples/integration/package.json | 2 +- examples/middleware/package.json | 2 +- examples/minimal/package.json | 2 +- examples/non-html-pages/package.json | 2 +- examples/portfolio/package.json | 2 +- examples/server-islands/package.json | 2 +- examples/ssr/package.json | 2 +- examples/starlog/package.json | 2 +- examples/toolbar-app/package.json | 2 +- examples/view-transitions/package.json | 2 +- examples/with-markdoc/package.json | 2 +- examples/with-markdown-plugins/package.json | 2 +- examples/with-markdown-shiki/package.json | 2 +- examples/with-mdx/package.json | 4 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 2 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 90 +++++++++++++++++++ packages/astro/package.json | 2 +- .../vite-plugin-content-virtual-mod.ts | 17 ++-- packages/astro/src/core/middleware/index.ts | 2 +- packages/astro/test/astro-global.test.js | 57 +++++++----- pnpm-lock.yaml | 60 ++++++------- 36 files changed, 200 insertions(+), 105 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index 9e9ee0ffa067..08d32c548b76 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -35,27 +35,22 @@ "blue-boats-relax", "chatty-teachers-sit", "eighty-boxes-applaud", - "fair-rats-fail", + "five-jars-hear", "healthy-ads-scream", "itchy-toys-march", - "long-months-burn", + "long-months-rule", "many-garlics-lick", - "mighty-trees-teach", "modern-bears-deny", - "new-pillows-kick", - "odd-donuts-impress", + "nasty-crabs-worry", + "neat-dots-hear", "perfect-fans-fly", "poor-frogs-dream", "quick-ads-exercise", "selfish-impalas-grin", + "sixty-masks-lie", "small-ties-sort", - "smart-comics-doubt", - "smooth-melons-cough", - "spicy-houses-fry", "spotty-garlics-cheat", "ten-students-repair", - "tiny-lamps-lick", - "weak-dancers-beam", - "weak-masks-do" + "twenty-cobras-push" ] } diff --git a/examples/basics/package.json b/examples/basics/package.json index a2ea0042661a..95c96866363a 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index d71b2577340f..a4ae001da37e 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^4.0.0-alpha.1", "@astrojs/rss": "^4.0.7", "@astrojs/sitemap": "^3.1.6", - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/component/package.json b/examples/component/package.json index 95330b51da42..514b0dcf0bac 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index 3c0bfef50799..f8b34ebbe858 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.1", + "astro": "^5.0.0-alpha.2", "@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 3f708ecd2f73..d1395ec3d7c3 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.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 61c2fec76942..e0fbab278492 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.1", + "astro": "^5.0.0-alpha.2", "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 e345e7d722fd..dc337e4f5609 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.2", "@preact/signals": "^1.3.0", - "astro": "^5.0.0-alpha.1", + "astro": "^5.0.0-alpha.2", "preact": "^10.23.2" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index c8a80cbdcd9a..ff56a91517f7 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -14,7 +14,7 @@ "@astrojs/react": "^3.6.2", "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", - "astro": "^5.0.0-alpha.1", + "astro": "^5.0.0-alpha.2", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 497e1c053259..699883ded01c 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.1", + "astro": "^5.0.0-alpha.2", "solid-js": "^1.8.21" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 1b574a3936ef..738d2c84f467 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.1", + "astro": "^5.0.0-alpha.2", "svelte": "^4.2.18" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index a15c97ed9389..44ff7e461655 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.1", + "astro": "^5.0.0-alpha.2", "vue": "^3.4.38" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 16c6db4240f1..0d097bc576ad 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/node": "^9.0.0-alpha.1", - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 7932238e5bce..d2da2524ec6c 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index 6cb2acf33455..b4b6a0ef7ecf 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@astrojs/node": "^9.0.0-alpha.1", - "astro": "^5.0.0-alpha.1", + "astro": "^5.0.0-alpha.2", "html-minifier": "^4.0.0" }, "devDependencies": { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index e139db2f69eb..b13f79680788 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index a56c8c1cc81b..13df7002653b 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.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 0d155084576c..39e5b8af3aba 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/server-islands/package.json b/examples/server-islands/package.json index 7413e3bc09e4..13a0b9e99717 100644 --- a/examples/server-islands/package.json +++ b/examples/server-islands/package.json @@ -17,7 +17,7 @@ "@tailwindcss/forms": "^0.5.7", "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", - "astro": "^5.0.0-alpha.1", + "astro": "^5.0.0-alpha.2", "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 ba422fa90922..78c5c5891a5c 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -14,7 +14,7 @@ "dependencies": { "@astrojs/node": "^9.0.0-alpha.1", "@astrojs/svelte": "^6.0.0-alpha.0", - "astro": "^5.0.0-alpha.1", + "astro": "^5.0.0-alpha.2", "svelte": "^4.2.18" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index 45d298fac457..ca29ad4b2faf 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-alpha.1", + "astro": "^5.0.0-alpha.2", "sass": "^1.77.8", "sharp": "^0.33.3" } diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index a7976df55361..005d8f5336d5 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.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index 3a3b67d8e6a3..2b5aace64393 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -12,6 +12,6 @@ "devDependencies": { "@astrojs/tailwind": "^6.0.0-alpha.0", "@astrojs/node": "^9.0.0-alpha.1", - "astro": "^5.0.0-alpha.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 36fdb34222b3..df24c8da84ba 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.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 528121e749a3..63df6fc91f56 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.1", + "astro": "^5.0.0-alpha.2", "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 978a769691e6..779117ef3e89 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.1" + "astro": "^5.0.0-alpha.2" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 3e16ae7e0007..6ab4d7668110 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -12,8 +12,8 @@ }, "dependencies": { "@astrojs/mdx": "^4.0.0-alpha.1", - "@astrojs/preact": "^3.5.1", - "astro": "^5.0.0-alpha.1", + "@astrojs/preact": "^3.5.2", + "astro": "^5.0.0-alpha.2", "preact": "^10.23.2" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 078e9b4a254b..a047aad32fe9 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.2", "@nanostores/preact": "^0.5.2", - "astro": "^5.0.0-alpha.1", + "astro": "^5.0.0-alpha.2", "nanostores": "^0.11.2", "preact": "^10.23.2" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 368c7ca9f5a7..e793ac5aedd5 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@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.1", + "astro": "^5.0.0-alpha.2", "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 c8462a1d25f3..c0ef3a81fff5 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.1", + "astro": "^5.0.0-alpha.2", "vitest": "^2.0.5" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index fd8217ab5164..f662bb51ff5e 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,95 @@ # astro +## 5.0.0-alpha.2 + +### Major Changes + +- [#11826](https://github.com/withastro/astro/pull/11826) [`7315050`](https://github.com/withastro/astro/commit/7315050fc1192fa72ae92aef92b920f63b46118f) Thanks [@matthewp](https://github.com/matthewp)! - Deprecate Astro.glob + + The `Astro.glob` function has been deprecated in favor of Content Collections and `import.meta.glob`. + + - If you want to query for markdown and MDX in your project, use Content Collections. + - If you want to query source files in your project, use `import.meta.glob`(https://vitejs.dev/guide/features.html#glob-import). + + Also consider using glob packages from npm, like [fast-glob](https://www.npmjs.com/package/fast-glob), especially if statically generating your site, as it is faster for most use-cases. + + The easiest path is to migrate to `import.meta.glob` like so: + + ```diff + - const posts = Astro.glob('./posts/*.md'); + + const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true })); + ``` + +- [#11827](https://github.com/withastro/astro/pull/11827) [`a83e362`](https://github.com/withastro/astro/commit/a83e362ee41174501a433c210a24696784d7368f) Thanks [@matthewp](https://github.com/matthewp)! - Prevent usage of `astro:content` in the client + + Usage of `astro:content` in the client has always been discouraged because it leads to all of your content winding up in your client bundle, and can possibly leaks secrets. + + This formally makes doing so impossible, adding to the previous warning with errors. + + In the future Astro might add APIs for client-usage based on needs. + +- [#11253](https://github.com/withastro/astro/pull/11253) [`4e5cc5a`](https://github.com/withastro/astro/commit/4e5cc5aadd7d864bc5194ee67dc2ea74dbe80473) Thanks [@kevinzunigacuellar](https://github.com/kevinzunigacuellar)! - Changes the data returned for `page.url.current`, `page.url.next`, `page.url.prev`, `page.url.first` and `page.url.last` to include the value set for `base` in your Astro config. + + Previously, you had to manually prepend your configured value for `base` to the URL path. Now, Astro automatically includes your `base` value in `next` and `prev` URLs. + + If you are using the `paginate()` function for "previous" and "next" URLs, remove any existing `base` value as it is now added for you: + + ```diff + --- + export async function getStaticPaths({ paginate }) { + const astronautPages = [{ + astronaut: 'Neil Armstrong', + }, { + astronaut: 'Buzz Aldrin', + }, { + astronaut: 'Sally Ride', + }, { + astronaut: 'John Glenn', + }]; + return paginate(astronautPages, { pageSize: 1 }); + } + const { page } = Astro.props; + // `base: /'docs'` configured in `astro.config.mjs` + - const prev = "/docs" + page.url.prev; + + const prev = page.url.prev; + --- + + ``` + +### Minor Changes + +- [#11698](https://github.com/withastro/astro/pull/11698) [`05139ef`](https://github.com/withastro/astro/commit/05139ef8b46de96539cc1d08148489eaf3cfd837) Thanks [@ematipico](https://github.com/ematipico)! - Adds a new property to the globals `Astro` and `APIContext` called `routePattern`. The `routePattern` represents the current route (component) + that is being rendered by Astro. It's usually a path pattern will look like this: `blog/[slug]`: + + ```asto + --- + // src/pages/blog/[slug].astro + const route = Astro.routePattern; + console.log(route); // it will log "blog/[slug]" + --- + ``` + + ```js + // src/pages/index.js + + export const GET = (ctx) => { + console.log(ctx.routePattern); // it will log src/pages/index.js + return new Response.json({ loreum: 'ipsum' }); + }; + ``` + +### Patch Changes + +- [#11791](https://github.com/withastro/astro/pull/11791) [`9393243`](https://github.com/withastro/astro/commit/93932432e7239a1d31c68ea916945302286268e9) Thanks [@bluwy](https://github.com/bluwy)! - Updates Astro's default `