From 440bdff8cca7df7bb4e123539c77f3631293c6e8 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 31 Jan 2024 14:40:13 -0600 Subject: [PATCH 1/5] [ci]: use M1 mac image (#9913) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 339f03594e6e..291e44e740d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: OS: [ubuntu-latest] NODE_VERSION: [18, 20.5.1] include: - - os: macos-latest + - os: macos-14 NODE_VERSION: 18 - os: windows-latest NODE_VERSION: 18.17.1 From 2f6d1faa6f2d6de2d4ccd2a48adf5adadc82e593 Mon Sep 17 00:00:00 2001 From: Arsh <69170106+lilnasy@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:02:40 +0000 Subject: [PATCH 2/5] fix(NodeApp): end with "Internal server error" on mid-stream error (#9908) * fix(NodeApp): end with "Internal server error" on mid-stream error * add changeset * add test * Apply suggestions from code review --------- Co-authored-by: Nate Moore --- .changeset/clever-roses-sleep.md | 5 +++++ packages/astro/src/core/app/node.ts | 4 ++-- .../integrations/node/test/errors.test.js | 19 +++++++++++++++++-- .../fixtures/errors/src/pages/generator.astro | 11 +++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 .changeset/clever-roses-sleep.md create mode 100644 packages/integrations/node/test/fixtures/errors/src/pages/generator.astro diff --git a/.changeset/clever-roses-sleep.md b/.changeset/clever-roses-sleep.md new file mode 100644 index 000000000000..fd159eb3ba34 --- /dev/null +++ b/.changeset/clever-roses-sleep.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Improves http behavior relating to errors encountered while streaming a response. diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts index ddfa70997c4a..db61157e319e 100644 --- a/packages/astro/src/core/app/node.ts +++ b/packages/astro/src/core/app/node.ts @@ -118,12 +118,12 @@ export class NodeApp extends App { destination.write(result.value); result = await reader.read(); } + destination.end(); // the error will be logged by the "on end" callback above } catch { - destination.write('Internal server error'); + destination.end('Internal server error'); } } - destination.end(); } } diff --git a/packages/integrations/node/test/errors.test.js b/packages/integrations/node/test/errors.test.js index 983187475799..23deba02cce4 100644 --- a/packages/integrations/node/test/errors.test.js +++ b/packages/integrations/node/test/errors.test.js @@ -1,4 +1,4 @@ -import * as assert from 'node:assert/strict'; +import assert from 'node:assert/strict'; import { describe, it, before, after } from 'node:test'; import nodejs from '../dist/index.js'; import { loadFixture } from './test-utils.js'; @@ -22,11 +22,26 @@ describe('Errors', () => { after(async () => { await devPreview.stop(); }); - it('when mode is standalone', async () => { + + it('rejected promise in template', async () => { const res = await fixture.fetch('/in-stream'); const html = await res.text(); const $ = cheerio.load(html); assert.equal($('p').text().trim(), 'Internal server error'); }); + + it('generator that throws called in template', async () => { + /** @type {Response} */ + const res = await fixture.fetch('/generator'); + const reader = res.body.getReader(); + const decoder = new TextDecoder(); + const expect = async ({ done, value }) => { + const result = await reader.read(); + assert.equal(result.done, done); + if (!done) assert.equal(decoder.decode(result.value), value); + } + await expect({ done: false, value: "

Astro

1Internal server error" }); + await expect({ done: true }); + }); }); diff --git a/packages/integrations/node/test/fixtures/errors/src/pages/generator.astro b/packages/integrations/node/test/fixtures/errors/src/pages/generator.astro new file mode 100644 index 000000000000..65b8ae62c15d --- /dev/null +++ b/packages/integrations/node/test/fixtures/errors/src/pages/generator.astro @@ -0,0 +1,11 @@ +--- +function * generator () { + yield 1 + throw Error('ohnoes') +} +--- +

Astro

+{generator()} +
+ Footer +
\ No newline at end of file From d702d6ae5052ce25871e70082f37bb553f1c26bd Mon Sep 17 00:00:00 2001 From: Arsh Date: Thu, 1 Feb 2024 07:03:42 +0000 Subject: [PATCH 3/5] [ci] format --- packages/integrations/node/test/errors.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/integrations/node/test/errors.test.js b/packages/integrations/node/test/errors.test.js index 23deba02cce4..76bff13265ed 100644 --- a/packages/integrations/node/test/errors.test.js +++ b/packages/integrations/node/test/errors.test.js @@ -30,7 +30,7 @@ describe('Errors', () => { assert.equal($('p').text().trim(), 'Internal server error'); }); - + it('generator that throws called in template', async () => { /** @type {Response} */ const res = await fixture.fetch('/generator'); @@ -40,8 +40,8 @@ describe('Errors', () => { const result = await reader.read(); assert.equal(result.done, done); if (!done) assert.equal(decoder.decode(result.value), value); - } - await expect({ done: false, value: "

Astro

1Internal server error" }); + }; + await expect({ done: false, value: '

Astro

1Internal server error' }); await expect({ done: true }); }); }); From 2561c99598e325bbd5a70a9c08f9f409ec5994fd Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Thu, 1 Feb 2024 02:04:19 -0800 Subject: [PATCH 4/5] [ci] release (#9904) * [ci] release * Update packages/astro/CHANGELOG.md Co-authored-by: Sarah Rainsberger * Update packages/integrations/vercel/CHANGELOG.md Co-authored-by: Sarah Rainsberger * Update packages/astro/CHANGELOG.md Co-authored-by: Sarah Rainsberger --------- Co-authored-by: github-actions[bot] Co-authored-by: Emanuele Stoppa Co-authored-by: Sarah Rainsberger --- .changeset/clever-roses-sleep.md | 5 - .changeset/cuddly-moons-hang.md | 14 --- .changeset/four-masks-smell.md | 6 -- .changeset/funny-mice-help.md | 5 - .changeset/little-panthers-relate.md | 5 - .changeset/old-cherries-beg.md | 9 -- .changeset/poor-tips-turn.md | 12 --- .changeset/tame-flies-confess.md | 18 ---- .changeset/tidy-carrots-jump.md | 52 ---------- .changeset/tiny-moose-melt.md | 5 - .changeset/young-eyes-film.md | 15 --- examples/basics/package.json | 2 +- examples/blog/package.json | 2 +- examples/component/package.json | 2 +- examples/framework-alpine/package.json | 2 +- examples/framework-lit/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 | 4 +- examples/integration/package.json | 2 +- examples/middleware/package.json | 4 +- examples/minimal/package.json | 2 +- examples/non-html-pages/package.json | 2 +- examples/portfolio/package.json | 2 +- examples/ssr/package.json | 4 +- examples/starlog/package.json | 2 +- examples/view-transitions/package.json | 4 +- 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 | 2 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 2 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 108 ++++++++++++++++++++ packages/astro/package.json | 2 +- packages/integrations/node/CHANGELOG.md | 6 ++ packages/integrations/node/package.json | 2 +- packages/integrations/vercel/CHANGELOG.md | 17 +++ packages/integrations/vercel/package.json | 2 +- pnpm-lock.yaml | 62 +++++------ 45 files changed, 196 insertions(+), 211 deletions(-) delete mode 100644 .changeset/clever-roses-sleep.md delete mode 100644 .changeset/cuddly-moons-hang.md delete mode 100644 .changeset/four-masks-smell.md delete mode 100644 .changeset/funny-mice-help.md delete mode 100644 .changeset/little-panthers-relate.md delete mode 100644 .changeset/old-cherries-beg.md delete mode 100644 .changeset/poor-tips-turn.md delete mode 100644 .changeset/tame-flies-confess.md delete mode 100644 .changeset/tidy-carrots-jump.md delete mode 100644 .changeset/tiny-moose-melt.md delete mode 100644 .changeset/young-eyes-film.md diff --git a/.changeset/clever-roses-sleep.md b/.changeset/clever-roses-sleep.md deleted file mode 100644 index fd159eb3ba34..000000000000 --- a/.changeset/clever-roses-sleep.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Improves http behavior relating to errors encountered while streaming a response. diff --git a/.changeset/cuddly-moons-hang.md b/.changeset/cuddly-moons-hang.md deleted file mode 100644 index c726f5aa4398..000000000000 --- a/.changeset/cuddly-moons-hang.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -"astro": minor ---- - -Adds a new `ComponentProps` type export from `astro/types` to get the props type of an Astro component. - -```astro ---- -import type { ComponentProps } from 'astro/types'; -import { Button } from "./Button.astro"; - -type myButtonProps = ComponentProps; ---- -``` diff --git a/.changeset/four-masks-smell.md b/.changeset/four-masks-smell.md deleted file mode 100644 index e0207fbe40d0..000000000000 --- a/.changeset/four-masks-smell.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@astrojs/vercel": minor -"@astrojs/node": minor ---- - -Adds experimental support for internationalization domains diff --git a/.changeset/funny-mice-help.md b/.changeset/funny-mice-help.md deleted file mode 100644 index 9cedc017cb8f..000000000000 --- a/.changeset/funny-mice-help.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Fixes the content config type path on windows diff --git a/.changeset/little-panthers-relate.md b/.changeset/little-panthers-relate.md deleted file mode 100644 index 5fb2c523f237..000000000000 --- a/.changeset/little-panthers-relate.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Fixes an issue where the function `getLocaleRelativeUrlList` wasn't normalising the paths by default diff --git a/.changeset/old-cherries-beg.md b/.changeset/old-cherries-beg.md deleted file mode 100644 index cf074297e7ab..000000000000 --- a/.changeset/old-cherries-beg.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'astro': minor ---- - -Adds CLI shortcuts as an easter egg for the dev server: - -- `o + enter`: opens the site in your browser -- `q + enter`: quits the dev server -- `h + enter`: prints all available shortcuts diff --git a/.changeset/poor-tips-turn.md b/.changeset/poor-tips-turn.md deleted file mode 100644 index aeceb5dccfa2..000000000000 --- a/.changeset/poor-tips-turn.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -"@astrojs/vercel": patch ---- - -Better ignores for Vercel file-tracer - -The Vercel adapter has a file-tracer it uses to detect which files should be moved over to the dist folder. When its done it prints warnings for things that it detected that maybe should be moved. - -This change expands how we do ignores so that: - -- Ignores happen within dot folders like `.pnpm`. -- `@libsql/client` is ignored, a package we know is not bundled. diff --git a/.changeset/tame-flies-confess.md b/.changeset/tame-flies-confess.md deleted file mode 100644 index 7b10c23580f8..000000000000 --- a/.changeset/tame-flies-confess.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -'astro': minor ---- - -Adds a new `build.format` configuration option: 'preserve'. This option will preserve your source structure in the final build. - -The existing configuration options, `file` and `directory`, either build all of your HTML pages as files matching the route name (e.g. `/about.html`) or build all your files as `index.html` within a nested directory structure (e.g. `/about/index.html`), respectively. It was not previously possible to control the HTML file built on a per-file basis. - -One limitation of `build.format: 'file'` is that it cannot create `index.html` files for any individual routes (other than the base path of `/`) while otherwise building named files. Creating explicit index pages within your file structure still generates a file named for the page route (e.g. `src/pages/about/index.astro` builds `/about.html`) when using the `file` configuration option. - -Rather than make a breaking change to allow `build.format: 'file'` to be more flexible, we decided to create a new `build.format: 'preserve'`. - -The new format will preserve how the filesystem is structured and make sure that is mirrored over to production. Using this option: - -- `about.astro` becomes `about.html` -- `about/index.astro` becomes `about/index.html` - -See the [`build.format` configuration options reference] for more details. diff --git a/.changeset/tidy-carrots-jump.md b/.changeset/tidy-carrots-jump.md deleted file mode 100644 index e18f235e3aaf..000000000000 --- a/.changeset/tidy-carrots-jump.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -'astro': minor ---- - -Adds experimental support for a new i18n domain routing option (`"domains"`) that allows you to configure different domains for individual locales in entirely server-rendered projects. - -To enable this in your project, first configure your `server`-rendered project's i18n routing with your preferences if you have not already done so. Then, set the `experimental.i18nDomains` flag to `true` and add `i18n.domains` to map any of your supported `locales` to custom URLs: - -```js -//astro.config.mjs" -import { defineConfig } from "astro/config" -export default defineConfig({ - site: "https://example.com", - output: "server", // required, with no prerendered pages - adapter: node({ - mode: 'standalone', - }), - i18n: { - defaultLocale: "en", - locales: ["es", "en", "fr", "ja"], - routing: { - prefixDefaultLocale: false - }, - domains: { - fr: "https://fr.example.com", - es: "https://example.es" - } - }, - experimental: { - i18nDomains: true - } -}) -``` -With `"domains"` configured, the URLs emitted by `getAbsoluteLocaleUrl()` and `getAbsoluteLocaleUrlList()` will use the options set in `i18n.domains`. - -```js -import { getAbsoluteLocaleUrl } from "astro:i18n"; - -getAbsoluteLocaleUrl("en", "about"); // will return "https://example.com/about" -getAbsoluteLocaleUrl("fr", "about"); // will return "https://fr.example.com/about" -getAbsoluteLocaleUrl("es", "about"); // will return "https://example.es/about" -getAbsoluteLocaleUrl("ja", "about"); // will return "https://example.com/ja/about" -``` - -Similarly, your localized files will create routes at corresponding URLs: - -- The file `/en/about.astro` will be reachable at the URL `https://example.com/about`. -- The file `/fr/about.astro` will be reachable at the URL `https://fr.example.com/about`. -- The file `/es/about.astro` will be reachable at the URL `https://example.es/about`. -- The file `/ja/about.astro` will be reachable at the URL `https://example.com/ja/about`. - -See our [Internationalization Guide](https://docs.astro.build/en/guides/internationalization/#domains-experimental) for more details and limitations on this experimental routing feature. diff --git a/.changeset/tiny-moose-melt.md b/.changeset/tiny-moose-melt.md deleted file mode 100644 index aba946fe7021..000000000000 --- a/.changeset/tiny-moose-melt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Fixes an issue where some adapters that do not include a `start()` export would error rather than silently proceed diff --git a/.changeset/young-eyes-film.md b/.changeset/young-eyes-film.md deleted file mode 100644 index 092da9882d52..000000000000 --- a/.changeset/young-eyes-film.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -"astro": minor ---- - -Fixes an issue where images in Markdown required a relative specifier (e.g. `./`) - -Now, you can use the standard `![](img.png)` syntax in Markdown files for images colocated in the same folder: no relative specifier required! - -There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these Markdown images as they are no longer necessary: - -```diff -- ![A cute dog](./dog.jpg) -+ ![A cute dog](dog.jpg) - -``` diff --git a/examples/basics/package.json b/examples/basics/package.json index 33291e9103fb..eaec1473fa4e 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 5335605cb17a..fd8de7470904 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^2.1.1", "@astrojs/rss": "^4.0.4", "@astrojs/sitemap": "^3.0.5", - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/component/package.json b/examples/component/package.json index 583fd5226de8..cc8f3af538f5 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.2.8" + "astro": "^4.3.0" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 9efd2abfada7..6f95e570b54f 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.5", "alpinejs": "^3.13.3", - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index 0c34af72783c..fe7ab4180061 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/lit": "^4.0.1", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^4.2.8", + "astro": "^4.3.0", "lit": "^2.8.0" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 5318dc347628..e550094220ab 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -16,7 +16,7 @@ "@astrojs/solid-js": "^4.0.1", "@astrojs/svelte": "^5.0.3", "@astrojs/vue": "^4.0.8", - "astro": "^4.2.8", + "astro": "^4.3.0", "preact": "^10.19.2", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index e40889273324..d3e9260d4204 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.1.0", "@preact/signals": "^1.2.1", - "astro": "^4.2.8", + "astro": "^4.3.0", "preact": "^10.19.2" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 053b8878509d..0eeb6d54952e 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -14,7 +14,7 @@ "@astrojs/react": "^3.0.9", "@types/react": "^18.2.37", "@types/react-dom": "^18.2.15", - "astro": "^4.2.8", + "astro": "^4.3.0", "react": "^18.2.0", "react-dom": "^18.2.0" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 57afbf165dc7..91b7000eeb0b 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^4.0.1", - "astro": "^4.2.8", + "astro": "^4.3.0", "solid-js": "^1.8.5" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 07956cd8c5d6..d95695cd639d 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^5.0.3", - "astro": "^4.2.8", + "astro": "^4.3.0", "svelte": "^4.2.5" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index ba25ebf16998..1ca9b2dc5ec1 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/vue": "^4.0.8", - "astro": "^4.2.8", + "astro": "^4.3.0", "vue": "^3.3.8" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index ac9bdb79c9d5..04bf97a2fcdc 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^8.1.0", - "astro": "^4.2.8" + "@astrojs/node": "^8.2.0", + "astro": "^4.3.0" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 8d6751b14c86..d3dc72a4b686 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.2.8" + "astro": "^4.3.0" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index f8619d4a0afc..8c9a931d758b 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -12,8 +12,8 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^8.1.0", - "astro": "^4.2.8", + "@astrojs/node": "^8.2.0", + "astro": "^4.3.0", "html-minifier": "^4.0.0" }, "devDependencies": { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 9ef644995f2c..fbdd87408c05 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index 80b6f39e289f..6eadd38f39a3 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index af774639d710..8c8ba06f3ffa 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 75238260ba00..ee9a3bb2a3ce 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,9 +12,9 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^8.1.0", + "@astrojs/node": "^8.2.0", "@astrojs/svelte": "^5.0.3", - "astro": "^4.2.8", + "astro": "^4.3.0", "svelte": "^4.2.5" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index c780c28fdac1..2b80ecbab876 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.2.8", + "astro": "^4.3.0", "sass": "^1.69.5", "sharp": "^0.32.6" } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index 1536bb767480..b437e053737e 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@astrojs/tailwind": "^5.1.0", - "@astrojs/node": "^8.1.0", - "astro": "^4.2.8" + "@astrojs/node": "^8.2.0", + "astro": "^4.3.0" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 1ee2f30722c4..3f7792df49c3 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/markdoc": "^0.8.3", - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index db5057c19f9f..4d04effc9dc9 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^4.2.1", - "astro": "^4.2.8", + "astro": "^4.3.0", "hast-util-select": "^6.0.2", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index f46f4acf6636..4a29c90f2fda 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.2.8" + "astro": "^4.3.0" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index e62b6636e24b..9a249bee6529 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/mdx": "^2.1.1", "@astrojs/preact": "^3.1.0", - "astro": "^4.2.8", + "astro": "^4.3.0", "preact": "^10.19.2" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 4b4686943502..95d55aabd9ec 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.1.0", "@nanostores/preact": "^0.5.0", - "astro": "^4.2.8", + "astro": "^4.3.0", "nanostores": "^0.9.5", "preact": "^10.19.2" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index f00b77307fb7..f8f730ca8acf 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^2.1.1", "@astrojs/tailwind": "^5.1.0", "@types/canvas-confetti": "^1.6.3", - "astro": "^4.2.8", + "astro": "^4.3.0", "autoprefixer": "^10.4.15", "canvas-confetti": "^1.9.1", "postcss": "^8.4.28", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 1d3ec43f0555..dd6b8b2d66ad 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.2.8", + "astro": "^4.3.0", "vitest": "^1.2.1" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 321409cf459c..fd45978ad318 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,113 @@ # astro +## 4.3.0 + +### Minor Changes + +- [#9839](https://github.com/withastro/astro/pull/9839) [`58f9e393a188702eef5329e41deff3dcb65a3230`](https://github.com/withastro/astro/commit/58f9e393a188702eef5329e41deff3dcb65a3230) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Adds a new `ComponentProps` type export from `astro/types` to get the props type of an Astro component. + + ```astro + --- + import type { ComponentProps } from 'astro/types'; + import { Button } from './Button.astro'; + + type myButtonProps = ComponentProps; + --- + ``` + +- [#9159](https://github.com/withastro/astro/pull/9159) [`7d937c158959e76443a02f740b10e251d14dbd8c`](https://github.com/withastro/astro/commit/7d937c158959e76443a02f740b10e251d14dbd8c) Thanks [@bluwy](https://github.com/bluwy)! - Adds CLI shortcuts as an easter egg for the dev server: + + - `o + enter`: opens the site in your browser + - `q + enter`: quits the dev server + - `h + enter`: prints all available shortcuts + +- [#9764](https://github.com/withastro/astro/pull/9764) [`fad4f64aa149086feda2d1f3a0b655767034f1a8`](https://github.com/withastro/astro/commit/fad4f64aa149086feda2d1f3a0b655767034f1a8) Thanks [@matthewp](https://github.com/matthewp)! - Adds a new `build.format` configuration option: `'preserve'`. This option will preserve your source structure in the final build. + + The existing configuration options, `file` and `directory`, either build all of your HTML pages as files matching the route name (e.g. `/about.html`) or build all your files as `index.html` within a nested directory structure (e.g. `/about/index.html`), respectively. It was not previously possible to control the HTML file built on a per-file basis. + + One limitation of `build.format: 'file'` is that it cannot create `index.html` files for any individual routes (other than the base path of `/`) while otherwise building named files. Creating explicit index pages within your file structure still generates a file named for the page route (e.g. `src/pages/about/index.astro` builds `/about.html`) when using the `file` configuration option. + + Rather than make a breaking change to allow `build.format: 'file'` to be more flexible, we decided to create a new `build.format: 'preserve'`. + + The new format will preserve how the filesystem is structured and make sure that is mirrored over to production. Using this option: + + - `about.astro` becomes `about.html` + - `about/index.astro` becomes `about/index.html` + + See the [`build.format` configuration options reference](https://docs.astro.build/en/reference/configuration-reference/#buildformat) for more details. + +- [#9143](https://github.com/withastro/astro/pull/9143) [`041fdd5c89920f7ccf944b095f29e451f78b0e28`](https://github.com/withastro/astro/commit/041fdd5c89920f7ccf944b095f29e451f78b0e28) Thanks [@ematipico](https://github.com/ematipico)! - Adds experimental support for a new i18n domain routing option (`"domains"`) that allows you to configure different domains for individual locales in entirely server-rendered projects. + + To enable this in your project, first configure your `server`-rendered project's i18n routing with your preferences if you have not already done so. Then, set the `experimental.i18nDomains` flag to `true` and add `i18n.domains` to map any of your supported `locales` to custom URLs: + + ```js + //astro.config.mjs" + import { defineConfig } from 'astro/config'; + export default defineConfig({ + site: 'https://example.com', + output: 'server', // required, with no prerendered pages + adapter: node({ + mode: 'standalone', + }), + i18n: { + defaultLocale: 'en', + locales: ['es', 'en', 'fr', 'ja'], + routing: { + prefixDefaultLocale: false, + }, + domains: { + fr: 'https://fr.example.com', + es: 'https://example.es', + }, + }, + experimental: { + i18nDomains: true, + }, + }); + ``` + + With `"domains"` configured, the URLs emitted by `getAbsoluteLocaleUrl()` and `getAbsoluteLocaleUrlList()` will use the options set in `i18n.domains`. + + ```js + import { getAbsoluteLocaleUrl } from 'astro:i18n'; + + getAbsoluteLocaleUrl('en', 'about'); // will return "https://example.com/about" + getAbsoluteLocaleUrl('fr', 'about'); // will return "https://fr.example.com/about" + getAbsoluteLocaleUrl('es', 'about'); // will return "https://example.es/about" + getAbsoluteLocaleUrl('ja', 'about'); // will return "https://example.com/ja/about" + ``` + + Similarly, your localized files will create routes at corresponding URLs: + + - The file `/en/about.astro` will be reachable at the URL `https://example.com/about`. + - The file `/fr/about.astro` will be reachable at the URL `https://fr.example.com/about`. + - The file `/es/about.astro` will be reachable at the URL `https://example.es/about`. + - The file `/ja/about.astro` will be reachable at the URL `https://example.com/ja/about`. + + See our [Internationalization Guide](https://docs.astro.build/en/guides/internationalization/#domains-experimental) for more details and limitations on this experimental routing feature. + +- [#9755](https://github.com/withastro/astro/pull/9755) [`d4b886141bb342ac71b1c060e67d66ca2ffbb8bd`](https://github.com/withastro/astro/commit/d4b886141bb342ac71b1c060e67d66ca2ffbb8bd) Thanks [@OliverSpeir](https://github.com/OliverSpeir)! - Fixes an issue where images in Markdown required a relative specifier (e.g. `./`) + + Now, you can use the standard `![](img.png)` syntax in Markdown files for images colocated in the same folder: no relative specifier required! + + There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these Markdown images as they are no longer necessary: + + ```diff + - ![A cute dog](./dog.jpg) + + ![A cute dog](dog.jpg) + + ``` + +### Patch Changes + +- [#9908](https://github.com/withastro/astro/pull/9908) [`2f6d1faa6f2d6de2d4ccd2a48adf5adadc82e593`](https://github.com/withastro/astro/commit/2f6d1faa6f2d6de2d4ccd2a48adf5adadc82e593) Thanks [@lilnasy](https://github.com/lilnasy)! - Improves http behavior relating to errors encountered while streaming a response. + +- [#9877](https://github.com/withastro/astro/pull/9877) [`7be5f94dcfc73a78d0fb301eeff51614d987a165`](https://github.com/withastro/astro/commit/7be5f94dcfc73a78d0fb301eeff51614d987a165) Thanks [@fabiankachlock](https://github.com/fabiankachlock)! - Fixes the content config type path on windows + +- [#9143](https://github.com/withastro/astro/pull/9143) [`041fdd5c89920f7ccf944b095f29e451f78b0e28`](https://github.com/withastro/astro/commit/041fdd5c89920f7ccf944b095f29e451f78b0e28) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where the function `getLocaleRelativeUrlList` wasn't normalising the paths by default + +- [#9911](https://github.com/withastro/astro/pull/9911) [`aaedb848b1d6f683840035865528506a346ea659`](https://github.com/withastro/astro/commit/aaedb848b1d6f683840035865528506a346ea659) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fixes an issue where some adapters that do not include a `start()` export would error rather than silently proceed + ## 4.2.8 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index ba1509826cdb..5cd67026b3d4 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.2.8", + "version": "4.3.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/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index 837dcd16b5b0..7b90e7ab50be 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/node +## 8.2.0 + +### Minor Changes + +- [#9143](https://github.com/withastro/astro/pull/9143) [`041fdd5c89920f7ccf944b095f29e451f78b0e28`](https://github.com/withastro/astro/commit/041fdd5c89920f7ccf944b095f29e451f78b0e28) Thanks [@ematipico](https://github.com/ematipico)! - Adds experimental support for internationalization domains + ## 8.1.0 ### Minor Changes diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 339535476bd8..62be98315efc 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": "8.1.0", + "version": "8.2.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md index f624887f4ea2..6c17600c3e6b 100644 --- a/packages/integrations/vercel/CHANGELOG.md +++ b/packages/integrations/vercel/CHANGELOG.md @@ -1,5 +1,22 @@ # @astrojs/vercel +## 7.1.0 + +### Minor Changes + +- [#9143](https://github.com/withastro/astro/pull/9143) [`041fdd5c89920f7ccf944b095f29e451f78b0e28`](https://github.com/withastro/astro/commit/041fdd5c89920f7ccf944b095f29e451f78b0e28) Thanks [@ematipico](https://github.com/ematipico)! - Adds experimental support for internationalization domains + +### Patch Changes + +- [#9885](https://github.com/withastro/astro/pull/9885) [`49e0c24d7f90d00e986533fcf546665967540ce7`](https://github.com/withastro/astro/commit/49e0c24d7f90d00e986533fcf546665967540ce7) Thanks [@matthewp](https://github.com/matthewp)! - Better ignores for Vercel file-tracer + + The Vercel adapter has a file-tracer it uses to detect which files should be moved over to the `dist/` folder. When it's done, it prints warnings for things that it detected that maybe should be moved. + + This change expands how we do ignores so that: + + - Ignores happen within dot folders like `.pnpm`. + - `@libsql/client` is ignored, a package we know is not bundled. + ## 7.0.2 ### Patch Changes diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index 3a4c28ffcdd4..c42cd31730ef 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": "7.0.2", + "version": "7.1.0", "type": "module", "author": "withastro", "license": "MIT", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e58443ebb214..f17e7c0549b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,7 +128,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/blog: @@ -143,13 +143,13 @@ importers: specifier: ^3.0.5 version: link:../../packages/integrations/sitemap astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/framework-alpine: @@ -164,7 +164,7 @@ importers: specifier: ^3.13.3 version: 3.13.3 astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/framework-lit: @@ -176,7 +176,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro lit: specifier: ^2.8.0 @@ -200,7 +200,7 @@ importers: specifier: ^4.0.8 version: link:../../packages/integrations/vue astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -230,7 +230,7 @@ importers: specifier: ^1.2.1 version: 1.2.1(preact@10.19.3) astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -248,7 +248,7 @@ importers: specifier: ^18.2.15 version: 18.2.18 astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro react: specifier: ^18.2.0 @@ -263,7 +263,7 @@ importers: specifier: ^4.0.1 version: link:../../packages/integrations/solid astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro solid-js: specifier: ^1.8.5 @@ -275,7 +275,7 @@ importers: specifier: ^5.0.3 version: link:../../packages/integrations/svelte astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro svelte: specifier: ^4.2.5 @@ -287,7 +287,7 @@ importers: specifier: ^4.0.8 version: link:../../packages/integrations/vue astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro vue: specifier: ^3.3.8 @@ -296,25 +296,25 @@ importers: examples/hackernews: dependencies: '@astrojs/node': - specifier: ^8.1.0 + specifier: ^8.2.0 version: link:../../packages/integrations/node astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/middleware: dependencies: '@astrojs/node': - specifier: ^8.1.0 + specifier: ^8.2.0 version: link:../../packages/integrations/node astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -327,31 +327,31 @@ importers: examples/minimal: dependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/ssr: dependencies: '@astrojs/node': - specifier: ^8.1.0 + specifier: ^8.2.0 version: link:../../packages/integrations/node '@astrojs/svelte': specifier: ^5.0.3 version: link:../../packages/integrations/svelte astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro svelte: specifier: ^4.2.5 @@ -360,7 +360,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro sass: specifier: ^1.69.5 @@ -372,13 +372,13 @@ importers: examples/view-transitions: devDependencies: '@astrojs/node': - specifier: ^8.1.0 + specifier: ^8.2.0 version: link:../../packages/integrations/node '@astrojs/tailwind': specifier: ^5.1.0 version: link:../../packages/integrations/tailwind astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/with-markdoc: @@ -387,7 +387,7 @@ importers: specifier: ^0.8.3 version: link:../../packages/integrations/markdoc astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/with-markdown-plugins: @@ -396,7 +396,7 @@ importers: specifier: ^4.2.1 version: link:../../packages/markdown/remark astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro hast-util-select: specifier: ^6.0.2 @@ -417,7 +417,7 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro examples/with-mdx: @@ -429,7 +429,7 @@ importers: specifier: ^3.1.0 version: link:../../packages/integrations/preact astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -444,7 +444,7 @@ importers: specifier: ^0.5.0 version: 0.5.0(nanostores@0.9.5)(preact@10.19.3) astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro nanostores: specifier: ^0.9.5 @@ -465,7 +465,7 @@ importers: specifier: ^1.6.3 version: 1.6.4 astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro autoprefixer: specifier: ^10.4.15 @@ -483,7 +483,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^4.2.8 + specifier: ^4.3.0 version: link:../../packages/astro vitest: specifier: ^1.2.1 From b31a46673efecaf884f8596deabd30c7a041dd14 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 1 Feb 2024 10:29:07 +0000 Subject: [PATCH 5/5] chore: fix alignment docs (#9920) * chore: fix alignment docs * apply Sarah suggestion --- packages/astro/src/@types/astro.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 38675898fce5..6c409224a508 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -796,7 +796,7 @@ export interface AstroUserConfig { * { * build: { * // Example: Generate `page.html` instead of `page/index.html` during build. - * format: 'preserve' + * format: 'file' * } * } * ``` @@ -1551,19 +1551,20 @@ export interface AstroUserConfig { * ```js * //astro.config.mjs * export default defineConfig({ - * site: "https://example.com", - * output: "server", // required, with no prerendered pages + * site: "https://example.com", + * output: "server", // required, with no prerendered pages * adapter: node({ * mode: 'standalone', * }), - * i18n: { - * defaultLocale: "en", - * locales: ["en", "fr", "pt-br", "es"], + * i18n: { + * defaultLocale: "en", + * locales: ["en", "fr", "pt-br", "es"], * prefixDefaultLocale: false, - * domains: { - * fr: "https://fr.example.com", + * domains: { + * fr: "https://fr.example.com", * es: "https://example.es" - * }, + * } + * }, * }) * ``` *