From 571e184d5a883772f9d8f16369c3b2be4d4e437f Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Wed, 3 Jul 2024 07:10:40 -0700 Subject: [PATCH 1/3] [ci] release (#11351) Co-authored-by: github-actions[bot] --- .changeset/brave-mayflies-share.md | 5 -- .changeset/curvy-elephants-fry.md | 5 -- .changeset/curvy-kids-call.md | 5 -- .changeset/fair-wolves-move.md | 5 -- .changeset/small-ties-sort.md | 5 -- 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-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 | 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/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 | 2 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 2 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 14 +++++ packages/astro/package.json | 2 +- pnpm-lock.yaml | 58 ++++++++++----------- 37 files changed, 73 insertions(+), 84 deletions(-) delete mode 100644 .changeset/brave-mayflies-share.md delete mode 100644 .changeset/curvy-elephants-fry.md delete mode 100644 .changeset/curvy-kids-call.md delete mode 100644 .changeset/fair-wolves-move.md delete mode 100644 .changeset/small-ties-sort.md diff --git a/.changeset/brave-mayflies-share.md b/.changeset/brave-mayflies-share.md deleted file mode 100644 index d755fb778ce4..000000000000 --- a/.changeset/brave-mayflies-share.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an issue where creating manually the i18n middleware could break the logic of the functions of the virtual module `astro:i18n` diff --git a/.changeset/curvy-elephants-fry.md b/.changeset/curvy-elephants-fry.md deleted file mode 100644 index 41bbd9e4c3eb..000000000000 --- a/.changeset/curvy-elephants-fry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an issue where Astro didn't throw an error when `Astro.rewrite` was used without providing the experimental flag diff --git a/.changeset/curvy-kids-call.md b/.changeset/curvy-kids-call.md deleted file mode 100644 index 72dfbb9ee1ea..000000000000 --- a/.changeset/curvy-kids-call.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an issue where the rewrites didn't update the status code when using manual i18n routing. diff --git a/.changeset/fair-wolves-move.md b/.changeset/fair-wolves-move.md deleted file mode 100644 index 8e64bbf9634d..000000000000 --- a/.changeset/fair-wolves-move.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Adjusts the color of punctuations in error overlay. diff --git a/.changeset/small-ties-sort.md b/.changeset/small-ties-sort.md deleted file mode 100644 index 2269d714d28a..000000000000 --- a/.changeset/small-ties-sort.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes attribute rendering for non-boolean attributes with boolean values diff --git a/examples/basics/package.json b/examples/basics/package.json index b3fe9f0a0e82..13aaf8da048f 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index de50f5c2cf65..a43453d187f5 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^3.1.2", "@astrojs/rss": "^4.0.7", "@astrojs/sitemap": "^3.1.6", - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/component/package.json b/examples/component/package.json index 978663b9a210..26792e35f1d6 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index 98808db7a4e7..ed080c585b59 100644 --- a/examples/container-with-vitest/package.json +++ b/examples/container-with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest run" }, "dependencies": { - "astro": "^4.11.3", + "astro": "^4.11.4", "@astrojs/react": "^3.6.0", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 21b5072bdafd..7e09720af1f7 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": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index 129de636ba6a..2c9fdd644454 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/lit": "^4.3.0", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^4.11.3", + "astro": "^4.11.4", "lit": "^3.1.4" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 55c6b8e5fa3d..caee3e34aaf0 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -18,7 +18,7 @@ "@astrojs/vue": "^4.5.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", - "astro": "^4.11.3", + "astro": "^4.11.4", "preact": "^10.22.1", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 7c87bdf62802..9ca9558eed04 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.0", "@preact/signals": "^1.2.3", - "astro": "^4.11.3", + "astro": "^4.11.4", "preact": "^10.22.1" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 67db6e6366a1..14b469e4727f 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -14,7 +14,7 @@ "@astrojs/react": "^3.6.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", - "astro": "^4.11.3", + "astro": "^4.11.4", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 1b6b827e4f1a..1f52ca38c347 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^4.4.0", - "astro": "^4.11.3", + "astro": "^4.11.4", "solid-js": "^1.8.18" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index d10d741645a2..c95782454d47 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^5.6.0", - "astro": "^4.11.3", + "astro": "^4.11.4", "svelte": "^4.2.18" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 1a24194b37b5..f701d02e9c6b 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/vue": "^4.5.0", - "astro": "^4.11.3", + "astro": "^4.11.4", "vue": "^3.4.31" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 5ecfb6c4d48f..ae991e2f5cfe 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/node": "^8.3.2", - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index fc68f9f59ae6..901304f6170f 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index 784a92647f19..23eef19b510a 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@astrojs/node": "^8.3.2", - "astro": "^4.11.3", + "astro": "^4.11.4", "html-minifier": "^4.0.0" }, "devDependencies": { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 76cdfa03afbf..892a8282553d 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index ea5d4786dad2..64d485247de5 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 24a29eda9498..5909ee16d9e1 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 376303f2c8ee..c781f422bcad 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -14,7 +14,7 @@ "dependencies": { "@astrojs/node": "^8.3.2", "@astrojs/svelte": "^5.6.0", - "astro": "^4.11.3", + "astro": "^4.11.4", "svelte": "^4.2.18" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index bc3524edb6c9..4b7547f427da 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.11.3", + "astro": "^4.11.4", "sass": "^1.77.6", "sharp": "^0.33.3" } diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index fa10bd67fba7..561516c5c2bd 100644 --- a/examples/toolbar-app/package.json +++ b/examples/toolbar-app/package.json @@ -15,6 +15,6 @@ "./app": "./dist/app.js" }, "devDependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index 268fd4f9dcd8..c12529f663b5 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -12,6 +12,6 @@ "devDependencies": { "@astrojs/tailwind": "^5.1.0", "@astrojs/node": "^8.3.2", - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 060e59fe89ad..2b3eca8582c6 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/markdoc": "^0.11.1", - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 8b55a2d9fcb1..9ffbddcd4015 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^5.1.1", - "astro": "^4.11.3", + "astro": "^4.11.4", "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 c35f5d90454f..c2b6f4273115 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.11.3" + "astro": "^4.11.4" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 7a48c83364e1..bba28193a502 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/mdx": "^3.1.2", "@astrojs/preact": "^3.5.0", - "astro": "^4.11.3", + "astro": "^4.11.4", "preact": "^10.22.1" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 9f450e18751b..3093f3fa7b8f 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.0", "@nanostores/preact": "^0.5.1", - "astro": "^4.11.3", + "astro": "^4.11.4", "nanostores": "^0.10.3", "preact": "^10.22.1" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 4310a3351c26..a04a51bf4173 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^3.1.2", "@astrojs/tailwind": "^5.1.0", "@types/canvas-confetti": "^1.6.4", - "astro": "^4.11.3", + "astro": "^4.11.4", "autoprefixer": "^10.4.19", "canvas-confetti": "^1.9.3", "postcss": "^8.4.39", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 9e687e22c4c5..1ddc9b813703 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.11.3", + "astro": "^4.11.4", "vitest": "^1.6.0" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index db06c91c3593..ffa925bc4eeb 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,19 @@ # astro +## 4.11.4 + +### Patch Changes + +- [#11362](https://github.com/withastro/astro/pull/11362) [`93993b7`](https://github.com/withastro/astro/commit/93993b77cf4915b4c0d245df9ecbf2265f5893e7) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where creating manually the i18n middleware could break the logic of the functions of the virtual module `astro:i18n` + +- [#11349](https://github.com/withastro/astro/pull/11349) [`98d9ce4`](https://github.com/withastro/astro/commit/98d9ce41f20c8bf024c937e8bde80d3c3dbbed99) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where Astro didn't throw an error when `Astro.rewrite` was used without providing the experimental flag + +- [#11352](https://github.com/withastro/astro/pull/11352) [`a55ee02`](https://github.com/withastro/astro/commit/a55ee0268e1ca22597e9b5e6d1f24b4f28ad978b) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where the rewrites didn't update the status code when using manual i18n routing. + +- [#11388](https://github.com/withastro/astro/pull/11388) [`3a223b4`](https://github.com/withastro/astro/commit/3a223b4811708cc93ebb27706118c1723e1fc013) Thanks [@mingjunlu](https://github.com/mingjunlu)! - Adjusts the color of punctuations in error overlay. + +- [#11369](https://github.com/withastro/astro/pull/11369) [`e6de11f`](https://github.com/withastro/astro/commit/e6de11f4a941e29123da3714e5b8f17d25744f0f) Thanks [@bluwy](https://github.com/bluwy)! - Fixes attribute rendering for non-boolean attributes with boolean values + ## 4.11.3 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index b5bb61255a8d..003ecd411b86 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.11.3", + "version": "4.11.4", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 46d1ddd5ba53..e9969dbcbe97 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,7 +128,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/blog: @@ -143,13 +143,13 @@ importers: specifier: ^3.1.6 version: link:../../packages/integrations/sitemap astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/container-with-vitest: @@ -158,7 +158,7 @@ importers: specifier: ^3.6.0 version: link:../../packages/integrations/react astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -189,7 +189,7 @@ importers: specifier: ^3.14.1 version: 3.14.1 astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/framework-lit: @@ -201,7 +201,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro lit: specifier: ^3.1.4 @@ -231,7 +231,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro preact: specifier: ^10.22.1 @@ -261,7 +261,7 @@ importers: specifier: ^1.2.3 version: 1.2.3(preact@10.22.1) astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro preact: specifier: ^10.22.1 @@ -279,7 +279,7 @@ importers: specifier: ^18.3.0 version: 18.3.0 astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -294,7 +294,7 @@ importers: specifier: ^4.4.0 version: link:../../packages/integrations/solid astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro solid-js: specifier: ^1.8.18 @@ -306,7 +306,7 @@ importers: specifier: ^5.6.0 version: link:../../packages/integrations/svelte astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro svelte: specifier: ^4.2.18 @@ -318,7 +318,7 @@ importers: specifier: ^4.5.0 version: link:../../packages/integrations/vue astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro vue: specifier: ^3.4.31 @@ -330,13 +330,13 @@ importers: specifier: ^8.3.2 version: link:../../packages/integrations/node astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/middleware: @@ -345,7 +345,7 @@ importers: specifier: ^8.3.2 version: link:../../packages/integrations/node astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -358,19 +358,19 @@ importers: examples/minimal: dependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/ssr: @@ -382,7 +382,7 @@ importers: specifier: ^5.6.0 version: link:../../packages/integrations/svelte astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro svelte: specifier: ^4.2.18 @@ -391,7 +391,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro sass: specifier: ^1.77.6 @@ -403,7 +403,7 @@ importers: examples/toolbar-app: devDependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/view-transitions: @@ -415,7 +415,7 @@ importers: specifier: ^5.1.0 version: link:../../packages/integrations/tailwind astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/with-markdoc: @@ -424,7 +424,7 @@ importers: specifier: ^0.11.1 version: link:../../packages/integrations/markdoc astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/with-markdown-plugins: @@ -433,7 +433,7 @@ importers: specifier: ^5.1.1 version: link:../../packages/markdown/remark astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro hast-util-select: specifier: ^6.0.2 @@ -454,7 +454,7 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro examples/with-mdx: @@ -466,7 +466,7 @@ importers: specifier: ^3.5.0 version: link:../../packages/integrations/preact astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro preact: specifier: ^10.22.1 @@ -481,7 +481,7 @@ importers: specifier: ^0.5.1 version: 0.5.1(nanostores@0.10.3)(preact@10.22.1) astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro nanostores: specifier: ^0.10.3 @@ -502,7 +502,7 @@ importers: specifier: ^1.6.4 version: 1.6.4 astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro autoprefixer: specifier: ^10.4.19 @@ -520,7 +520,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^4.11.3 + specifier: ^4.11.4 version: link:../../packages/astro vitest: specifier: ^1.6.0 From b9e906f8e75444739aa259b62489d9f5749260b9 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Wed, 3 Jul 2024 17:44:51 -0400 Subject: [PATCH 2/3] Revert "Fix attribute rendering for boolean values (#11369)" (#11408) * Revert "Fix attribute rendering for boolean values (#11369)" This reverts commit e6de11f4a941e29123da3714e5b8f17d25744f0f. * Add a changeset --- .changeset/calm-rules-trade.md | 5 +++ .../astro/src/runtime/server/render/util.ts | 21 ++++++---- packages/astro/test/astro-attrs.test.js | 38 +++++-------------- .../astro-attrs/src/pages/index.astro | 35 ++++++----------- .../mdx/test/mdx-vite-env-vars.test.js | 4 +- 5 files changed, 41 insertions(+), 62 deletions(-) create mode 100644 .changeset/calm-rules-trade.md diff --git a/.changeset/calm-rules-trade.md b/.changeset/calm-rules-trade.md new file mode 100644 index 000000000000..eae01ad84706 --- /dev/null +++ b/.changeset/calm-rules-trade.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Revert change to how boolean attributes work diff --git a/packages/astro/src/runtime/server/render/util.ts b/packages/astro/src/runtime/server/render/util.ts index 31a78a92eea1..469491de4edf 100644 --- a/packages/astro/src/runtime/server/render/util.ts +++ b/packages/astro/src/runtime/server/render/util.ts @@ -8,6 +8,9 @@ export const voidElementNames = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i; const htmlBooleanAttributes = /^(?:allowfullscreen|async|autofocus|autoplay|controls|default|defer|disabled|disablepictureinpicture|disableremoteplayback|formnovalidate|hidden|loop|nomodule|novalidate|open|playsinline|readonly|required|reversed|scoped|seamless|itemscope)$/i; +const htmlEnumAttributes = /^(?:contenteditable|draggable|spellcheck|value)$/i; +// Note: SVG is case-sensitive! +const svgEnumAttributes = /^(?:autoReverse|externalResourcesRequired|focusable|preserveAlpha)$/i; const AMPERSAND_REGEX = /&/g; const DOUBLE_QUOTE_REGEX = /"/g; @@ -64,6 +67,13 @@ export function addAttribute(value: any, key: string, shouldEscape = true) { return ''; } + if (value === false) { + if (htmlEnumAttributes.test(key) || svgEnumAttributes.test(key)) { + return markHTMLString(` ${key}="false"`); + } + return ''; + } + // compiler directives cannot be applied dynamically, log a warning and ignore. if (STATIC_DIRECTIVES.has(key)) { // eslint-disable-next-line no-console @@ -105,16 +115,11 @@ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the } // Boolean values only need the key - if (htmlBooleanAttributes.test(key)) { - return markHTMLString(value ? ` ${key}` : ''); - } - - // Other attributes with an empty string value can omit rendering the value - if (value === '') { + if (value === true && (key.startsWith('data-') || htmlBooleanAttributes.test(key))) { return markHTMLString(` ${key}`); + } else { + return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`); } - - return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`); } // Adds support for ` diff --git a/packages/astro/test/astro-attrs.test.js b/packages/astro/test/astro-attrs.test.js index 58d1ddbbb5f0..f4a0140427a5 100644 --- a/packages/astro/test/astro-attrs.test.js +++ b/packages/astro/test/astro-attrs.test.js @@ -16,41 +16,21 @@ describe('Attributes', async () => { const $ = cheerio.load(html); const attrs = { - 'boolean-attr-true': { attribute: 'allowfullscreen', value: '' }, - 'boolean-attr-false': { attribute: 'allowfullscreen', value: undefined }, - 'boolean-attr-string-truthy': { attribute: 'allowfullscreen', value: '' }, - 'boolean-attr-string-falsy': { attribute: 'allowfullscreen', value: undefined }, - 'boolean-attr-number-truthy': { attribute: 'allowfullscreen', value: '' }, - 'boolean-attr-number-falsy': { attribute: 'allowfullscreen', value: undefined }, - 'data-attr-true': { attribute: 'data-foobar', value: 'true' }, - 'data-attr-false': { attribute: 'data-foobar', value: 'false' }, - 'data-attr-string-truthy': { attribute: 'data-foobar', value: 'foo' }, - 'data-attr-string-falsy': { attribute: 'data-foobar', value: '' }, - 'data-attr-number-truthy': { attribute: 'data-foobar', value: '1' }, - 'data-attr-number-falsy': { attribute: 'data-foobar', value: '0' }, - 'normal-attr-true': { attribute: 'foobar', value: 'true' }, - 'normal-attr-false': { attribute: 'foobar', value: 'false' }, - 'normal-attr-string-truthy': { attribute: 'foobar', value: 'foo' }, - 'normal-attr-string-falsy': { attribute: 'foobar', value: '' }, - 'normal-attr-number-truthy': { attribute: 'foobar', value: '1' }, - 'normal-attr-number-falsy': { attribute: 'foobar', value: '0' }, + 'false-str': { attribute: 'attr', value: 'false' }, + 'true-str': { attribute: 'attr', value: 'true' }, + false: { attribute: 'attr', value: undefined }, + true: { attribute: 'attr', value: 'true' }, + empty: { attribute: 'attr', value: '' }, null: { attribute: 'attr', value: undefined }, undefined: { attribute: 'attr', value: undefined }, + 'html-boolean': { attribute: 'async', value: 'async' }, + 'html-boolean-true': { attribute: 'async', value: 'async' }, + 'html-boolean-false': { attribute: 'async', value: undefined }, 'html-enum': { attribute: 'draggable', value: 'true' }, 'html-enum-true': { attribute: 'draggable', value: 'true' }, 'html-enum-false': { attribute: 'draggable', value: 'false' }, }; - assert.ok(!/allowfullscreen=/.test(html), 'boolean attributes should not have values'); - assert.ok( - !/id="data-attr-string-falsy"\s+data-foobar=/.test(html), - "data attributes should not have values if it's an empty string" - ); - assert.ok( - !/id="normal-attr-string-falsy"\s+data-foobar=/.test(html), - "normal attributes should not have values if it's an empty string" - ); - // cheerio will unescape the values, so checking that the url rendered unescaped to begin with has to be done manually assert.equal( html.includes('https://example.com/api/og?title=hello&description=somedescription'), @@ -66,7 +46,7 @@ describe('Attributes', async () => { for (const id of Object.keys(attrs)) { const { attribute, value } = attrs[id]; const attr = $(`#${id}`).attr(attribute); - assert.equal(attr, value, `Expected ${attribute} to be ${value} for #${id}`); + assert.equal(attr, value); } }); diff --git a/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro b/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro index 8f2576650f62..7ac96635fd14 100644 --- a/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro +++ b/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro @@ -1,30 +1,19 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + - /tmp/hello.txt"} /> - + + + +