diff --git a/.changeset/pre.json b/.changeset/pre.json index 94d644ea1..4fcefac85 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -42,7 +42,8 @@ "@astrojs/renderer-svelte": "0.3.1", "@astrojs/renderer-vue": "0.3.0", "astro-scripts": "0.0.1", - "@example/with-markdown-shiki": "0.0.1" + "@example/with-markdown-shiki": "0.0.1", + "@example/ssr": "0.0.1" }, "changesets": [ "afraid-crabs-heal", @@ -53,6 +54,7 @@ "chatty-spies-wink", "curly-wasps-sin", "empty-snails-allow", + "few-coats-warn", "four-mirrors-wonder", "fresh-moose-compare", "gold-kangaroos-notice", @@ -67,7 +69,10 @@ "shaggy-shoes-leave", "shy-brooms-tell", "six-ants-hunt", + "slow-islands-fix", "soft-mayflies-warn", - "tiny-owls-dress" + "sour-rabbits-sing", + "tiny-owls-dress", + "warm-drinks-design" ] } diff --git a/examples/blog-multiple-authors/package.json b/examples/blog-multiple-authors/package.json index 43848303d..ac1deca27 100644 --- a/examples/blog-multiple-authors/package.json +++ b/examples/blog-multiple-authors/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 3b923585d..700c6a541 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/component/demo/package.json b/examples/component/demo/package.json index 2d22e7bc4..715225bcc 100644 --- a/examples/component/demo/package.json +++ b/examples/component/demo/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/component/package.json b/examples/component/package.json index 76a4a63f2..724d67219 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -12,6 +12,6 @@ "serve": "astro --project-root demo preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/docs/package.json b/examples/docs/package.json index 1d180d1a1..59c6daa90 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -12,6 +12,6 @@ "@docsearch/react": "^1.0.0-alpha.28" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/fast-build/package.json b/examples/fast-build/package.json index 21fe139d5..b3b698954 100644 --- a/examples/fast-build/package.json +++ b/examples/fast-build/package.json @@ -10,7 +10,7 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6", + "astro": "^0.23.0-next.7", "preact": "~10.6.5", "unocss": "^0.15.5", "vite-imagetools": "^4.0.1" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 1cd9a3392..749e052ac 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index 3a7fc15db..001cc1e1a 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -10,6 +10,6 @@ }, "devDependencies": { "@astrojs/renderer-lit": "^0.4.0-next.0", - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index cc23799a3..824b06e6e 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -10,6 +10,6 @@ }, "devDependencies": { "@astrojs/renderer-solid": "^0.4.0-next.0", - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 48c1c2cbf..c7c4c18ad 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 272c2bbbc..0372f5986 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index cf1e7b530..05c7bbd93 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -10,6 +10,6 @@ }, "devDependencies": { "@astrojs/renderer-solid": "^0.4.0-next.0", - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index e731ec3b1..f76759878 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 6ce1eed96..ff56b573a 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 3d08442fa..cb8dfc810 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/portfolio-svelte/package.json b/examples/portfolio-svelte/package.json index fb8efce3e..558a53aea 100644 --- a/examples/portfolio-svelte/package.json +++ b/examples/portfolio-svelte/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 281e7ada6..604f9f1f2 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index c783a5416..11eaa61fc 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -11,7 +11,7 @@ "server": "node server/server.mjs" }, "devDependencies": { - "astro": "^0.23.0-next.0", + "astro": "^0.23.0-next.7", "unocss": "^0.15.5", "vite-imagetools": "^4.0.1" }, diff --git a/examples/starter/package.json b/examples/starter/package.json index 0ea43a4d6..1ef5b7a97 100644 --- a/examples/starter/package.json +++ b/examples/starter/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/subpath/package.json b/examples/subpath/package.json index 50f2490c4..b193b7018 100644 --- a/examples/subpath/package.json +++ b/examples/subpath/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index c129156aa..c54a0389a 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -9,7 +9,7 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6", + "astro": "^0.23.0-next.7", "hast-util-select": "5.0.1", "rehype-autolink-headings": "^6.1.0", "rehype-slug": "^5.0.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index ceb1a3874..0702aff5e 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/with-markdown/package.json b/examples/with-markdown/package.json index ab56d676f..b9a1329b6 100644 --- a/examples/with-markdown/package.json +++ b/examples/with-markdown/package.json @@ -9,6 +9,6 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 358ca6a92..21566b32b 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -17,6 +17,6 @@ }, "devDependencies": { "@astrojs/renderer-solid": "^0.4.0-next.0", - "astro": "^0.23.0-next.6" + "astro": "^0.23.0-next.7" } } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index fcc7f159e..ee8ce9b64 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -9,7 +9,7 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6", + "astro": "^0.23.0-next.7", "autoprefixer": "^10.4.0", "tailwindcss": "^3.0.5" } diff --git a/examples/with-vite-plugin-pwa/package.json b/examples/with-vite-plugin-pwa/package.json index a96d91723..3a8ea59e4 100644 --- a/examples/with-vite-plugin-pwa/package.json +++ b/examples/with-vite-plugin-pwa/package.json @@ -9,7 +9,7 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.23.0-next.6", + "astro": "^0.23.0-next.7", "vite-plugin-pwa": "0.11.5" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index aa3722fd5..e6041714a 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,82 @@ # astro +## 0.23.0-next.7 + +### Patch Changes + +- [#2586](https://github.com/withastro/astro/pull/2586) [`d6d35bca`](https://github.com/withastro/astro/commit/d6d35bcafcbe216caa1d9e8410bf2925a4d57467) Thanks [@tony-sull](https://github.com/tony-sull)! - Support for non-HTML pages + + > ⚠️ This feature is currently only supported with the `--experimental-static-build` CLI flag. This feature may be refined over the next few weeks/months as SSR support is finalized. + + This adds support for generating non-HTML pages form `.js` and `.ts` pages during the build. Built file and extensions are based on the source file's name, ex: `src/pages/data.json.ts` will be built to `dist/data.json`. + + **Is this different from SSR?** Yes! This feature allows JSON, XML, etc. files to be output at build time. Keep an eye out for full SSR support if you need to build similar files when requested, for example as a serverless function in your deployment host. + + ## Examples + + ```typescript + // src/pages/company.json.ts + export async function get() { + return { + body: JSON.stringify({ + name: 'Astro Technology Company', + url: 'https://astro.build/', + }), + }; + } + ``` + + What about `getStaticPaths()`? It **just works**™. + + ```typescript + export async function getStaticPaths() { + return [ + { params: { slug: 'thing1' }}, + { params: { slug: 'thing2' }} + ] + } + + export async function get(params) { + const { slug } = params + + return { + body: // ...JSON.stringify() + } + } + ``` + +* [#2548](https://github.com/withastro/astro/pull/2548) [`ba5e2b5e`](https://github.com/withastro/astro/commit/ba5e2b5e6c20207955991775dc4aa8879331542c) Thanks [@matthewp](https://github.com/matthewp)! - Experimental SSR Support + + > ⚠️ If you are a user of Astro and see this PR and think that you can start deploying your app to a server and get SSR, slow down a second! This is only the initial flag and **very basic support**. Styles are not loading correctly at this point, for example. Like we did with the `--experimental-static-build` flag, this feature will be refined over the next few weeks/months and we'll let you know when its ready for community testing. + + ## Changes + + - This adds a new `--experimental-ssr` flag to `astro build` which will result in `dist/server/` and `dist/client/` directories. + - SSR can be used through this API: + + ```js + import { createServer } from 'http'; + import { loadApp } from 'astro/app/node'; + + const app = await loadApp(new URL('./dist/server/', import.meta.url)); + + createServer((req, res) => { + const route = app.match(req); + if(route) { + let html = await app.render(req, route); + } + + }).listen(8080); + ``` + + - This API will be refined over time. + - This only works in Node.js at the moment. + - Many features will likely not work correctly, but rendering HTML at least should. + +- [#2581](https://github.com/withastro/astro/pull/2581) [`ec6f148f`](https://github.com/withastro/astro/commit/ec6f148fc8623c6549885af70512839c08905fdb) Thanks [@matthewp](https://github.com/matthewp)! - Fix for resolving relative imports from hoisted scripts in the static build. + +* [#2594](https://github.com/withastro/astro/pull/2594) [`085468e9`](https://github.com/withastro/astro/commit/085468e949f1d6e9e19bd7039574b586a78e7601) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Upgrade `@astrojs/compiler` to `v0.10.2` + ## 0.23.0-next.6 ### Patch Changes @@ -1301,10 +1378,10 @@ For convenience, you may now also move your `astro.config.js` file to a top-leve ```js export default { - markdownOptions: { - remarkPlugins: ['remark-slug', ['remark-autolink-headings', { behavior: 'prepend' }]], - rehypePlugins: ['rehype-slug', ['rehype-autolink-headings', { behavior: 'prepend' }]], - }, + markdownOptions: { + remarkPlugins: ['remark-slug', ['remark-autolink-headings', { behavior: 'prepend' }]], + rehypePlugins: ['rehype-slug', ['rehype-autolink-headings', { behavior: 'prepend' }]], + }, }; ``` @@ -1324,10 +1401,10 @@ For convenience, you may now also move your `astro.config.js` file to a top-leve ```js export default { - name: '@matthewp/my-renderer', - server: './server.js', - client: './client.js', - hydrationPolyfills: ['./my-polyfill.js'], + name: '@matthewp/my-renderer', + server: './server.js', + client: './client.js', + hydrationPolyfills: ['./my-polyfill.js'], }; ``` diff --git a/packages/astro/package.json b/packages/astro/package.json index fba2e8b88..ae473a2a7 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "0.23.0-next.6", + "version": "0.23.0-next.7", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro",