Overhaul errors for consistency and correctness#16593
Conversation
🦋 Changeset detectedLatest commit: dd42e62 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will improve performance by 10.51%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | Build: hybrid site (static + server) |
10.6 s | 9.6 s | +10.51% |
Comparing errors-fix (dd42e62) with main (272185b)
| * - [Dynamic Routes](https://docs.astro.build/en/guides/routing/#dynamic-routes) | ||
| * - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths) | ||
| * - [Server-side Rendering](https://docs.astro.build/en/guides/on-demand-rendering/) | ||
| * - [Server-side rendering](https://docs.astro.build/en/guides/on-demand-rendering/) |
There was a problem hiding this comment.
I wonder if we should take this opportunity to adjust the wording for consistency:
-Server-side rendering
+On-demand renderingBut this is used in several places so it might be easier to check the occurrence in an editor. That's said, this can also happen another time. Just a though while reviewing!
There was a problem hiding this comment.
True! I had that planned as a follow-up but forgot to mention in the PR description
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
ArmandPhilippot
left a comment
There was a problem hiding this comment.
I'm not sure about the view transition test, but core-image.test.ts is flaky! I had to rerun the test a few times this morning to merge a docs-only PR. So, LGTM! Thank you!
delucis
left a comment
There was a problem hiding this comment.
Mostly looks great — @yanthomasdev! Just one comment.
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
* Overhaul errors for consistency and correctness * Add changeset * wrong package, lol * Apply Armand's fixes Co-authored-by: Armand Philippot <git@armand.philippot.eu> * fix error messages in tests * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * Update packages/astro/src/core/errors/errors-data.ts --------- Co-authored-by: Armand Philippot <git@armand.philippot.eu> Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`6.3.3` → `6.3.5`](https://renovatebot.com/diffs/npm/astro/6.3.3/6.3.5) |  |  | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v6.3.5`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#635) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.4...astro@6.3.5) ##### Patch Changes - [#​16771](withastro/astro#16771) [`07c8805`](withastro/astro@07c8805) Thanks [@​ematipico](https://github.com/ematipico)! - Fixes `position` prop on `<Image>` and `<Picture>` components breaking Content Security Policy (CSP). - [#​16593](withastro/astro#16593) [`50924ce`](withastro/astro@50924ce) Thanks [@​yanthomasdev](https://github.com/yanthomasdev)! - Improves error messages with more consistent and correct writing. - [#​16757](withastro/astro#16757) [`5d661cd`](withastro/astro@5d661cd) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes dev server serving stale content when SSR-only modules change (e.g. `.astro` files outside the project root in a monorepo, or dynamically imported components). Previously, the `astro:hmr-reload` plugin returned an empty array after detecting SSR-only module changes, which prevented Vite's `updateModules` from propagating the invalidation to the SSR module runner. The runner's evaluated module cache stayed stale, so subsequent requests continued returning old content. Now the plugin returns the SSR-only modules so Vite can process them through `updateModules`, which properly invalidates the module runner's cache and ensures fresh content on the next request. ### [`v6.3.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#634) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.3...astro@6.3.4) ##### Patch Changes - [#​16723](withastro/astro#16723) [`0f10bfe`](withastro/astro@0f10bfe) Thanks [@​matthewp](https://github.com/matthewp)! - Adds `fetchFile` option to `experimental.advancedRouting` to customize or disable the entrypoint file ```js export default defineConfig({ experimental: { advancedRouting: { fetchFile: 'fetch.ts', }, }, }); ``` - [#​16723](withastro/astro#16723) [`0f10bfe`](withastro/astro@0f10bfe) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes Hono `cache()` middleware to follow the standard wrapper pattern - [#​16723](withastro/astro#16723) [`0f10bfe`](withastro/astro@0f10bfe) Thanks [@​matthewp](https://github.com/matthewp)! - Adds `App.Providers` interface for typing custom context providers on `Astro` and `ctx` ```ts declare namespace App { interface Providers { oauth: import('./lib/oauth').OAuthSession; } } ``` - [#​16723](withastro/astro#16723) [`0f10bfe`](withastro/astro@0f10bfe) Thanks [@​matthewp](https://github.com/matthewp)! - Adds `FetchState.response` property, set automatically after `pages()` or `middleware()` completes ```ts const response = await middleware(state, (s) => pages(s)); console.log(state.response === response); // true ``` - [#​16723](withastro/astro#16723) [`0f10bfe`](withastro/astro@0f10bfe) Thanks [@​matthewp](https://github.com/matthewp)! - Adds `Fetchable` type export for typing the advanced routing entrypoint ```ts import type { Fetchable } from 'astro'; export default { async fetch(request) { return new Response('ok'); }, } satisfies Fetchable; ``` - [#​16572](withastro/astro#16572) [`4a5a077`](withastro/astro@4a5a077) Thanks [@​DORI2001](https://github.com/DORI2001)! - Suppresses `[WARN] Vite warning: unused imports from "@​astrojs/internal-helpers/remote"` during prerender builds. The package is now bundled alongside `astro` in the prerender environment, matching how it is handled in the SSR environment. - [#​16756](withastro/astro#16756) [`b6ee23d`](withastro/astro@b6ee23d) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes styles from Markdoc/MDX custom components not being extracted to `<head>` in the dev server when using the Cloudflare adapter with `prerenderEnvironment: 'node'` and rendering content through a wrapper component. - [#​16747](withastro/astro#16747) [`904d19a`](withastro/astro@904d19a) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes Astro action requests failing in `astro dev` when using the Cloudflare adapter with `prerenderEnvironment: 'node'` alongside a prerendered catch-all route such as `[...page].astro`. Actions and other SSR POST endpoints now continue to work in dev instead of returning an HTTP 500 error. - [#​16701](withastro/astro#16701) [`3495ce4`](withastro/astro@3495ce4) Thanks [@​demaisj](https://github.com/demaisj)! - Fix `Map` and `Set` instances saved in a content collection being broken when retrieving entries. - [#​16614](withastro/astro#16614) [`fca1c32`](withastro/astro@fca1c32) Thanks [@​Eptagone](https://github.com/Eptagone)! - Fixes `entry.data` type inference when a live collection is configured without a schema. - [#​16661](withastro/astro#16661) [`03b8f7f`](withastro/astro@03b8f7f) Thanks [@​ocavue](https://github.com/ocavue)! - Updates `typescript` to v6. No changes are needed from users. - [#​16681](withastro/astro#16681) [`c22770a`](withastro/astro@c22770a) Thanks [@​dotnetCarpenter](https://github.com/dotnetCarpenter)! - Fixes an issue where SVG images with `width="0"` or `height="0"` incorrectly threw a `NoImageMetadata` error instead of being treated as valid dimensions. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODIuMSIsInVwZGF0ZWRJblZlciI6IjQzLjE4Mi4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Changes
This PR does an overhaul of all error messages to make them more consistent with each other, namely:
Testing
I am not sure if adding backticks in a few places could break rendering, we'll be sure once we get the automated PR on docs.
Docs
That's all it is.