From bde49f186e4d620ce0c926353db38215e33dceef Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 15 Nov 2024 20:50:01 +0800 Subject: [PATCH 01/18] Publish missing file for svelte integration (#12442) --- .changeset/wild-houses-learn.md | 5 +++++ packages/integrations/svelte/package.json | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changeset/wild-houses-learn.md diff --git a/.changeset/wild-houses-learn.md b/.changeset/wild-houses-learn.md new file mode 100644 index 000000000000..6f86fe6c7d14 --- /dev/null +++ b/.changeset/wild-houses-learn.md @@ -0,0 +1,5 @@ +--- +'@astrojs/svelte': patch +--- + +Publishes missing file diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 017e9e2ea8b3..60e8f8704da8 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -24,15 +24,12 @@ "./editor": "./dist/editor.cjs", "./*": "./*", "./client.js": "./client.svelte.js", - "./server.js": { - "default": "./server.js", - "types": "./server.d.ts" - }, + "./server.js": "./server.js", "./package.json": "./package.json" }, "files": [ "dist", - "client.js", + "client.svelte.js", "server.js", "server.d.ts" ], From 8e135b6f036a37c5df7884209e767e298262bad7 Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Fri, 15 Nov 2024 04:59:51 -0800 Subject: [PATCH 02/18] [ci] release (#12443) Co-authored-by: github-actions[bot] --- .changeset/wild-houses-learn.md | 5 ----- examples/framework-multiple/package.json | 2 +- examples/framework-svelte/package.json | 2 +- examples/ssr/package.json | 2 +- packages/integrations/svelte/CHANGELOG.md | 6 ++++++ packages/integrations/svelte/package.json | 2 +- pnpm-lock.yaml | 6 +++--- 7 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 .changeset/wild-houses-learn.md diff --git a/.changeset/wild-houses-learn.md b/.changeset/wild-houses-learn.md deleted file mode 100644 index 6f86fe6c7d14..000000000000 --- a/.changeset/wild-houses-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/svelte': patch ---- - -Publishes missing file diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index e9c92a4a89e9..d8b86a81dcf1 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -14,7 +14,7 @@ "@astrojs/preact": "^3.5.3", "@astrojs/react": "^3.6.2", "@astrojs/solid-js": "^4.4.3", - "@astrojs/svelte": "^6.0.0", + "@astrojs/svelte": "^6.0.1", "@astrojs/vue": "^4.5.2", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 87530dfc52bc..2a06f5d65c58 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/svelte": "^6.0.0", + "@astrojs/svelte": "^6.0.1", "astro": "^4.16.13", "svelte": "^5.1.16" } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index f3fd53b2a5f4..88802eada33b 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@astrojs/node": "^8.3.4", - "@astrojs/svelte": "^6.0.0", + "@astrojs/svelte": "^6.0.1", "astro": "^4.16.13", "svelte": "^5.1.16" } diff --git a/packages/integrations/svelte/CHANGELOG.md b/packages/integrations/svelte/CHANGELOG.md index 4199a0dd698c..81985044c401 100644 --- a/packages/integrations/svelte/CHANGELOG.md +++ b/packages/integrations/svelte/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/svelte +## 6.0.1 + +### Patch Changes + +- [#12442](https://github.com/withastro/astro/pull/12442) [`bde49f1`](https://github.com/withastro/astro/commit/bde49f186e4d620ce0c926353db38215e33dceef) Thanks [@bluwy](https://github.com/bluwy)! - Publishes missing file + ## 6.0.0 ### Major Changes diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 60e8f8704da8..4a32ec3d4d54 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/svelte", - "version": "6.0.0", + "version": "6.0.1", "description": "Use Svelte components within Astro", "type": "module", "types": "./dist/index.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84f5b46758f6..bf17ca08c1f4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -230,7 +230,7 @@ importers: specifier: ^4.4.3 version: link:../../packages/integrations/solid '@astrojs/svelte': - specifier: ^6.0.0 + specifier: ^6.0.1 version: link:../../packages/integrations/svelte '@astrojs/vue': specifier: ^4.5.2 @@ -314,7 +314,7 @@ importers: examples/framework-svelte: dependencies: '@astrojs/svelte': - specifier: ^6.0.0 + specifier: ^6.0.1 version: link:../../packages/integrations/svelte astro: specifier: ^4.16.13 @@ -368,7 +368,7 @@ importers: specifier: ^8.3.4 version: 8.3.4(astro@packages+astro) '@astrojs/svelte': - specifier: ^6.0.0 + specifier: ^6.0.1 version: link:../../packages/integrations/svelte astro: specifier: ^4.16.13 From cec4af8fe59ff895c0ca82aab8b6ed6a81ad1f4d Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 15 Nov 2024 23:43:34 +0800 Subject: [PATCH 03/18] Add publint checks (#12445) --- .github/workflows/ci.yml | 5 +- package.json | 4 +- packages/astro-prism/package.json | 2 +- packages/astro-rss/package.json | 2 +- packages/astro/package.json | 2 +- packages/create-astro/package.json | 2 +- packages/db/package.json | 2 +- packages/integrations/alpinejs/package.json | 2 +- packages/integrations/cloudflare/package.json | 1 + packages/integrations/lit/package.json | 7 +- packages/integrations/markdoc/package.json | 2 +- packages/integrations/mdx/package.json | 2 +- packages/integrations/netlify/package.json | 1 + packages/integrations/node/package.json | 1 + packages/integrations/partytown/package.json | 2 +- packages/integrations/preact/package.json | 2 +- packages/integrations/react/package.json | 12 +- packages/integrations/sitemap/package.json | 2 +- packages/integrations/solid/package.json | 2 +- packages/integrations/svelte/package.json | 2 +- packages/integrations/tailwind/package.json | 2 +- packages/integrations/vercel/package.json | 1 + packages/integrations/vue/package.json | 7 +- packages/integrations/web-vitals/package.json | 2 +- packages/internal-helpers/package.json | 2 +- packages/markdown/remark/package.json | 2 +- packages/studio/package.json | 2 +- packages/telemetry/package.json | 2 +- packages/underscore-redirects/package.json | 2 +- packages/upgrade/package.json | 2 +- pnpm-lock.yaml | 108 ++++++++++++++++++ 31 files changed, 147 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a494b31794e..cde351c7c2e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,9 +95,12 @@ jobs: - name: Build Packages run: pnpm run build - - name: Lint + - name: Lint source code run: pnpm run lint:ci + - name: Lint publish code + run: pnpm run publint + test: name: "Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})" runs-on: ${{ matrix.os }} diff --git a/package.json b/package.json index 861fcb21c148..91d7ee962a46 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "private": true, "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git" + "url": "git+https://github.com/withastro/astro.git" }, "scripts": { "release": "pnpm run build && changeset publish", @@ -37,6 +37,7 @@ "lint": "biome lint && eslint . --report-unused-disable-directives", "lint:ci": "biome ci --formatter-enabled=false --organize-imports-enabled=false --reporter=github && eslint . --report-unused-disable-directives", "lint:fix": "biome lint --write --unsafe", + "publint": "pnpm -r --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --no-bail exec publint", "version": "changeset version && node ./scripts/deps/update-example-versions.js && pnpm install --no-frozen-lockfile && pnpm run format", "preinstall": "npx only-allow pnpm" }, @@ -65,6 +66,7 @@ "only-allow": "^1.2.1", "prettier": "^3.3.3", "prettier-plugin-astro": "^0.14.1", + "publint": "^0.2.12", "turbo": "^2.2.3", "typescript": "~5.6.3", "typescript-eslint": "^8.13.0" diff --git a/packages/astro-prism/package.json b/packages/astro-prism/package.json index 82c0c336055c..f3ba16f4e83e 100644 --- a/packages/astro-prism/package.json +++ b/packages/astro-prism/package.json @@ -8,7 +8,7 @@ "bugs": "https://github.com/withastro/astro/issues", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/astro-prism" }, "homepage": "https://docs.astro.build/en/reference/api-reference/#prism-", diff --git a/packages/astro-rss/package.json b/packages/astro-rss/package.json index 8de405fd7c97..627b4dd6ca6d 100644 --- a/packages/astro-rss/package.json +++ b/packages/astro-rss/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/astro-rss" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/astro/package.json b/packages/astro/package.json index 70b89aa19a3a..fb0440afa9a5 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/astro" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json index 30889d515a04..1601e4f7cb08 100644 --- a/packages/create-astro/package.json +++ b/packages/create-astro/package.json @@ -6,7 +6,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/create-astro" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/db/package.json b/packages/db/package.json index d40b36842f6b..82990e640632 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -5,7 +5,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/db" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/integrations/alpinejs/package.json b/packages/integrations/alpinejs/package.json index 31964387602f..15365c38d4a4 100644 --- a/packages/integrations/alpinejs/package.json +++ b/packages/integrations/alpinejs/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/alpinejs" }, "keywords": [ diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index 9e6bf7f83685..05e18bc64727 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/cloudflare", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/lit/package.json b/packages/integrations/lit/package.json index 27650a1f7306..1153bdc943db 100644 --- a/packages/integrations/lit/package.json +++ b/packages/integrations/lit/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/lit" }, "keywords": [ @@ -21,10 +21,7 @@ "homepage": "https://docs.astro.build/en/guides/integrations-guide/lit/", "exports": { ".": "./dist/index.js", - "./server.js": { - "default": "./server.js", - "types": "./server.d.ts" - }, + "./server.js": "./server.js", "./client-shim.js": "./client-shim.js", "./dist/client.js": "./dist/client.js", "./hydration-support.js": "./hydration-support.js", diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 757bc063a59e..cd8fb06379de 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/markdoc" }, "keywords": [ diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index cac6e8f4cea4..90b0877420fa 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/mdx" }, "keywords": [ diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index 2d9ce88d39c6..4b54bb6c090e 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/netlify", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 656c453933a9..134ba5d86a42 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/node", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/partytown/package.json b/packages/integrations/partytown/package.json index e8fd6e5e6b34..0a171c1c0ef3 100644 --- a/packages/integrations/partytown/package.json +++ b/packages/integrations/partytown/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/partytown" }, "keywords": [ diff --git a/packages/integrations/preact/package.json b/packages/integrations/preact/package.json index e88470166e70..c23925956143 100644 --- a/packages/integrations/preact/package.json +++ b/packages/integrations/preact/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/preact" }, "keywords": [ diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 2fadb89acfdc..9bb7a4e19332 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/react" }, "keywords": [ @@ -24,14 +24,8 @@ "./actions": "./dist/actions.js", "./client.js": "./client.js", "./client-v17.js": "./client-v17.js", - "./server.js": { - "default": "./server.js", - "types": "./server.d.ts" - }, - "./server-v17.js": { - "default": "./server-v17.js", - "types": "./server-v17.d.ts" - }, + "./server.js": "./server.js", + "./server-v17.js": "./server-v17.js", "./package.json": "./package.json", "./jsx-runtime": "./jsx-runtime.js" }, diff --git a/packages/integrations/sitemap/package.json b/packages/integrations/sitemap/package.json index 7e4bfb3a6730..ec4c02b8243d 100644 --- a/packages/integrations/sitemap/package.json +++ b/packages/integrations/sitemap/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/sitemap" }, "keywords": [ diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json index 103d7dae071a..d786893628d1 100644 --- a/packages/integrations/solid/package.json +++ b/packages/integrations/solid/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/solid" }, "keywords": [ diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 4a32ec3d4d54..2a25510b2fe8 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/svelte" }, "keywords": [ diff --git a/packages/integrations/tailwind/package.json b/packages/integrations/tailwind/package.json index 245d7d3381b9..e43a2657e168 100644 --- a/packages/integrations/tailwind/package.json +++ b/packages/integrations/tailwind/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/tailwind" }, "keywords": [ diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index 7fef2f9b898f..57beba344a59 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/vercel", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 1b191ffcfe07..325d8781f45f 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/vue" }, "keywords": [ @@ -24,10 +24,7 @@ "./editor": "./dist/editor.cjs", "./*": "./*", "./client.js": "./client.js", - "./server.js": { - "default": "./server.js", - "types": "./server.d.ts" - }, + "./server.js": "./server.js", "./package.json": "./package.json" }, "files": [ diff --git a/packages/integrations/web-vitals/package.json b/packages/integrations/web-vitals/package.json index 486ab8d3933e..3aa0616fc1e6 100644 --- a/packages/integrations/web-vitals/package.json +++ b/packages/integrations/web-vitals/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/web-vitals" }, "keywords": [ diff --git a/packages/internal-helpers/package.json b/packages/internal-helpers/package.json index bbf4938b0cea..9f5ebfbb0619 100644 --- a/packages/internal-helpers/package.json +++ b/packages/internal-helpers/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/internal-helpers" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/markdown/remark/package.json b/packages/markdown/remark/package.json index d765513b3e0a..9285aa489554 100644 --- a/packages/markdown/remark/package.json +++ b/packages/markdown/remark/package.json @@ -6,7 +6,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/markdown/remark" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/studio/package.json b/packages/studio/package.json index 4c85f3484f5e..5b06775f5304 100644 --- a/packages/studio/package.json +++ b/packages/studio/package.json @@ -5,7 +5,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/studio" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/telemetry/package.json b/packages/telemetry/package.json index 69aac31bc597..5111f168c018 100644 --- a/packages/telemetry/package.json +++ b/packages/telemetry/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/telemetry" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/underscore-redirects/package.json b/packages/underscore-redirects/package.json index 38de31d4bfcb..f8eeb15e2a9d 100644 --- a/packages/underscore-redirects/package.json +++ b/packages/underscore-redirects/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/underscore-redirects" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/upgrade/package.json b/packages/upgrade/package.json index 38655068b3b7..872f6e729590 100644 --- a/packages/upgrade/package.json +++ b/packages/upgrade/package.json @@ -6,7 +6,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/upgrade" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf17ca08c1f4..3066c199614d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,6 +48,9 @@ importers: prettier-plugin-astro: specifier: ^0.14.1 version: 0.14.1 + publint: + specifier: ^0.2.12 + version: 0.2.12 turbo: specifier: ^2.2.3 version: 2.2.3 @@ -8328,6 +8331,9 @@ packages: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} engines: {node: '>= 8'} + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + fsevents@2.3.2: resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -8372,6 +8378,11 @@ packages: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true + glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + deprecated: Glob versions prior to v9 are no longer supported + globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -8536,6 +8547,10 @@ packages: ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + ignore-walk@5.0.1: + resolution: {integrity: sha512-yemi4pMf51WKT7khInJqAvsIGzoqYXblnsz0ql8tM+yi1EKYTY1evX4NAbJrLL/Aanr2HyZeluqU+Oi7MGHokw==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -8554,6 +8569,10 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -9132,6 +9151,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -9267,6 +9290,19 @@ packages: resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} engines: {node: '>=0.10.0'} + npm-bundled@2.0.1: + resolution: {integrity: sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + + npm-normalize-package-bin@2.0.0: + resolution: {integrity: sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + + npm-packlist@5.1.3: + resolution: {integrity: sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + hasBin: true + npm-run-path@5.3.0: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -9290,6 +9326,9 @@ packages: resolution: {integrity: sha512-y1HRYy8s/RlcBvDUwKXSmkODMdx4KSuIvloCnQYJ2LdBBC1asY4HtfhXwe3UWknLakATZDnbzht2Ijw3M1EqFg==} engines: {node: '>=9.4.0 || ^8.9.4'} + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} @@ -9467,6 +9506,9 @@ packages: picocolors@1.1.0: resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -9772,6 +9814,11 @@ packages: psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + publint@0.2.12: + resolution: {integrity: sha512-YNeUtCVeM4j9nDiTT2OPczmlyzOkIXNtdDZnSuajAxS/nZ6j3t7Vs9SUB4euQNddiltIwu7Tdd3s+hr08fAsMw==} + engines: {node: '>=16'} + hasBin: true + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -10005,6 +10052,10 @@ packages: s.color@0.0.15: resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==} + sade@1.8.1: + resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} + engines: {node: '>=6'} + safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -10932,6 +10983,9 @@ packages: resolution: {integrity: sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==} engines: {node: '>=18'} + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + ws@8.18.0: resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} engines: {node: '>=10.0.0'} @@ -13948,6 +14002,8 @@ snapshots: dependencies: minipass: 3.3.6 + fs.realpath@1.0.0: {} + fsevents@2.3.2: optional: true @@ -13983,6 +14039,14 @@ snapshots: package-json-from-dist: 1.0.0 path-scurry: 1.11.1 + glob@8.1.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + globals@11.12.0: {} globals@14.0.0: {} @@ -14272,6 +14336,10 @@ snapshots: ieee754@1.2.1: {} + ignore-walk@5.0.1: + dependencies: + minimatch: 5.1.6 + ignore@5.3.2: {} immutable@4.3.7: {} @@ -14285,6 +14353,11 @@ snapshots: imurmurhash@0.1.4: {} + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + inherits@2.0.4: {} inline-style-parser@0.1.1: {} @@ -15133,6 +15206,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -15238,6 +15315,19 @@ snapshots: normalize-range@0.1.2: {} + npm-bundled@2.0.1: + dependencies: + npm-normalize-package-bin: 2.0.0 + + npm-normalize-package-bin@2.0.0: {} + + npm-packlist@5.1.3: + dependencies: + glob: 8.1.0 + ignore-walk: 5.0.1 + npm-bundled: 2.0.1 + npm-normalize-package-bin: 2.0.0 + npm-run-path@5.3.0: dependencies: path-key: 4.0.0 @@ -15256,6 +15346,10 @@ snapshots: on-net-listen@1.1.2: {} + once@1.4.0: + dependencies: + wrappy: 1.0.2 + onetime@5.1.2: dependencies: mimic-fn: 2.1.0 @@ -15436,6 +15530,8 @@ snapshots: picocolors@1.1.0: {} + picocolors@1.1.1: {} + picomatch@2.3.1: {} picomatch@4.0.2: {} @@ -15762,6 +15858,12 @@ snapshots: psl@1.9.0: {} + publint@0.2.12: + dependencies: + npm-packlist: 5.1.3 + picocolors: 1.1.1 + sade: 1.8.1 + punycode@2.3.1: {} querystringify@2.2.0: {} @@ -16113,6 +16215,10 @@ snapshots: s.color@0.0.15: {} + sade@1.8.1: + dependencies: + mri: 1.2.0 + safe-buffer@5.2.1: {} safer-buffer@2.1.2: {} @@ -17125,6 +17231,8 @@ snapshots: string-width: 7.2.0 strip-ansi: 7.1.0 + wrappy@1.0.2: {} + ws@8.18.0: {} xml-name-validator@5.0.0: {} From 25baa4ed0c5f55fa85c2c7e2c15848937ed1dc9b Mon Sep 17 00:00:00 2001 From: oliverlynch <59594611+oliverlynch@users.noreply.github.com> Date: Sat, 16 Nov 2024 01:25:42 +0800 Subject: [PATCH 04/18] Ensure final asset directory exists before writing cached files (#12418) Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> --- .changeset/thick-shrimps-hammer.md | 5 +++++ packages/astro/src/assets/build/generate.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/thick-shrimps-hammer.md diff --git a/.changeset/thick-shrimps-hammer.md b/.changeset/thick-shrimps-hammer.md new file mode 100644 index 000000000000..b46b9ad6c20f --- /dev/null +++ b/.changeset/thick-shrimps-hammer.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix cached image redownloading if it is the first asset diff --git a/packages/astro/src/assets/build/generate.ts b/packages/astro/src/assets/build/generate.ts index 645a0acdcbeb..da76cafa3842 100644 --- a/packages/astro/src/assets/build/generate.ts +++ b/packages/astro/src/assets/build/generate.ts @@ -153,6 +153,9 @@ export async function generateImagesForPath( const isLocalImage = isESMImportedImage(options.src); const finalFileURL = new URL('.' + filepath, env.clientRoot); + const finalFolderURL = new URL('./', finalFileURL); + await fs.promises.mkdir(finalFolderURL, { recursive: true }); + // For remote images, instead of saving the image directly, we save a JSON file with the image data and expiration date from the server const cacheFile = basename(filepath) + (isLocalImage ? '' : '.json'); const cachedFileURL = new URL(cacheFile, env.assetsCacheDir); @@ -194,9 +197,6 @@ export async function generateImagesForPath( // If the cache file doesn't exist, just move on, and we'll generate it } - const finalFolderURL = new URL('./', finalFileURL); - await fs.promises.mkdir(finalFolderURL, { recursive: true }); - // The original filepath or URL from the image transform const originalImagePath = isLocalImage ? (options.src as ImageMetadata).src From 6a243bf3c449adbd6fa846a8b8bcd0c5c0f9dfa4 Mon Sep 17 00:00:00 2001 From: Marijn Kneppers Date: Mon, 18 Nov 2024 11:48:54 +0100 Subject: [PATCH 05/18] Update links to linting and formatting files in the style guide (#12468) --- STYLE_GUIDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 52501fa38327..0c7239cfc127 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -16,8 +16,8 @@ Anything enforced by linting and formatting is considered a **style rule.** It i These style rules are maintained in configuration files, and therefore not documented in this document. Read any of the following configuration files to learn more about the style rules that we strictly enforced across the codebase: -- [ESLint](https://github.com/withastro/astro/blob/main/.eslintrc.cjs) (Linting) -- [Prettier](https://github.com/withastro/astro/blob/main/.prettierrc.json) (Formatting) +- [ESLint](https://github.com/withastro/astro/blob/main/eslint.config.js) (Linting) +- [Prettier](https://github.com/withastro/astro/blob/main/prettier.config.js) (Formatting) Alternatively, don't worry too much about style rules and trust that our tools will catch these issues for you and offer inline suggestions as you work. From 733d6c1601a8a95409c9707071ecf0b4cda3778a Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Mon, 18 Nov 2024 10:59:19 +0000 Subject: [PATCH 06/18] ci: remove owner check to enable external PR jobs (#12466) --- .github/workflows/continuous_benchmark.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/continuous_benchmark.yml b/.github/workflows/continuous_benchmark.yml index 10abc7bcd2e9..150c28626130 100644 --- a/.github/workflows/continuous_benchmark.yml +++ b/.github/workflows/continuous_benchmark.yml @@ -18,7 +18,6 @@ env: jobs: codspeed: - if: ${{ github.repository_owner == 'withastro' }} runs-on: ubuntu-latest permissions: contents: read From cc03d907c1fe6af4758afac34b318403bd75867a Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Mon, 18 Nov 2024 11:33:58 +0000 Subject: [PATCH 07/18] ci: filter paths of when running the benchmark action (#12470) --- .github/workflows/continuous_benchmark.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous_benchmark.yml b/.github/workflows/continuous_benchmark.yml index 150c28626130..00a7e0c5b1af 100644 --- a/.github/workflows/continuous_benchmark.yml +++ b/.github/workflows/continuous_benchmark.yml @@ -5,15 +5,20 @@ on: pull_request: branches: - main + paths: + - 'packages/astro/src/**/*.ts' + - 'benchmark/**' push: branches: - main + paths: + - 'packages/astro/src/**/*.ts' + - 'benchmark/**' env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }} FORCE_COLOR: true - CODSPEED_TOKEN: ${{ secrets.CODSPEED_TOKEN }} CODSPEED: true jobs: @@ -46,4 +51,5 @@ jobs: timeout-minutes: 30 with: run: pnpm benchmark codspeed + token: ${{ secrets.CODSPEED_TOKEN }} From 3bde4aa751c8bdf4f23edc86455b22061480583a Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Mon, 18 Nov 2024 13:34:43 +0000 Subject: [PATCH 08/18] chore: use Biome VCS ignore file (#12465) --- .github/scripts/announce.mjs | 64 +++++++++--------- .github/scripts/bundle-size.mjs | 52 +++++++++------ .github/scripts/utils.mjs | 86 ++++++++++++------------- biome.jsonc | 20 ++---- scripts/deps/update-example-versions.js | 2 +- 5 files changed, 114 insertions(+), 110 deletions(-) diff --git a/.github/scripts/announce.mjs b/.github/scripts/announce.mjs index 346e0f112b6f..27a3c71010f4 100755 --- a/.github/scripts/announce.mjs +++ b/.github/scripts/announce.mjs @@ -18,34 +18,34 @@ const descriptors = [ 'updates', ]; const verbs = [ - "just went out!", - "just launched!", - "now available!", - "in the wild!", - "now live!", - "hit the registry!", - "to share!", - "for you!", - "for y’all! 🤠", - "comin’ your way!", - "comin’ atcha!", - "comin’ in hot!", - "freshly minted on the blockchain! (jk)", - "[is] out (now with 100% more reticulated splines!)", - "(as seen on TV!)", - "just dropped!", - "– artisanally hand-crafted just for you.", - "– oh happy day!", - "– enjoy!", - "now out. Be the first on your block to download!", - "made with love 💕", - "[is] out! Our best [version] yet!", - "[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!", - "... HUZZAH!", - "[has] landed!", - "landed! The internet just got a little more fun.", - "– from our family to yours.", - "– go forth and build!" + 'just went out!', + 'just launched!', + 'now available!', + 'in the wild!', + 'now live!', + 'hit the registry!', + 'to share!', + 'for you!', + 'for y’all! 🤠', + 'comin’ your way!', + 'comin’ atcha!', + 'comin’ in hot!', + 'freshly minted on the blockchain! (jk)', + '[is] out (now with 100% more reticulated splines!)', + '(as seen on TV!)', + 'just dropped!', + '– artisanally hand-crafted just for you.', + '– oh happy day!', + '– enjoy!', + 'now out. Be the first on your block to download!', + 'made with love 💕', + '[is] out! Our best [version] yet!', + '[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!', + '... HUZZAH!', + '[has] landed!', + 'landed! The internet just got a little more fun.', + '– from our family to yours.', + '– go forth and build!', ]; const extraVerbs = [ 'new', @@ -72,7 +72,7 @@ const plurals = new Map([ function pluralize(text) { return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => - plurals.has(match) ? plurals.get(match) : `${match}s` + plurals.has(match) ? plurals.get(match) : `${match}s`, ); } @@ -91,7 +91,7 @@ async function generatePackageMap() { const pkgFile = fileURLToPath(new URL(pkg, packageRoot)); const content = await readFile(pkgFile).then((res) => JSON.parse(res.toString())); packageMap.set(content.name, `./packages/${pkg.replace('/package.json', '')}`); - }) + }), ); } @@ -110,7 +110,7 @@ async function generateMessage() { version, url: new URL(`${p}/CHANGELOG.md#${version.replace(/\./g, '')}`, baseUrl).toString(), }; - }) + }), ); const emoji = item(emojis); @@ -122,7 +122,7 @@ async function generateMessage() { if (packages.length === 1) { const { name, version, url } = packages[0]; message += `${emoji} \`${name}@${version}\` ${singularlize( - verb + verb, )}\nRead the [release notes →](<${url}>)\n`; } else { message += `${emoji} Some ${descriptor} ${pluralize(verb)}\n\n`; diff --git a/.github/scripts/bundle-size.mjs b/.github/scripts/bundle-size.mjs index 690d6e9284c4..b5ef31b48027 100644 --- a/.github/scripts/bundle-size.mjs +++ b/.github/scripts/bundle-size.mjs @@ -4,15 +4,15 @@ import { existsSync } from 'node:fs'; const CLIENT_RUNTIME_PATH = 'packages/astro/src/runtime/client/'; function formatBytes(bytes, decimals = 2) { - if (bytes === 0) return '0 B'; + if (bytes === 0) return '0 B'; - const k = 1024; - const dm = decimals < 0 ? 0 : decimals; - const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - const i = Math.floor(Math.log(bytes) / Math.log(k)); + const i = Math.floor(Math.log(bytes) / Math.log(k)); - return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; } export default async function checkBundleSize({ github, context }) { @@ -24,7 +24,7 @@ export default async function checkBundleSize({ github, context }) { pull_number: PR_NUM, }); const clientRuntimeFiles = files.filter((file) => { - return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed' + return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed'; }); if (clientRuntimeFiles.length === 0) return; @@ -35,17 +35,24 @@ export default async function checkBundleSize({ github, context }) { const output = await bundle(clientRuntimeFiles); for (let [filename, { oldSize, newSize, sourceFile }] of Object.entries(output)) { - filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename) ? `client:${filename}` : filename; - const prefix = (newSize - oldSize) === 0 ? '' : (newSize - oldSize) > 0 ? '+ ' : '- '; + filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename) + ? `client:${filename}` + : filename; + const prefix = newSize - oldSize === 0 ? '' : newSize - oldSize > 0 ? '+ ' : '- '; const change = `${prefix}${formatBytes(newSize - oldSize)}`; - table.push(`| [\`${filename}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${context.payload.pull_request.head.ref}/${sourceFile}) | ${formatBytes(oldSize)} | ${formatBytes(newSize)} | ${change} |`); + table.push( + `| [\`${filename}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${context.payload.pull_request.head.ref}/${sourceFile}) | ${formatBytes(oldSize)} | ${formatBytes(newSize)} | ${change} |`, + ); } const { data: comments } = await github.rest.issues.listComments({ ...context.repo, - issue_number: PR_NUM - }) - const comment = comments.find(comment => comment.user.login === 'github-actions[bot]' && comment.body.includes('Bundle Size Check')); + issue_number: PR_NUM, + }); + const comment = comments.find( + (comment) => + comment.user.login === 'github-actions[bot]' && comment.body.includes('Bundle Size Check'), + ); const method = comment ? 'updateComment' : 'createComment'; const payload = comment ? { comment_id: comment.id } : { issue_number: PR_NUM }; await github.rest.issues[method]({ @@ -60,9 +67,11 @@ ${table.join('\n')}`, } async function bundle(files) { - const { metafile } = await build({ - entryPoints: [...files.map(({ filename }) => filename), ...files.map(({ filename }) => `main/${filename}`).filter(f => existsSync(f))], + entryPoints: [ + ...files.map(({ filename }) => filename), + ...files.map(({ filename }) => `main/${filename}`).filter((f) => existsSync(f)), + ], bundle: true, minify: true, sourcemap: false, @@ -70,17 +79,24 @@ async function bundle(files) { outdir: 'out', external: ['astro:*', 'aria-query', 'axobject-query'], metafile: true, - }) + }); return Object.entries(metafile.outputs).reduce((acc, [filename, info]) => { filename = filename.slice('out/'.length); if (filename.startsWith('main/')) { filename = filename.slice('main/'.length).replace(CLIENT_RUNTIME_PATH, '').replace('.js', ''); const oldSize = info.bytes; - return Object.assign(acc, { [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { oldSize }) }); + return Object.assign(acc, { + [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { oldSize }), + }); } filename = filename.replace(CLIENT_RUNTIME_PATH, '').replace('.js', ''); const newSize = info.bytes; - return Object.assign(acc, { [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { newSize, sourceFile: Object.keys(info.inputs).find(src => src.endsWith('.ts')) }) }); + return Object.assign(acc, { + [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { + newSize, + sourceFile: Object.keys(info.inputs).find((src) => src.endsWith('.ts')), + }), + }); }, {}); } diff --git a/.github/scripts/utils.mjs b/.github/scripts/utils.mjs index da5befc2c288..9aaa383d816b 100644 --- a/.github/scripts/utils.mjs +++ b/.github/scripts/utils.mjs @@ -1,59 +1,53 @@ -import * as fs from 'node:fs' -import * as os from 'node:os' -import * as crypto from 'node:crypto' +import * as fs from 'node:fs'; +import * as os from 'node:os'; +import * as crypto from 'node:crypto'; /** Based on https://github.com/actions/toolkit/blob/4e3b068ce116d28cb840033c02f912100b4592b0/packages/core/src/file-command.ts */ export function setOutput(key, value) { - const filePath = process.env['GITHUB_OUTPUT'] || '' - if (filePath) { - return issueFileCommand('OUTPUT', prepareKeyValueMessage(key, value)) - } - process.stdout.write(os.EOL) + const filePath = process.env['GITHUB_OUTPUT'] || ''; + if (filePath) { + return issueFileCommand('OUTPUT', prepareKeyValueMessage(key, value)); + } + process.stdout.write(os.EOL); } function issueFileCommand(command, message) { - const filePath = process.env[`GITHUB_${command}`] - if (!filePath) { - throw new Error( - `Unable to find environment variable for file command ${command}` - ) - } - if (!fs.existsSync(filePath)) { - throw new Error(`Missing file at path: ${filePath}`) - } - - fs.appendFileSync(filePath, `${toCommandValue(message)}${os.EOL}`, { - encoding: 'utf8' - }) + const filePath = process.env[`GITHUB_${command}`]; + if (!filePath) { + throw new Error(`Unable to find environment variable for file command ${command}`); + } + if (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + + fs.appendFileSync(filePath, `${toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8', + }); } function prepareKeyValueMessage(key, value) { - const delimiter = `gh-delimiter-${crypto.randomUUID()}` - const convertedValue = toCommandValue(value) - - // These should realistically never happen, but just in case someone finds a - // way to exploit uuid generation let's not allow keys or values that contain - // the delimiter. - if (key.includes(delimiter)) { - throw new Error( - `Unexpected input: name should not contain the delimiter "${delimiter}"` - ) - } - - if (convertedValue.includes(delimiter)) { - throw new Error( - `Unexpected input: value should not contain the delimiter "${delimiter}"` - ) - } - - return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}` + const delimiter = `gh-delimiter-${crypto.randomUUID()}`; + const convertedValue = toCommandValue(value); + + // These should realistically never happen, but just in case someone finds a + // way to exploit uuid generation let's not allow keys or values that contain + // the delimiter. + if (key.includes(delimiter)) { + throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); + } + + if (convertedValue.includes(delimiter)) { + throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); + } + + return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; } function toCommandValue(input) { - if (input === null || input === undefined) { - return '' - } else if (typeof input === 'string' || input instanceof String) { - return input - } - return JSON.stringify(input) + if (input === null || input === undefined) { + return ''; + } else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); } diff --git a/biome.jsonc b/biome.jsonc index edd0ea87173d..adadd8f5978a 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,19 +1,13 @@ { "$schema": "https://biomejs.dev/schemas/1.9.3/schema.json", "files": { - "ignore": [ - "vendor", - "**/dist/**", - "**/smoke/**", - "**/fixtures/**", - "**/_temp-fixtures/**", - "**/vendor/**", - "**/.vercel/**", - "benchmark/projects/", - "benchmark/results/", - "benchmark/bench/_template.js", - ], - "include": ["test/**", "e2e/**", "packages/**", "/scripts/**", "benchmark/bench"], + "ignore": ["**/smoke/**", "**/fixtures/**", "**/_temp-fixtures/**", "**/vendor/**"], + "include": ["test/**", "e2e/**", "packages/**", "scripts/**", "benchmark/bench"], + }, + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true, }, "formatter": { "indentStyle": "tab", diff --git a/scripts/deps/update-example-versions.js b/scripts/deps/update-example-versions.js index 077c12b978dd..93b8b7140640 100644 --- a/scripts/deps/update-example-versions.js +++ b/scripts/deps/update-example-versions.js @@ -26,7 +26,7 @@ for (const workspaceDir of workspaceDirs) { const packageJson = await readAndParsePackageJson(packageJsonPath); if (!packageJson) continue; - if (packageJson.private === true) continue + if (packageJson.private === true) continue; if (!packageJson.name) { throw new Error(`${packageJsonPath} does not contain a "name" field.`); From f64934086e84966bcfd02b699d64a80cb8392fa2 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Mon, 18 Nov 2024 13:35:34 +0000 Subject: [PATCH 09/18] [ci] format --- .github/scripts/announce.mjs | 4 ++-- .github/scripts/bundle-size.mjs | 2 +- .github/scripts/utils.mjs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/scripts/announce.mjs b/.github/scripts/announce.mjs index 27a3c71010f4..2e05a7ae8a20 100755 --- a/.github/scripts/announce.mjs +++ b/.github/scripts/announce.mjs @@ -1,6 +1,6 @@ -import { globby as glob } from 'globby'; -import { fileURLToPath } from 'node:url'; import { readFile } from 'node:fs/promises'; +import { fileURLToPath } from 'node:url'; +import { globby as glob } from 'globby'; import { setOutput } from './utils.mjs'; const { GITHUB_REF = 'main' } = process.env; diff --git a/.github/scripts/bundle-size.mjs b/.github/scripts/bundle-size.mjs index b5ef31b48027..76d6b3f29724 100644 --- a/.github/scripts/bundle-size.mjs +++ b/.github/scripts/bundle-size.mjs @@ -1,5 +1,5 @@ -import { build } from 'esbuild'; import { existsSync } from 'node:fs'; +import { build } from 'esbuild'; const CLIENT_RUNTIME_PATH = 'packages/astro/src/runtime/client/'; diff --git a/.github/scripts/utils.mjs b/.github/scripts/utils.mjs index 9aaa383d816b..768302230150 100644 --- a/.github/scripts/utils.mjs +++ b/.github/scripts/utils.mjs @@ -1,6 +1,6 @@ +import * as crypto from 'node:crypto'; import * as fs from 'node:fs'; import * as os from 'node:os'; -import * as crypto from 'node:crypto'; /** Based on https://github.com/actions/toolkit/blob/4e3b068ce116d28cb840033c02f912100b4592b0/packages/core/src/file-command.ts */ export function setOutput(key, value) { From 80a9a5299a9d51f2b09900d3200976d687feae8f Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Tue, 19 Nov 2024 16:56:28 +0100 Subject: [PATCH 10/18] fix: content layer glob deletion (#12476) --- .changeset/six-pianos-draw.md | 5 +++++ packages/astro/src/content/loaders/glob.ts | 4 ++-- packages/astro/test/content-layer.test.js | 21 +++++++++++++++++++ .../src/pages/collections.json.js | 6 +++++- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .changeset/six-pianos-draw.md diff --git a/.changeset/six-pianos-draw.md b/.changeset/six-pianos-draw.md new file mode 100644 index 000000000000..61a6d07eb382 --- /dev/null +++ b/.changeset/six-pianos-draw.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a case where the Content Layer `glob()` loader would not update when renaming or deleting an entry diff --git a/packages/astro/src/content/loaders/glob.ts b/packages/astro/src/content/loaders/glob.ts index e0b1d79c1b94..4a515a92bf75 100644 --- a/packages/astro/src/content/loaders/glob.ts +++ b/packages/astro/src/content/loaders/glob.ts @@ -101,6 +101,7 @@ export function glob(globOptions: GlobOptions): Loader { const existingEntry = store.get(id); const digest = generateDigest(contents); + const filePath = fileURLToPath(fileUrl); if (existingEntry && existingEntry.digest === digest && existingEntry.filePath) { if (existingEntry.deferredRender) { @@ -112,11 +113,10 @@ export function glob(globOptions: GlobOptions): Loader { store.addAssetImports(existingEntry.assetImports, existingEntry.filePath); } + fileToIdMap.set(filePath, id); return; } - const filePath = fileURLToPath(fileUrl); - const relativePath = posixRelative(fileURLToPath(config.root), filePath); const parsedData = await parseData({ diff --git a/packages/astro/test/content-layer.test.js b/packages/astro/test/content-layer.test.js index d8bd7bd2d052..1f2ceb7d86d8 100644 --- a/packages/astro/test/content-layer.test.js +++ b/packages/astro/test/content-layer.test.js @@ -323,5 +323,26 @@ describe('Content Layer', () => { assert.equal(res.status, 500); assert.ok(text.includes('RenderUndefinedEntryError')); }); + + it('update the store when a file is renamed', async () => { + const rawJsonResponse = await fixture.fetch('/collections.json'); + const initialJson = devalue.parse(await rawJsonResponse.text()); + assert.equal(initialJson.numbers.map((e) => e.id).includes('src/data/glob-data/three'), true); + + const oldPath = new URL('./data/glob-data/three.json', fixture.config.srcDir); + const newPath = new URL('./data/glob-data/four.json', fixture.config.srcDir); + + await fs.rename(oldPath, newPath); + await fixture.onNextDataStoreChange(); + + try { + const updatedJsonResponse = await fixture.fetch('/collections.json'); + const updated = devalue.parse(await updatedJsonResponse.text()); + assert.equal(updated.numbers.map((e) => e.id).includes('src/data/glob-data/three'), false); + assert.equal(updated.numbers.map((e) => e.id).includes('src/data/glob-data/four'), true); + } finally { + await fs.rename(newPath, oldPath); + } + }); }); }); diff --git a/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js b/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js index 5bce6ed54e6a..d218613fa7e1 100644 --- a/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js +++ b/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js @@ -19,6 +19,9 @@ export async function GET() { const increment = await getEntry('increment', 'value'); const images = await getCollection('images'); + + const numbers = await getCollection('numbers'); + return new Response( devalue.stringify({ customLoader, @@ -29,7 +32,8 @@ export async function GET() { entryWithImagePath, referencedEntry, increment, - images + images, + numbers, }) ); } From 46f6b386b3db6332f286d79958ef10261958cceb Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 19 Nov 2024 16:12:40 +0000 Subject: [PATCH 11/18] fix(build): generated entry (#12477) --- .changeset/thin-cups-peel.md | 5 +++++ packages/astro/src/core/build/plugins/plugin-ssr.ts | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changeset/thin-cups-peel.md diff --git a/.changeset/thin-cups-peel.md b/.changeset/thin-cups-peel.md new file mode 100644 index 000000000000..3fc4678cb5cf --- /dev/null +++ b/.changeset/thin-cups-peel.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes an issue where the SSR build was emitting the `dist/server/entry.mjs` file with an incorrect import at the top of the file/ diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 883cdee38831..eb59eff6501f 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -283,7 +283,6 @@ function generateSSRCode(settings: AstroSettings, adapter: AstroAdapter, middlew `import { renderers } from '${RENDERERS_MODULE_ID}';`, `import * as serverEntrypointModule from '${ADAPTER_VIRTUAL_MODULE_ID}';`, `import { manifest as defaultManifest } from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';`, - edgeMiddleware ? `` : `import { onRequest as middleware } from '${middlewareId}';`, settings.config.experimental.serverIslands ? `import { serverIslandMap } from '${VIRTUAL_ISLAND_MAP_ID}';` : '', From c3b7e7cfa13603c08eb923703f31a92d514e82db Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Wed, 20 Nov 2024 06:09:43 -0500 Subject: [PATCH 12/18] Remove default throw behavior in astro:env (#12480) Co-authored-by: Emanuele Stoppa --- .changeset/early-scissors-beg.md | 5 +++++ packages/astro/src/core/app/pipeline.ts | 1 - packages/astro/src/core/base-pipeline.ts | 8 -------- packages/astro/src/core/errors/errors-data.ts | 11 ----------- 4 files changed, 5 insertions(+), 20 deletions(-) create mode 100644 .changeset/early-scissors-beg.md diff --git a/.changeset/early-scissors-beg.md b/.changeset/early-scissors-beg.md new file mode 100644 index 000000000000..0b3d85e430d0 --- /dev/null +++ b/.changeset/early-scissors-beg.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Removes the default throw behavior in `astro:env` diff --git a/packages/astro/src/core/app/pipeline.ts b/packages/astro/src/core/app/pipeline.ts index 4f753419a004..f3813e12acf7 100644 --- a/packages/astro/src/core/app/pipeline.ts +++ b/packages/astro/src/core/app/pipeline.ts @@ -54,7 +54,6 @@ export class AppPipeline extends Pipeline { undefined, undefined, undefined, - false, defaultRoutes, ); pipeline.#manifestData = manifestData; diff --git a/packages/astro/src/core/base-pipeline.ts b/packages/astro/src/core/base-pipeline.ts index 4eeb2f0525b5..0dcd9ac529c1 100644 --- a/packages/astro/src/core/base-pipeline.ts +++ b/packages/astro/src/core/base-pipeline.ts @@ -57,7 +57,6 @@ export abstract class Pipeline { * Used for `Astro.site`. */ readonly site = manifest.site ? new URL(manifest.site) : undefined, - readonly callSetGetEnv = true, /** * Array of built-in, internal, routes. * Used to find the route module @@ -71,13 +70,6 @@ export abstract class Pipeline { createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat), ); } - // In SSR, getSecret should fail by default. Setting it here will run before the - // adapter override. - if (callSetGetEnv && manifest.experimentalEnvGetSecretEnabled) { - setGetEnv(() => { - throw new AstroError(AstroErrorData.EnvUnsupportedGetSecret); - }, true); - } } abstract headElements(routeData: RouteData): Promise | HeadElements; diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index e8492584a967..085f52dfbf6a 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -1174,17 +1174,6 @@ export const EnvInvalidVariables = { `The following environment variables defined in \`experimental.env.schema\` are invalid:\n\n${errors.map((err) => `- ${err}`).join('\n')}\n`, } satisfies ErrorData; -/** - * @docs - * @description - * The `astro:env/server` exported function `getSecret()` is not supported by your adapter. - */ -export const EnvUnsupportedGetSecret = { - name: 'EnvUnsupportedGetSecret', - title: 'Unsupported astro:env getSecret', - message: '`astro:env/server` exported function `getSecret` is not supported by your adapter.', -} satisfies ErrorData; - /** * @docs * @description From ab0580bc94334d7924b5bb0ac808669d9d8930c3 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 20 Nov 2024 11:21:40 +0000 Subject: [PATCH 13/18] refactor(build): don't emit `middleware.mjs` (#12479) --- packages/astro/src/core/build/generate.ts | 12 ++++-------- packages/astro/src/core/build/pipeline.ts | 16 +++++++--------- .../astro/src/core/middleware/vite-plugin.ts | 15 +-------------- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 5ba5df366d6f..b854b6ae35d2 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -33,6 +33,7 @@ import { getOutputDirectory } from '../../prerender/utils.js'; import type { SSRManifestI18n } from '../app/types.js'; import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; +import { NOOP_MIDDLEWARE_FN } from '../middleware/noop-middleware.js'; import { getRedirectLocationOrThrow, routeIsRedirect } from '../redirects/index.js'; import { RenderContext } from '../render-context.js'; import { callGetStaticPaths } from '../render/route-cache.js'; @@ -65,14 +66,9 @@ export async function generatePages(options: StaticBuildOptions, internals: Buil const baseDirectory = getOutputDirectory(options.settings.config); const renderersEntryUrl = new URL('renderers.mjs', baseDirectory); const renderers = await import(renderersEntryUrl.toString()); - let middleware: MiddlewareHandler = (_, next) => next(); - try { - // middleware.mjs is not emitted if there is no user middleware - // in which case the import fails with ERR_MODULE_NOT_FOUND, and we fall back to a no-op middleware - middleware = await import(new URL('middleware.mjs', baseDirectory).toString()).then( - (mod) => mod.onRequest, - ); - } catch {} + const middleware: MiddlewareHandler = internals.middlewareEntryPoint + ? await import(internals.middlewareEntryPoint.toString()).then((mod) => mod.onRequest) + : NOOP_MIDDLEWARE_FN; manifest = createBuildManifest( options.settings, internals, diff --git a/packages/astro/src/core/build/pipeline.ts b/packages/astro/src/core/build/pipeline.ts index 38fd4dfe165a..ed32e7e420b7 100644 --- a/packages/astro/src/core/build/pipeline.ts +++ b/packages/astro/src/core/build/pipeline.ts @@ -137,15 +137,13 @@ export class BuildPipeline extends Pipeline { const renderersEntryUrl = new URL(`renderers.mjs?time=${Date.now()}`, baseDirectory); const renderers = await import(renderersEntryUrl.toString()); - const middleware = await import(new URL('middleware.mjs', baseDirectory).toString()) - .then((mod) => { - return function () { - return { onRequest: mod.onRequest }; - }; - }) - // middleware.mjs is not emitted if there is no user middleware - // in which case the import fails with ERR_MODULE_NOT_FOUND, and we fall back to a no-op middleware - .catch(() => manifest.middleware); + const middleware = internals.middlewareEntryPoint + ? await import(internals.middlewareEntryPoint.toString()).then((mod) => { + return function () { + return { onRequest: mod.onRequest }; + }; + }) + : manifest.middleware; if (!renderers) { throw new Error( diff --git a/packages/astro/src/core/middleware/vite-plugin.ts b/packages/astro/src/core/middleware/vite-plugin.ts index 7ac8bf2ed17f..2579bd93a58f 100644 --- a/packages/astro/src/core/middleware/vite-plugin.ts +++ b/packages/astro/src/core/middleware/vite-plugin.ts @@ -13,7 +13,6 @@ export const MIDDLEWARE_MODULE_ID = '\0astro-internal:middleware'; const NOOP_MIDDLEWARE = '\0noop-middleware'; export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): VitePlugin { - let isCommandBuild = false; let resolvedMiddlewareId: string | undefined = undefined; const hasIntegrationMiddleware = settings.middlewares.pre.length > 0 || settings.middlewares.post.length > 0; @@ -21,9 +20,6 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): return { name: '@astro/plugin-middleware', - config(_, { command }) { - isCommandBuild = command === 'build'; - }, async resolveId(id) { if (id === MIDDLEWARE_MODULE_ID) { const middlewareId = await this.resolve( @@ -53,15 +49,6 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): if (!userMiddlewareIsPresent && settings.config.i18n?.routing === 'manual') { throw new AstroError(MissingMiddlewareForInternationalization); } - // In the build, tell Vite to emit this file - if (isCommandBuild) { - this.emitFile({ - type: 'chunk', - preserveSignature: 'strict', - fileName: 'middleware.mjs', - id, - }); - } const preMiddleware = createMiddlewareImports(settings.middlewares.pre, 'pre'); const postMiddleware = createMiddlewareImports(settings.middlewares.post, 'post'); @@ -124,7 +111,7 @@ export function vitePluginMiddlewareBuild( writeBundle(_, bundle) { for (const [chunkName, chunk] of Object.entries(bundle)) { - if (chunk.type !== 'asset' && chunk.fileName === 'middleware.mjs') { + if (chunk.type !== 'asset' && chunk.facadeModuleId === MIDDLEWARE_MODULE_ID) { const outputDirectory = getOutputDirectory(opts.settings.config); internals.middlewareEntryPoint = new URL(chunkName, outputDirectory); } From 28dd3ce5222a667fe113238254edf59318b3fa14 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 20 Nov 2024 15:08:26 +0000 Subject: [PATCH 14/18] fix: server island hydration (#12444) --- .changeset/olive-garlics-marry.md | 5 +++++ packages/astro/src/runtime/server/render/server-islands.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/olive-garlics-marry.md diff --git a/.changeset/olive-garlics-marry.md b/.changeset/olive-garlics-marry.md new file mode 100644 index 000000000000..342db3a6f691 --- /dev/null +++ b/.changeset/olive-garlics-marry.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes an issue where a server island hydration script might fail case the island ID misses from the DOM. diff --git a/packages/astro/src/runtime/server/render/server-islands.ts b/packages/astro/src/runtime/server/render/server-islands.ts index 6dd06b8d7b1a..b8ac34024ae2 100644 --- a/packages/astro/src/runtime/server/render/server-islands.ts +++ b/packages/astro/src/runtime/server/render/server-islands.ts @@ -81,8 +81,8 @@ let response = await fetch('${serverIslandUrl}', { method: 'POST', body: JSON.stringify(data), }); - -if(response.status === 200 && response.headers.get('content-type') === 'text/html') { +if (script) { + if(response.status === 200 && response.headers.get('content-type') === 'text/html') { let html = await response.text(); // Swap! @@ -97,6 +97,7 @@ if(response.status === 200 && response.headers.get('content-type') === 'text/htm script.before(frag); } script.remove(); +} `); }, }; From a23985b02165c2ddce56d511b3f97b6815c452c9 Mon Sep 17 00:00:00 2001 From: Arpan Patel Date: Thu, 21 Nov 2024 03:31:17 -0600 Subject: [PATCH 15/18] fix: return correct locale in root 404 and 500 page with i18n (#12365) Co-authored-by: Emanuele Stoppa --- .changeset/warm-poems-breathe.md | 5 ++++ packages/astro/src/core/render-context.ts | 9 +++---- packages/astro/src/core/routing/match.ts | 10 +++++++ .../fixtures/i18n-routing/src/pages/404.astro | 12 +++++++++ packages/astro/test/i18n-routing.test.js | 26 +++++++++++++++++++ 5 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 .changeset/warm-poems-breathe.md create mode 100644 packages/astro/test/fixtures/i18n-routing/src/pages/404.astro diff --git a/.changeset/warm-poems-breathe.md b/.changeset/warm-poems-breathe.md new file mode 100644 index 000000000000..e4e9acf80d52 --- /dev/null +++ b/.changeset/warm-poems-breathe.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes an issue where `Astro.currentLocale` was not correctly returning the locale for 404 and 500 pages. diff --git a/packages/astro/src/core/render-context.ts b/packages/astro/src/core/render-context.ts index 7ccbdd2ef564..5b6243f30a6f 100644 --- a/packages/astro/src/core/render-context.ts +++ b/packages/astro/src/core/render-context.ts @@ -36,6 +36,7 @@ import { callMiddleware } from './middleware/callMiddleware.js'; import { sequence } from './middleware/index.js'; import { renderRedirect } from './redirects/render.js'; import { type Pipeline, Slots, getParams, getProps } from './render/index.js'; +import { isRoute404or500 } from './routing/match.js'; import { copyRequest, setOriginPathname } from './routing/rewrite.js'; export const apiContextRoutesSymbol = Symbol.for('context.routes'); @@ -541,11 +542,9 @@ export class RenderContext { } let computedLocale; - if (routeData.pathname) { - computedLocale = computeCurrentLocale(routeData.pathname, locales, defaultLocale); - } else { - computedLocale = computeCurrentLocale(url.pathname, locales, defaultLocale); - } + const pathname = + routeData.pathname && !isRoute404or500(routeData) ? routeData.pathname : url.pathname; + computedLocale = computeCurrentLocale(pathname, locales, defaultLocale); this.#currentLocale = computedLocale ?? fallbackTo; return this.#currentLocale; diff --git a/packages/astro/src/core/routing/match.ts b/packages/astro/src/core/routing/match.ts index 40a8b95fba29..dbcd173761d7 100644 --- a/packages/astro/src/core/routing/match.ts +++ b/packages/astro/src/core/routing/match.ts @@ -15,3 +15,13 @@ export function matchRoute(pathname: string, manifest: ManifestData): RouteData export function matchAllRoutes(pathname: string, manifest: ManifestData): RouteData[] { return manifest.routes.filter((route) => route.pattern.test(decodeURI(pathname))); } + +/** + * Determines if the given route matches a 404 or 500 error page. + * + * @param {RouteData} route - The route data to check. + * @returns {boolean} `true` if the route matches a 404 or 500 error page, otherwise `false`. + */ +export function isRoute404or500(route: RouteData): boolean { + return route.pattern.test('/404') || route.pattern.test('/500'); +} diff --git a/packages/astro/test/fixtures/i18n-routing/src/pages/404.astro b/packages/astro/test/fixtures/i18n-routing/src/pages/404.astro new file mode 100644 index 000000000000..fce4a30b836c --- /dev/null +++ b/packages/astro/test/fixtures/i18n-routing/src/pages/404.astro @@ -0,0 +1,12 @@ +--- +const currentLocale = Astro.currentLocale; +--- + + + 404 - Not Found + + +

404 - Not Found

+

Current Locale: {currentLocale ? currentLocale : "none"}

+ + diff --git a/packages/astro/test/i18n-routing.test.js b/packages/astro/test/i18n-routing.test.js index 10c35bacd9b3..d91a06ec3f73 100644 --- a/packages/astro/test/i18n-routing.test.js +++ b/packages/astro/test/i18n-routing.test.js @@ -82,6 +82,18 @@ describe('[DEV] i18n routing', () => { assert.equal(response.status, 200); assert.equal((await response.text()).includes('Endurance'), true); }); + + it('should return the correct locale on 404 page for non existing default locale page', async () => { + const response = await fixture.fetch('/es/nonexistent-page'); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: es'), true); + }); + + it('should return the correct locale on 404 page for non existing english locale page', async () => { + const response = await fixture.fetch('/en/nonexistent-page'); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: en'), true); + }); }); describe('i18n routing', () => { @@ -1200,6 +1212,20 @@ describe('[SSR] i18n routing', () => { assert.equal(response.status, 200); assert.equal((await response.text()).includes('Endurance'), true); }); + + it('should return the correct locale on 404 page for non existing default locale page', async () => { + let request = new Request('http://example.com/es/nonexistent-page'); + let response = await app.render(request); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: es'), true); + }); + + it('should return the correct locale on 404 page for non existing english locale page', async () => { + let request = new Request('http://example.com/en/nonexistent-page'); + let response = await app.render(request); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: en'), true); + }); }); describe('default', () => { From e329657a00ae4b36efa395670eacb66a4bb0c576 Mon Sep 17 00:00:00 2001 From: Arpan Patel Date: Thu, 21 Nov 2024 09:32:06 +0000 Subject: [PATCH 16/18] [ci] format --- packages/astro/test/i18n-routing.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/astro/test/i18n-routing.test.js b/packages/astro/test/i18n-routing.test.js index d91a06ec3f73..8e6c672bee28 100644 --- a/packages/astro/test/i18n-routing.test.js +++ b/packages/astro/test/i18n-routing.test.js @@ -87,13 +87,13 @@ describe('[DEV] i18n routing', () => { const response = await fixture.fetch('/es/nonexistent-page'); assert.equal(response.status, 404); assert.equal((await response.text()).includes('Current Locale: es'), true); - }); + }); - it('should return the correct locale on 404 page for non existing english locale page', async () => { + it('should return the correct locale on 404 page for non existing english locale page', async () => { const response = await fixture.fetch('/en/nonexistent-page'); assert.equal(response.status, 404); assert.equal((await response.text()).includes('Current Locale: en'), true); - }); + }); }); describe('i18n routing', () => { From 8a46e8074d6afb4a23badbd59ed239d526294e8c Mon Sep 17 00:00:00 2001 From: Eldar Kasmamytov <42811701+marbrex@users.noreply.github.com> Date: Thu, 21 Nov 2024 12:12:00 +0100 Subject: [PATCH 17/18] Resolve peer dependency problem in the integration packages (SolidJS, Vue, Svelte, React) (#12481) Co-authored-by: Bjorn Lu Co-authored-by: ematipico <602478+ematipico@users.noreply.github.com> Co-authored-by: bluwy <34116392+bluwy@users.noreply.github.com> --- .changeset/strong-stingrays-provide.md | 9 ++++++++ packages/integrations/preact/package.json | 3 ++- packages/integrations/react/package.json | 6 ++--- packages/integrations/solid/package.json | 6 ++--- packages/integrations/svelte/package.json | 6 ++--- packages/integrations/vue/package.json | 4 ++-- pnpm-lock.yaml | 27 +++++++++++++---------- 7 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 .changeset/strong-stingrays-provide.md diff --git a/.changeset/strong-stingrays-provide.md b/.changeset/strong-stingrays-provide.md new file mode 100644 index 000000000000..a98fea0f8df3 --- /dev/null +++ b/.changeset/strong-stingrays-provide.md @@ -0,0 +1,9 @@ +--- +'@astrojs/solid-js': patch +'@astrojs/vue': patch +'@astrojs/svelte': patch +'@astrojs/react': patch +'@astrojs/preact': patch +--- + +Resolve `vite` peer dependency problem for strict package managers like **Yarn in PnP mode**. diff --git a/packages/integrations/preact/package.json b/packages/integrations/preact/package.json index c23925956143..b441bca21a84 100644 --- a/packages/integrations/preact/package.json +++ b/packages/integrations/preact/package.json @@ -40,7 +40,8 @@ "@preact/preset-vite": "2.8.2", "@preact/signals": "^1.3.0", "babel-plugin-transform-hook-names": "^1.0.2", - "preact-render-to-string": "^6.5.11" + "preact-render-to-string": "^6.5.11", + "vite": "^5.4.10" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 9bb7a4e19332..40749c76df49 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -50,7 +50,8 @@ }, "dependencies": { "@vitejs/plugin-react": "^4.3.3", - "ultrahtml": "^1.5.3" + "ultrahtml": "^1.5.3", + "vite": "^5.4.10" }, "devDependencies": { "@types/react": "^18.3.12", @@ -59,8 +60,7 @@ "astro-scripts": "workspace:*", "cheerio": "1.0.0", "react": "^18.3.1", - "react-dom": "^18.3.1", - "vite": "^5.4.10" + "react-dom": "^18.3.1" }, "peerDependencies": { "@types/react": "^17.0.50 || ^18.0.21", diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json index d786893628d1..e41bca6f64c7 100644 --- a/packages/integrations/solid/package.json +++ b/packages/integrations/solid/package.json @@ -35,13 +35,13 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "vite-plugin-solid": "^2.10.2" + "vite-plugin-solid": "^2.10.2", + "vite": "^5.4.10" }, "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", - "solid-js": "^1.9.3", - "vite": "^5.4.10" + "solid-js": "^1.9.3" }, "peerDependencies": { "solid-devtools": "^0.30.1", diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 2a25510b2fe8..3a212a87c54b 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -40,13 +40,13 @@ }, "dependencies": { "@sveltejs/vite-plugin-svelte": "^4.0.0", - "svelte2tsx": "^0.7.22" + "svelte2tsx": "^0.7.22", + "vite": "^5.4.10" }, "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", - "svelte": "^5.1.16", - "vite": "^5.4.10" + "svelte": "^5.1.16" }, "peerDependencies": { "astro": "^4.0.0", diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 325d8781f45f..ce658b6a8cbe 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -45,14 +45,14 @@ "@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue-jsx": "^4.0.1", "@vue/compiler-sfc": "^3.5.12", - "vite-plugin-vue-devtools": "^7.6.3" + "vite-plugin-vue-devtools": "^7.6.3", + "vite": "^5.4.10" }, "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", "cheerio": "1.0.0", "linkedom": "^0.18.5", - "vite": "^5.4.10", "vue": "^3.5.12" }, "peerDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3066c199614d..f7ae0646d8a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5018,6 +5018,9 @@ importers: preact-render-to-string: specifier: ^6.5.11 version: 6.5.11(preact@10.24.3) + vite: + specifier: ^5.4.10 + version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) devDependencies: astro: specifier: workspace:* @@ -5037,6 +5040,9 @@ importers: ultrahtml: specifier: ^1.5.3 version: 1.5.3 + vite: + specifier: ^5.4.10 + version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) devDependencies: '@types/react': specifier: ^18.3.12 @@ -5059,9 +5065,6 @@ importers: react-dom: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) - vite: - specifier: ^5.4.10 - version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) packages/integrations/react/test/fixtures/react-component: dependencies: @@ -5147,6 +5150,9 @@ importers: packages/integrations/solid: dependencies: + vite: + specifier: ^5.4.10 + version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) vite-plugin-solid: specifier: ^2.10.2 version: 2.10.2(solid-js@1.9.3)(vite@5.4.10(@types/node@18.19.50)(sass@1.80.6)) @@ -5160,9 +5166,6 @@ importers: solid-js: specifier: ^1.9.3 version: 1.9.3 - vite: - specifier: ^5.4.10 - version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) packages/integrations/svelte: dependencies: @@ -5172,6 +5175,9 @@ importers: svelte2tsx: specifier: ^0.7.22 version: 0.7.22(svelte@5.1.16)(typescript@5.6.3) + vite: + specifier: ^5.4.10 + version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) devDependencies: astro: specifier: workspace:* @@ -5182,9 +5188,6 @@ importers: svelte: specifier: ^5.1.16 version: 5.1.16 - vite: - specifier: ^5.4.10 - version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) packages/integrations/tailwind: dependencies: @@ -5233,6 +5236,9 @@ importers: '@vue/compiler-sfc': specifier: ^3.5.12 version: 3.5.12 + vite: + specifier: ^5.4.10 + version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) vite-plugin-vue-devtools: specifier: ^7.6.3 version: 7.6.3(rollup@4.24.4)(vite@5.4.10(@types/node@18.19.50)(sass@1.80.6))(vue@3.5.12(typescript@5.6.3)) @@ -5249,9 +5255,6 @@ importers: linkedom: specifier: ^0.18.5 version: 0.18.5 - vite: - specifier: ^5.4.10 - version: 5.4.10(@types/node@18.19.50)(sass@1.80.6) vue: specifier: ^3.5.12 version: 3.5.12(typescript@5.6.3) From b9c05f45b2c9780d7b5518adb4a545cf69f075a6 Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Thu, 21 Nov 2024 03:12:37 -0800 Subject: [PATCH 18/18] [ci] release (#12452) Co-authored-by: github-actions[bot] --- .changeset/early-scissors-beg.md | 5 --- .changeset/olive-garlics-marry.md | 5 --- .changeset/six-pianos-draw.md | 5 --- .changeset/thick-shrimps-hammer.md | 5 --- .changeset/thin-cups-peel.md | 5 --- .changeset/warm-poems-breathe.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/minimal/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/with-markdoc/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 | 16 +++++++ packages/astro/package.json | 2 +- pnpm-lock.yaml | 48 ++++++++++----------- 33 files changed, 65 insertions(+), 79 deletions(-) delete mode 100644 .changeset/early-scissors-beg.md delete mode 100644 .changeset/olive-garlics-marry.md delete mode 100644 .changeset/six-pianos-draw.md delete mode 100644 .changeset/thick-shrimps-hammer.md delete mode 100644 .changeset/thin-cups-peel.md delete mode 100644 .changeset/warm-poems-breathe.md diff --git a/.changeset/early-scissors-beg.md b/.changeset/early-scissors-beg.md deleted file mode 100644 index 0b3d85e430d0..000000000000 --- a/.changeset/early-scissors-beg.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Removes the default throw behavior in `astro:env` diff --git a/.changeset/olive-garlics-marry.md b/.changeset/olive-garlics-marry.md deleted file mode 100644 index 342db3a6f691..000000000000 --- a/.changeset/olive-garlics-marry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an issue where a server island hydration script might fail case the island ID misses from the DOM. diff --git a/.changeset/six-pianos-draw.md b/.changeset/six-pianos-draw.md deleted file mode 100644 index 61a6d07eb382..000000000000 --- a/.changeset/six-pianos-draw.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes a case where the Content Layer `glob()` loader would not update when renaming or deleting an entry diff --git a/.changeset/thick-shrimps-hammer.md b/.changeset/thick-shrimps-hammer.md deleted file mode 100644 index b46b9ad6c20f..000000000000 --- a/.changeset/thick-shrimps-hammer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix cached image redownloading if it is the first asset diff --git a/.changeset/thin-cups-peel.md b/.changeset/thin-cups-peel.md deleted file mode 100644 index 3fc4678cb5cf..000000000000 --- a/.changeset/thin-cups-peel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an issue where the SSR build was emitting the `dist/server/entry.mjs` file with an incorrect import at the top of the file/ diff --git a/.changeset/warm-poems-breathe.md b/.changeset/warm-poems-breathe.md deleted file mode 100644 index e4e9acf80d52..000000000000 --- a/.changeset/warm-poems-breathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an issue where `Astro.currentLocale` was not correctly returning the locale for 404 and 500 pages. diff --git a/examples/basics/package.json b/examples/basics/package.json index 932cb1c6c980..c97f2010ed96 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 9983953cda52..2dea4dac4931 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^3.1.9", "@astrojs/rss": "^4.0.9", "@astrojs/sitemap": "^3.2.1", - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/component/package.json b/examples/component/package.json index 9226413bf9c3..9d7678431369 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.16.13" + "astro": "^4.16.14" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index 0ab9720ad254..ab3a295aadf7 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.16.13", + "astro": "^4.16.14", "@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 9c201175bbf0..ab1f6169e88f 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.3", - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index 9da0a1332ed5..1d7b9ca948b7 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.16.13", + "astro": "^4.16.14", "lit": "^3.2.1" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index d8b86a81dcf1..d6900fff3458 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -18,7 +18,7 @@ "@astrojs/vue": "^4.5.2", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", - "astro": "^4.16.13", + "astro": "^4.16.14", "preact": "^10.24.3", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 7293b436cb5c..6c822be2e4ee 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.3", "@preact/signals": "^1.3.0", - "astro": "^4.16.13", + "astro": "^4.16.14", "preact": "^10.24.3" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 1b7870164a72..158f03dbd965 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.12", "@types/react-dom": "^18.3.1", - "astro": "^4.16.13", + "astro": "^4.16.14", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 14037fd84488..dc9efdb80fc2 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^4.4.3", - "astro": "^4.16.13", + "astro": "^4.16.14", "solid-js": "^1.9.3" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 2a06f5d65c58..2b3ea17916b5 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^6.0.1", - "astro": "^4.16.13", + "astro": "^4.16.14", "svelte": "^5.1.16" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 153cd6a3cc1b..d7afee280b9e 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/vue": "^4.5.2", - "astro": "^4.16.13", + "astro": "^4.16.14", "vue": "^3.5.12" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index e9c4d08ef9f2..7706bac81d13 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/node": "^8.3.4", - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 394c38db51c2..4d39c18f75b4 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.16.13" + "astro": "^4.16.14" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 577c43e9c4dd..dc0795709526 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index a9412fd04724..648b40582664 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 88802eada33b..97bb22f2f234 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -14,7 +14,7 @@ "dependencies": { "@astrojs/node": "^8.3.4", "@astrojs/svelte": "^6.0.1", - "astro": "^4.16.13", + "astro": "^4.16.14", "svelte": "^5.1.16" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index 5bb986033e90..c515133a55ba 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.16.13", + "astro": "^4.16.14", "sass": "^1.80.6", "sharp": "^0.33.3" } diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index d64980b3b2b7..1462eb098915 100644 --- a/examples/toolbar-app/package.json +++ b/examples/toolbar-app/package.json @@ -15,6 +15,6 @@ "./app": "./dist/app.js" }, "devDependencies": { - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 4b5321bbddc0..bd0e1cf9d04d 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/markdoc": "^0.11.5", - "astro": "^4.16.13" + "astro": "^4.16.14" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index d372044bd47a..cd3fd5fec8f2 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/mdx": "^3.1.9", "@astrojs/preact": "^3.5.3", - "astro": "^4.16.13", + "astro": "^4.16.14", "preact": "^10.24.3" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 0069ff91aaf5..66cd59afb490 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.5.3", "@nanostores/preact": "^0.5.2", - "astro": "^4.16.13", + "astro": "^4.16.14", "nanostores": "^0.11.3", "preact": "^10.24.3" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index feb9995419e3..0f4a99c373e3 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^3.1.9", "@astrojs/tailwind": "^5.1.2", "@types/canvas-confetti": "^1.6.4", - "astro": "^4.16.13", + "astro": "^4.16.14", "autoprefixer": "^10.4.20", "canvas-confetti": "^1.9.3", "postcss": "^8.4.47", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 602430de6474..14d77f5c68e3 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.16.13", + "astro": "^4.16.14", "vitest": "^2.1.4" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 9e919f2e1b79..c873a77d5724 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,21 @@ # astro +## 4.16.14 + +### Patch Changes + +- [#12480](https://github.com/withastro/astro/pull/12480) [`c3b7e7c`](https://github.com/withastro/astro/commit/c3b7e7cfa13603c08eb923703f31a92d514e82db) Thanks [@matthewp](https://github.com/matthewp)! - Removes the default throw behavior in `astro:env` + +- [#12444](https://github.com/withastro/astro/pull/12444) [`28dd3ce`](https://github.com/withastro/astro/commit/28dd3ce5222a667fe113238254edf59318b3fa14) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where a server island hydration script might fail case the island ID misses from the DOM. + +- [#12476](https://github.com/withastro/astro/pull/12476) [`80a9a52`](https://github.com/withastro/astro/commit/80a9a5299a9d51f2b09900d3200976d687feae8f) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the Content Layer `glob()` loader would not update when renaming or deleting an entry + +- [#12418](https://github.com/withastro/astro/pull/12418) [`25baa4e`](https://github.com/withastro/astro/commit/25baa4ed0c5f55fa85c2c7e2c15848937ed1dc9b) Thanks [@oliverlynch](https://github.com/oliverlynch)! - Fix cached image redownloading if it is the first asset + +- [#12477](https://github.com/withastro/astro/pull/12477) [`46f6b38`](https://github.com/withastro/astro/commit/46f6b386b3db6332f286d79958ef10261958cceb) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where the SSR build was emitting the `dist/server/entry.mjs` file with an incorrect import at the top of the file/ + +- [#12365](https://github.com/withastro/astro/pull/12365) [`a23985b`](https://github.com/withastro/astro/commit/a23985b02165c2ddce56d511b3f97b6815c452c9) Thanks [@apatel369](https://github.com/apatel369)! - Fixes an issue where `Astro.currentLocale` was not correctly returning the locale for 404 and 500 pages. + ## 4.16.13 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index fb0440afa9a5..0a4d34f65197 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.16.13", + "version": "4.16.14", "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 f7ae0646d8a7..dd7b3f647355 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -142,7 +142,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/blog: @@ -157,13 +157,13 @@ importers: specifier: ^3.2.1 version: link:../../packages/integrations/sitemap astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/container-with-vitest: @@ -172,7 +172,7 @@ importers: specifier: ^3.6.2 version: link:../../packages/integrations/react astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -203,7 +203,7 @@ importers: specifier: ^3.14.3 version: 3.14.3 astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/framework-lit: @@ -215,7 +215,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro lit: specifier: ^3.2.1 @@ -245,7 +245,7 @@ importers: specifier: ^18.3.1 version: 18.3.1 astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro preact: specifier: ^10.24.3 @@ -275,7 +275,7 @@ importers: specifier: ^1.3.0 version: 1.3.0(preact@10.24.3) astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro preact: specifier: ^10.24.3 @@ -293,7 +293,7 @@ importers: specifier: ^18.3.1 version: 18.3.1 astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -308,7 +308,7 @@ importers: specifier: ^4.4.3 version: link:../../packages/integrations/solid astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro solid-js: specifier: ^1.9.3 @@ -320,7 +320,7 @@ importers: specifier: ^6.0.1 version: link:../../packages/integrations/svelte astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro svelte: specifier: ^5.1.16 @@ -332,7 +332,7 @@ importers: specifier: ^4.5.2 version: link:../../packages/integrations/vue astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro vue: specifier: ^3.5.12 @@ -344,25 +344,25 @@ importers: specifier: ^8.3.4 version: 8.3.4(astro@packages+astro) astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/minimal: dependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/ssr: @@ -374,7 +374,7 @@ importers: specifier: ^6.0.1 version: link:../../packages/integrations/svelte astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro svelte: specifier: ^5.1.16 @@ -383,7 +383,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro sass: specifier: ^1.80.6 @@ -395,7 +395,7 @@ importers: examples/toolbar-app: devDependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/with-markdoc: @@ -404,7 +404,7 @@ importers: specifier: ^0.11.5 version: link:../../packages/integrations/markdoc astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro examples/with-mdx: @@ -416,7 +416,7 @@ importers: specifier: ^3.5.3 version: link:../../packages/integrations/preact astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro preact: specifier: ^10.24.3 @@ -431,7 +431,7 @@ importers: specifier: ^0.5.2 version: 0.5.2(nanostores@0.11.3)(preact@10.24.3) astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro nanostores: specifier: ^0.11.3 @@ -452,7 +452,7 @@ importers: specifier: ^1.6.4 version: 1.6.4 astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro autoprefixer: specifier: ^10.4.20 @@ -470,7 +470,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^4.16.13 + specifier: ^4.16.14 version: link:../../packages/astro vitest: specifier: ^2.1.4