diff --git a/.changeset/breezy-eyes-teach.md b/.changeset/breezy-eyes-teach.md new file mode 100644 index 000000000000..6ab45e666e26 --- /dev/null +++ b/.changeset/breezy-eyes-teach.md @@ -0,0 +1,8 @@ +--- +"astro": patch +--- + +Fixes back navigation to fragment links (e.g. `#about`) in Firefox when using view transitions + +Co-authored-by: Florian Lefebvre <69633530+florian-lefebvre@users.noreply.github.com> +Co-authored-by: Sarah Rainsberger diff --git a/.changeset/great-beans-check.md b/.changeset/great-beans-check.md deleted file mode 100644 index 69e188bd0a79..000000000000 --- a/.changeset/great-beans-check.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Fixes error overlay display on URI malformed error diff --git a/.changeset/ninety-buses-occur.md b/.changeset/ninety-buses-occur.md deleted file mode 100644 index 52265a036129..000000000000 --- a/.changeset/ninety-buses-occur.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@astrojs/vue": patch ---- - -Fixes support for async `appEntrypoint` diff --git a/.changeset/olive-sloths-brush.md b/.changeset/olive-sloths-brush.md deleted file mode 100644 index 574af00902b0..000000000000 --- a/.changeset/olive-sloths-brush.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/node': patch ---- - -Fixes a bug where an error while serving response stopped the server. diff --git a/.changeset/plenty-dingos-relax.md b/.changeset/plenty-dingos-relax.md deleted file mode 100644 index 4bb328ee1cf6..000000000000 --- a/.changeset/plenty-dingos-relax.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Implement i18n's `getLocaleByPath` function diff --git a/.changeset/quiet-weeks-teach.md b/.changeset/quiet-weeks-teach.md deleted file mode 100644 index bfbbb737c168..000000000000 --- a/.changeset/quiet-weeks-teach.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Prevents ANSI codes from rendering in the error overlay diff --git a/.changeset/silent-wasps-learn.md b/.changeset/silent-wasps-learn.md deleted file mode 100644 index 60f8d4c0efc9..000000000000 --- a/.changeset/silent-wasps-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Toggle dev toolbar hitbox height when toolbar is visible diff --git a/.changeset/six-bottles-mix.md b/.changeset/six-bottles-mix.md new file mode 100644 index 000000000000..d010104a698f --- /dev/null +++ b/.changeset/six-bottles-mix.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Sets correct `process.env.NODE_ENV` default when using the JS API diff --git a/.changeset/sixty-bugs-unite.md b/.changeset/sixty-bugs-unite.md deleted file mode 100644 index 167cc4aa7543..000000000000 --- a/.changeset/sixty-bugs-unite.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Documents supported `--host` and `--port` flags in `astro preview --help` diff --git a/.changeset/small-snakes-build.md b/.changeset/small-snakes-build.md deleted file mode 100644 index 9f1c9f8ac0ec..000000000000 --- a/.changeset/small-snakes-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Fixes remote images with encoded characters diff --git a/.changeset/tall-mayflies-deliver.md b/.changeset/tall-mayflies-deliver.md deleted file mode 100644 index 736aeb0d03b4..000000000000 --- a/.changeset/tall-mayflies-deliver.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Adds 'starlight' to the displayed options for `astro add` diff --git a/.changeset/weak-oranges-relate.md b/.changeset/weak-oranges-relate.md deleted file mode 100644 index c61c4b7e05e8..000000000000 --- a/.changeset/weak-oranges-relate.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -`` srcset now parses encoded paths correctly diff --git a/.changeset/yellow-yaks-promise.md b/.changeset/yellow-yaks-promise.md deleted file mode 100644 index 2b9aa21ff90c..000000000000 --- a/.changeset/yellow-yaks-promise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@astrojs/vercel": patch ---- - -Fixes an issue where a build could not complete on Node 21. diff --git a/.github/workflows/check-merge.yml b/.github/workflows/check-merge.yml index 378c595274f5..167879b628ba 100644 --- a/.github/workflows/check-merge.yml +++ b/.github/workflows/check-merge.yml @@ -50,10 +50,10 @@ jobs: if: steps.blocked.outputs.result != 'true' run: | echo "Checking for changesets marked as minor" - echo '::set-output name=found::false' + echo "found=false" >> $GITHUB_OUTPUT for file in ${{ steps.changed-files.outputs.all_changed_files }}; do if grep -q "'astro': minor" "$file"; then - echo '::set-output name=found::true' + echo "found=true" >> $GITHUB_OUTPUT echo "$file has a minor release tag" fi done diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 961f4d9977be..8e2fd8af4b0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,10 +54,10 @@ jobs: if [[ $output = '{ "changesets": [], "releases": [] }' ]] then echo 'No changeset found' - echo "::set-output name=run_job::true" + echo "run_job=true" >> $GITHUB_OUTPUT else echo 'changes found, push to latest skipped' - echo "::set-output name=run_job::false" + echo "run_job=false" >> $GITHUB_OUTPUT fi update: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30fd8867bcba..8696c85a04ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,7 +62,9 @@ jobs: - name: Generate Notification id: notification if: steps.changesets.outputs.published == 'true' - run: message=$(node scripts/notify/index.js '${{ steps.changesets.outputs.publishedPackages }}') && echo ::set-output name=message::${message//$'\n'/'%0A'} + run: | + message=$(node scripts/notify/index.js '${{ steps.changesets.outputs.publishedPackages }}') + echo "message=${message//$'\n'/'%0A'}" >> $GITHUB_OUTPUT - name: Discord Notification if: steps.changesets.outputs.published == 'true' diff --git a/examples/basics/package.json b/examples/basics/package.json index ff55e0d315af..8ed1da076d0a 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 6e0bd7a2cf9e..cd925738056a 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^2.0.3", "@astrojs/rss": "^4.0.1", "@astrojs/sitemap": "^3.0.4", - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/component/package.json b/examples/component/package.json index 67ec5a3a801d..728c58c0d824 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.0.8" + "astro": "^4.0.9" }, "peerDependencies": { "astro": "^3.0.0" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index da02b10cec53..2651136e3052 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -14,6 +14,6 @@ "@astrojs/alpinejs": "^0.3.2", "@types/alpinejs": "^3.13.5", "alpinejs": "^3.13.3", - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index a12879c13052..212c4b7f2788 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/lit": "^4.0.1", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^4.0.8", + "astro": "^4.0.9", "lit": "^2.8.0" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 235c0015ef11..c6bdb4fd9cd0 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -15,8 +15,8 @@ "@astrojs/react": "^3.0.9", "@astrojs/solid-js": "^3.0.3", "@astrojs/svelte": "^5.0.3", - "@astrojs/vue": "^4.0.6", - "astro": "^4.0.8", + "@astrojs/vue": "^4.0.7", + "astro": "^4.0.9", "preact": "^10.19.2", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 182488e94ae6..1d15b0b91fa8 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.0.2", "@preact/signals": "^1.2.1", - "astro": "^4.0.8", + "astro": "^4.0.9", "preact": "^10.19.2" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index c82665504727..6876397bd2c1 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -14,7 +14,7 @@ "@astrojs/react": "^3.0.9", "@types/react": "^18.2.37", "@types/react-dom": "^18.2.15", - "astro": "^4.0.8", + "astro": "^4.0.9", "react": "^18.2.0", "react-dom": "^18.2.0" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index a872508abefa..1ac1ac9af5be 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^3.0.3", - "astro": "^4.0.8", + "astro": "^4.0.9", "solid-js": "^1.8.5" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 86e67d122441..d7f859642fca 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^5.0.3", - "astro": "^4.0.8", + "astro": "^4.0.9", "svelte": "^4.2.5" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 29ad35c9275e..b8f46c7d53cc 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -11,8 +11,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/vue": "^4.0.6", - "astro": "^4.0.8", + "@astrojs/vue": "^4.0.7", + "astro": "^4.0.9", "vue": "^3.3.8" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index b10f2aaeba20..10e2cef66f85 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^7.0.3", - "astro": "^4.0.8" + "@astrojs/node": "^7.0.4", + "astro": "^4.0.9" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index cac406ddca81..914397e0ce9a 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.0.8" + "astro": "^4.0.9" }, "peerDependencies": { "astro": "^3.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index 69424f74c935..ea19c7a8732c 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -12,8 +12,8 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^7.0.3", - "astro": "^4.0.8", + "@astrojs/node": "^7.0.4", + "astro": "^4.0.9", "html-minifier": "^4.0.0" }, "devDependencies": { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 860897d1bf8b..233f0474fa87 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index 2a1c4d61a8e4..d86fb3091afa 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 3332fc3a332e..e3afa006c0ae 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 7ed70e2bf89d..5167af81f990 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,9 +12,9 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^7.0.3", + "@astrojs/node": "^7.0.4", "@astrojs/svelte": "^5.0.3", - "astro": "^4.0.8", + "astro": "^4.0.9", "svelte": "^4.2.5" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index 8975eaa5cd03..97ddbf059f72 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.5", + "astro": "^4.0.9", "sass": "^1.69.5", "sharp": "^0.32.5" } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index 51069d03d0a6..42cdc61788a4 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@astrojs/tailwind": "^5.1.0", - "@astrojs/node": "^7.0.3", - "astro": "^4.0.8" + "@astrojs/node": "^7.0.4", + "astro": "^4.0.9" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 3a256c74cb5c..714bf0c5463c 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/markdoc": "^0.8.2", - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 070443067aa9..bdcee218cfec 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^4.0.1", - "astro": "^4.0.8", + "astro": "^4.0.9", "hast-util-select": "^6.0.2", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 562d476ee881..d0b6da252f4b 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.8" + "astro": "^4.0.9" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 016370f40d0a..4a53e0b2224c 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/mdx": "^2.0.3", "@astrojs/preact": "^3.0.2", - "astro": "^4.0.8", + "astro": "^4.0.9", "preact": "^10.19.2" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 86a6305f4d88..1d143b844e69 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.0.2", "@nanostores/preact": "^0.5.0", - "astro": "^4.0.8", + "astro": "^4.0.9", "nanostores": "^0.9.5", "preact": "^10.19.2" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index c497f3f8a3f0..61f7bf8f30d3 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^2.0.3", "@astrojs/tailwind": "^5.1.0", "@types/canvas-confetti": "^1.6.3", - "astro": "^4.0.8", + "astro": "^4.0.9", "autoprefixer": "^10.4.15", "canvas-confetti": "^1.9.1", "postcss": "^8.4.28", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index ff523da7d7cb..ccc9e6004966 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.0.8", + "astro": "^4.0.9", "vitest": "^0.34.2" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 86a1df59a10c..5afff3ce0421 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,27 @@ # astro +## 4.0.9 + +### Patch Changes + +- [#9571](https://github.com/withastro/astro/pull/9571) [`ec71f03cfd9b8195fb21c92dfda0eff63b6ebeed`](https://github.com/withastro/astro/commit/ec71f03cfd9b8195fb21c92dfda0eff63b6ebeed) Thanks [@bluwy](https://github.com/bluwy)! - Removes telemetry for unhandled errors in the dev server + +- [#9548](https://github.com/withastro/astro/pull/9548) [`8049f0cd91b239c52e37d571e3ba3e703cf0e4cf`](https://github.com/withastro/astro/commit/8049f0cd91b239c52e37d571e3ba3e703cf0e4cf) Thanks [@bluwy](https://github.com/bluwy)! - Fixes error overlay display on URI malformed error + +- [#9504](https://github.com/withastro/astro/pull/9504) [`8cc3d6aa46f438d668516539c34b48ad748ade39`](https://github.com/withastro/astro/commit/8cc3d6aa46f438d668516539c34b48ad748ade39) Thanks [@matiboux](https://github.com/matiboux)! - Implement i18n's `getLocaleByPath` function + +- [#9547](https://github.com/withastro/astro/pull/9547) [`22f42d11a4fd2e154a0c5873c4f516584e383b70`](https://github.com/withastro/astro/commit/22f42d11a4fd2e154a0c5873c4f516584e383b70) Thanks [@bluwy](https://github.com/bluwy)! - Prevents ANSI codes from rendering in the error overlay + +- [#9446](https://github.com/withastro/astro/pull/9446) [`ede3f7fef6b43a08c9371f7a2531e2eef858b94d`](https://github.com/withastro/astro/commit/ede3f7fef6b43a08c9371f7a2531e2eef858b94d) Thanks [@alexnguyennz](https://github.com/alexnguyennz)! - Toggle dev toolbar hitbox height when toolbar is visible + +- [#9572](https://github.com/withastro/astro/pull/9572) [`9f6453cf4972ac28eec4f07a1373feaa295c8864`](https://github.com/withastro/astro/commit/9f6453cf4972ac28eec4f07a1373feaa295c8864) Thanks [@bluwy](https://github.com/bluwy)! - Documents supported `--host` and `--port` flags in `astro preview --help` + +- [#9540](https://github.com/withastro/astro/pull/9540) [`7f212f0831d8cd899a86fb94899a7cad8ec280db`](https://github.com/withastro/astro/commit/7f212f0831d8cd899a86fb94899a7cad8ec280db) Thanks [@matthewp](https://github.com/matthewp)! - Fixes remote images with encoded characters + +- [#9559](https://github.com/withastro/astro/pull/9559) [`8b873bf1f343efc1f486d8ef53c38380e2373c08`](https://github.com/withastro/astro/commit/8b873bf1f343efc1f486d8ef53c38380e2373c08) Thanks [@sygint](https://github.com/sygint)! - Adds 'starlight' to the displayed options for `astro add` + +- [#9537](https://github.com/withastro/astro/pull/9537) [`16e61fcacb98e6bd948ac240bc082659d70193a4`](https://github.com/withastro/astro/commit/16e61fcacb98e6bd948ac240bc082659d70193a4) Thanks [@walter9388](https://github.com/walter9388)! - `` srcset now parses encoded paths correctly + ## 4.0.8 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 370c5f829cda..771289fe6df8 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.0.8", + "version": "4.0.9", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts index 5b65106cca86..1240e67deed0 100644 --- a/packages/astro/src/cli/add/index.ts +++ b/packages/astro/src/cli/add/index.ts @@ -27,7 +27,7 @@ import * as msg from '../../core/messages.js'; import { printHelp } from '../../core/messages.js'; import { appendForwardSlash } from '../../core/path.js'; import { apply as applyPolyfill } from '../../core/polyfill.js'; -import { parseNpmName } from '../../core/util.js'; +import { ensureProcessNodeEnv, parseNpmName } from '../../core/util.js'; import { eventCliSession, telemetry } from '../../events/index.js'; import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js'; import { generate, parse, t, visit } from './babel.js'; @@ -92,6 +92,7 @@ async function getRegistry(): Promise { } export async function add(names: string[], { flags }: AddOptions) { + ensureProcessNodeEnv('production'); const inlineConfig = flagsToAstroInlineConfig(flags); const { userConfig } = await resolveConfig(inlineConfig, 'add'); telemetry.record(eventCliSession('add', userConfig)); diff --git a/packages/astro/src/cli/check/index.ts b/packages/astro/src/cli/check/index.ts index 6ce3bf71ecb6..faf07b776b9f 100644 --- a/packages/astro/src/cli/check/index.ts +++ b/packages/astro/src/cli/check/index.ts @@ -2,8 +2,10 @@ import path from 'node:path'; import type { Arguments } from 'yargs-parser'; import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js'; import { getPackage } from '../install-package.js'; +import { ensureProcessNodeEnv } from '../../core/util.js'; export async function check(flags: Arguments) { + ensureProcessNodeEnv('production'); const logger = createLoggerFromFlags(flags); const getPackageOpts = { skipAsk: flags.yes || flags.y, cwd: flags.root }; const checkPackage = await getPackage( diff --git a/packages/astro/src/cli/index.ts b/packages/astro/src/cli/index.ts index 7ca4d21a9a7b..19347ebecd16 100644 --- a/packages/astro/src/cli/index.ts +++ b/packages/astro/src/cli/index.ts @@ -131,11 +131,6 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { enableVerboseLogging(); } - // Start with a default NODE_ENV so Vite doesn't set an incorrect default when loading the Astro config - if (!process.env.NODE_ENV) { - process.env.NODE_ENV = cmd === 'dev' ? 'development' : 'production'; - } - const { notify } = await import('./telemetry/index.js'); await notify(); diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 8cb53f3c7c3a..553497bc5b40 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -33,6 +33,7 @@ import { collectPagesData } from './page-data.js'; import { staticBuild, viteBuild } from './static-build.js'; import type { StaticBuildOptions } from './types.js'; import { getTimeStat } from './util.js'; +import { ensureProcessNodeEnv } from '../util.js'; export interface BuildOptions { /** @@ -63,6 +64,7 @@ export default async function build( inlineConfig: AstroInlineConfig, options: BuildOptions = {} ): Promise { + ensureProcessNodeEnv('production'); applyPolyfill(); const logger = createNodeLogger(inlineConfig); const { userConfig, astroConfig } = await resolveConfig(inlineConfig, 'build'); diff --git a/packages/astro/src/core/dev/dev.ts b/packages/astro/src/core/dev/dev.ts index c0c1b9b8ea64..d345c1db6145 100644 --- a/packages/astro/src/core/dev/dev.ts +++ b/packages/astro/src/core/dev/dev.ts @@ -10,6 +10,7 @@ import { telemetry } from '../../events/index.js'; import * as msg from '../messages.js'; import { startContainer } from './container.js'; import { createContainerWithAutomaticRestart } from './restart.js'; +import { ensureProcessNodeEnv } from '../util.js'; export interface DevServer { address: AddressInfo; @@ -25,6 +26,7 @@ export interface DevServer { * @experimental The JavaScript API is experimental */ export default async function dev(inlineConfig: AstroInlineConfig): Promise { + ensureProcessNodeEnv('development'); const devStart = performance.now(); await telemetry.record([]); diff --git a/packages/astro/src/core/preview/index.ts b/packages/astro/src/core/preview/index.ts index ba6f51c9d32b..5d6adc0c64bb 100644 --- a/packages/astro/src/core/preview/index.ts +++ b/packages/astro/src/core/preview/index.ts @@ -11,6 +11,7 @@ import { createNodeLogger } from '../config/logging.js'; import { createSettings } from '../config/settings.js'; import createStaticPreviewServer from './static-preview-server.js'; import { getResolvedHostForHttpServer } from './util.js'; +import { ensureProcessNodeEnv } from '../util.js'; /** * Starts a local server to serve your static dist/ directory. This command is useful for previewing @@ -19,6 +20,7 @@ import { getResolvedHostForHttpServer } from './util.js'; * @experimental The JavaScript API is experimental */ export default async function preview(inlineConfig: AstroInlineConfig): Promise { + ensureProcessNodeEnv('production'); const logger = createNodeLogger(inlineConfig); const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'preview'); telemetry.record(eventCliSession('preview', userConfig)); diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index 966454845b30..bfaed6c2f9fd 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -17,6 +17,7 @@ import { createSettings } from '../config/settings.js'; import { createVite } from '../create-vite.js'; import { AstroError, AstroErrorData, createSafeError, isAstroError } from '../errors/index.js'; import type { Logger } from '../logger/core.js'; +import { ensureProcessNodeEnv } from '../util.js'; export type ProcessExit = 0 | 1; @@ -41,6 +42,7 @@ export default async function sync( inlineConfig: AstroInlineConfig, options?: SyncOptions ): Promise { + ensureProcessNodeEnv('production'); const logger = createNodeLogger(inlineConfig); const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'sync'); telemetry.record(eventCliSession('sync', userConfig)); diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index bcfa9a511bbb..4db3549a2a6d 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -231,3 +231,12 @@ export function resolvePath(specifier: string, importer: string) { return specifier; } } + +/** + * Set a default NODE_ENV so Vite doesn't set an incorrect default when loading the Astro config + */ +export function ensureProcessNodeEnv(defaultNodeEnv: string) { + if (!process.env.NODE_ENV) { + process.env.NODE_ENV = defaultNodeEnv; + } +} diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index d77842f4da3c..5d07287b6f00 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -213,7 +213,9 @@ const moveToLocation = (to: URL, from: URL, options: Options, historyState?: Sta // ... what comes next is a intra-page navigation // that won't reload the page but instead scroll to the fragment history.scrollRestoration = 'auto'; - location.href = to.href; + const savedState = history.state; + location.href = to.href; // this kills the history state on Firefox + history.state || replaceState(savedState, ''); // this restores the history state } else { if (!scrolledToTop) { scrollTo({ left: 0, top: 0, behavior: 'instant' }); diff --git a/packages/astro/src/vite-plugin-astro-server/error.ts b/packages/astro/src/vite-plugin-astro-server/error.ts index cbab6e7be090..7c478fc6eb68 100644 --- a/packages/astro/src/vite-plugin-astro-server/error.ts +++ b/packages/astro/src/vite-plugin-astro-server/error.ts @@ -3,7 +3,7 @@ import type { AstroConfig } from '../@types/astro.js'; import type DevPipeline from './devPipeline.js'; import { collectErrorMetadata } from '../core/errors/dev/index.js'; -import { createSafeError } from '../core/errors/index.js'; +import { createSafeError, AstroErrorData } from '../core/errors/index.js'; import { formatErrorMessage } from '../core/messages.js'; import { eventError, telemetry } from '../events/index.js'; @@ -24,7 +24,10 @@ export function recordServerError( // Our error should already be complete, but let's try to add a bit more through some guesswork const errorWithMetadata = collectErrorMetadata(err, config.root); - telemetry.record(eventError({ cmd: 'dev', err: errorWithMetadata, isFatal: false })); + // Ignore unhandled rejection errors as they appear A LOT and we cannot record the amount to telemetry + if (errorWithMetadata.name !== AstroErrorData.UnhandledRejection.name) { + telemetry.record(eventError({ cmd: 'dev', err: errorWithMetadata, isFatal: false })); + } pipeline.logger.error( null, diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index 2a37ae6f8bdc..6710489242a4 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/node +## 7.0.4 + +### Patch Changes + +- [#9533](https://github.com/withastro/astro/pull/9533) [`48f47b50a0f8bc0fa51760215def36640f79050d`](https://github.com/withastro/astro/commit/48f47b50a0f8bc0fa51760215def36640f79050d) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixes a bug where an error while serving response stopped the server. + ## 7.0.3 ### Patch Changes diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index f2ed4f2e5658..c3d952840ad2 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/node", "description": "Deploy your site to a Node.js server", - "version": "7.0.3", + "version": "7.0.4", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md index d2aec2e35efc..ab0008526742 100644 --- a/packages/integrations/vercel/CHANGELOG.md +++ b/packages/integrations/vercel/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/vercel +## 6.1.2 + +### Patch Changes + +- [#9550](https://github.com/withastro/astro/pull/9550) [`7b586a6e23e25653814db9adea9674ec3a9bd535`](https://github.com/withastro/astro/commit/7b586a6e23e25653814db9adea9674ec3a9bd535) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixes an issue where a build could not complete on Node 21. + ## 6.1.1 ### Patch Changes diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index bf779881c90c..3c48a6039aad 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/vercel", "description": "Deploy your site to Vercel", - "version": "6.1.1", + "version": "6.1.2", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/integrations/vue/CHANGELOG.md b/packages/integrations/vue/CHANGELOG.md index 40d3bb15c70f..5eff4621140a 100644 --- a/packages/integrations/vue/CHANGELOG.md +++ b/packages/integrations/vue/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/vue +## 4.0.7 + +### Patch Changes + +- [#9558](https://github.com/withastro/astro/pull/9558) [`e496b2e3b84b673b81c872dad9a6b3f9dd32396a`](https://github.com/withastro/astro/commit/e496b2e3b84b673b81c872dad9a6b3f9dd32396a) Thanks [@michaelhthomas](https://github.com/michaelhthomas)! - Fixes support for async `appEntrypoint` + ## 4.0.6 ### Patch Changes diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 1f59c3e9a237..73cd606a5594 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/vue", - "version": "4.0.6", + "version": "4.0.7", "description": "Use Vue components within Astro", "type": "module", "types": "./dist/index.d.ts", diff --git a/packages/upgrade/CHANGELOG.md b/packages/upgrade/CHANGELOG.md index e39000145f31..e4a21db5e096 100644 --- a/packages/upgrade/CHANGELOG.md +++ b/packages/upgrade/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/upgrade +## 0.2.2 + +### Patch Changes + +- [#9562](https://github.com/withastro/astro/pull/9562) [`67e06f9db1b0492ccfb4b053762dc91d69a53ecb`](https://github.com/withastro/astro/commit/67e06f9db1b0492ccfb4b053762dc91d69a53ecb) Thanks [@DET171](https://github.com/DET171)! - Updates the command used for installing packages with pnpm and yarn + ## 0.2.1 ### Patch Changes diff --git a/packages/upgrade/package.json b/packages/upgrade/package.json index fb765e47b37f..802b180157ec 100644 --- a/packages/upgrade/package.json +++ b/packages/upgrade/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/upgrade", - "version": "0.2.1", + "version": "0.2.2", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/upgrade/src/actions/install.ts b/packages/upgrade/src/actions/install.ts index 3f343463fadf..3c294a8ee2a5 100644 --- a/packages/upgrade/src/actions/install.ts +++ b/packages/upgrade/src/actions/install.ts @@ -123,6 +123,9 @@ async function runInstallCommand( const cwd = fileURLToPath(ctx.cwd); if (ctx.packageManager === 'yarn') await ensureYarnLock({ cwd }); + const installCmd = + ctx.packageManager === 'yarn' || ctx.packageManager === 'pnpm' ? 'add' : 'install'; + await spinner({ start: `Installing dependencies with ${ctx.packageManager}...`, end: `Installed dependencies!`, @@ -132,7 +135,7 @@ async function runInstallCommand( await shell( ctx.packageManager, [ - 'install', + installCmd, ...dependencies.map( ({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}` ), @@ -144,7 +147,7 @@ async function runInstallCommand( await shell( ctx.packageManager, [ - 'install', + installCmd, '--save-dev', ...devDependencies.map( ({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}` @@ -161,7 +164,7 @@ async function runInstallCommand( error( 'error', `Dependencies failed to install, please run the following command manually:\n${color.bold( - `${ctx.packageManager} install ${packages}` + `${ctx.packageManager} ${installCmd} ${packages}` )}` ); return ctx.exit(1); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4fe84084be43..b995a2002c3e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -125,7 +125,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/blog: @@ -140,13 +140,13 @@ importers: specifier: ^3.0.4 version: link:../../packages/integrations/sitemap astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/framework-alpine: @@ -161,7 +161,7 @@ importers: specifier: ^3.13.3 version: 3.13.3 astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/framework-lit: @@ -173,7 +173,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro lit: specifier: ^2.8.0 @@ -194,10 +194,10 @@ importers: specifier: ^5.0.3 version: link:../../packages/integrations/svelte '@astrojs/vue': - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/integrations/vue astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -227,7 +227,7 @@ importers: specifier: ^1.2.1 version: 1.2.1(preact@10.19.3) astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -245,7 +245,7 @@ importers: specifier: ^18.2.15 version: 18.2.18 astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro react: specifier: ^18.2.0 @@ -260,7 +260,7 @@ importers: specifier: ^3.0.3 version: link:../../packages/integrations/solid astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro solid-js: specifier: ^1.8.5 @@ -272,7 +272,7 @@ importers: specifier: ^5.0.3 version: link:../../packages/integrations/svelte astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro svelte: specifier: ^4.2.5 @@ -281,10 +281,10 @@ importers: examples/framework-vue: dependencies: '@astrojs/vue': - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/integrations/vue astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro vue: specifier: ^3.3.8 @@ -293,25 +293,25 @@ importers: examples/hackernews: dependencies: '@astrojs/node': - specifier: ^7.0.3 + specifier: ^7.0.4 version: link:../../packages/integrations/node astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/middleware: dependencies: '@astrojs/node': - specifier: ^7.0.3 + specifier: ^7.0.4 version: link:../../packages/integrations/node astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -324,31 +324,31 @@ importers: examples/minimal: dependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/ssr: dependencies: '@astrojs/node': - specifier: ^7.0.3 + specifier: ^7.0.4 version: link:../../packages/integrations/node '@astrojs/svelte': specifier: ^5.0.3 version: link:../../packages/integrations/svelte astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro svelte: specifier: ^4.2.5 @@ -357,7 +357,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^4.0.5 + specifier: ^4.0.9 version: link:../../packages/astro sass: specifier: ^1.69.5 @@ -369,13 +369,13 @@ importers: examples/view-transitions: devDependencies: '@astrojs/node': - specifier: ^7.0.3 + specifier: ^7.0.4 version: link:../../packages/integrations/node '@astrojs/tailwind': specifier: ^5.1.0 version: link:../../packages/integrations/tailwind astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/with-markdoc: @@ -384,7 +384,7 @@ importers: specifier: ^0.8.2 version: link:../../packages/integrations/markdoc astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/with-markdown-plugins: @@ -393,7 +393,7 @@ importers: specifier: ^4.0.1 version: link:../../packages/markdown/remark astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro hast-util-select: specifier: ^6.0.2 @@ -414,7 +414,7 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro examples/with-mdx: @@ -426,7 +426,7 @@ importers: specifier: ^3.0.2 version: link:../../packages/integrations/preact astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -441,7 +441,7 @@ importers: specifier: ^0.5.0 version: 0.5.0(nanostores@0.9.5)(preact@10.19.3) astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro nanostores: specifier: ^0.9.5 @@ -462,7 +462,7 @@ importers: specifier: ^1.6.3 version: 1.6.4 astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro autoprefixer: specifier: ^10.4.15 @@ -480,7 +480,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^4.0.8 + specifier: ^4.0.9 version: link:../../packages/astro vitest: specifier: ^0.34.2