astro 2.10.1 → 2.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ViewTransitions.astro +8 -3
- package/dist/@types/astro.d.ts +8 -4
- package/dist/content/types-generator.js +1 -1
- package/dist/content/vite-plugin-content-imports.js +2 -1
- package/dist/core/app/index.js +4 -7
- package/dist/core/build/static-build.js +3 -14
- package/dist/core/compile/compile.js +1 -0
- package/dist/core/compile/style.js +1 -0
- package/dist/core/config/config.d.ts +6 -0
- package/dist/core/config/config.js +3 -0
- package/dist/core/config/settings.js +1 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/dev/vite.js +10 -10
- package/dist/core/errors/errors-data.d.ts +1048 -962
- package/dist/core/errors/errors-data.js +446 -996
- package/dist/core/errors/errors.d.ts +1 -1
- package/dist/core/errors/errors.js +1 -11
- package/dist/core/errors/index.d.ts +1 -1
- package/dist/core/errors/index.js +1 -1
- package/dist/core/errors/utils.d.ts +0 -5
- package/dist/core/errors/utils.js +0 -11
- package/dist/core/messages.js +2 -2
- package/dist/core/util.js +3 -2
- package/dist/jsx/babel.js +1 -1
- package/dist/template/4xx.js +27 -5
- package/dist/transitions/vite-plugin-transitions.js +1 -0
- package/dist/vite-plugin-integrations-container/index.js +17 -0
- package/dist/vite-plugin-markdown/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,1015 +1,465 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @description
|
|
45
|
-
* The adapter you're using unfortunately does not support `Astro.clientAddress`.
|
|
46
|
-
*/
|
|
47
|
-
ClientAddressNotAvailable: {
|
|
48
|
-
title: "`Astro.clientAddress` is not available in current adapter.",
|
|
49
|
-
message: (adapterName) => `\`Astro.clientAddress\` is not available in the \`${adapterName}\` adapter. File an issue with the adapter to add support.`
|
|
50
|
-
},
|
|
51
|
-
/**
|
|
52
|
-
* @docs
|
|
53
|
-
* @see
|
|
54
|
-
* - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)
|
|
55
|
-
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress)
|
|
56
|
-
* @description
|
|
57
|
-
* The `Astro.clientAddress` property is only available when [Server-side rendering](https://docs.astro.build/en/guides/server-side-rendering/) is enabled.
|
|
58
|
-
*
|
|
59
|
-
* To get the user's IP address in static mode, different APIs such as [Ipify](https://www.ipify.org/) can be used in a [Client-side script](https://docs.astro.build/en/guides/client-side-scripts/) or it may be possible to get the user's IP using a serverless function hosted on your hosting provider.
|
|
60
|
-
*/
|
|
61
|
-
StaticClientAddressNotAvailable: {
|
|
62
|
-
title: "`Astro.clientAddress` is not available in static mode.",
|
|
63
|
-
message: "`Astro.clientAddress` is only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
|
|
64
|
-
hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* @docs
|
|
68
|
-
* @see
|
|
69
|
-
* - [getStaticPaths()](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
70
|
-
* @description
|
|
71
|
-
* A [dynamic route](https://docs.astro.build/en/core-concepts/routing/#dynamic-routes) was matched, but no corresponding path was found for the requested parameters. This is often caused by a typo in either the generated or the requested path.
|
|
72
|
-
*/
|
|
73
|
-
NoMatchingStaticPathFound: {
|
|
74
|
-
title: "No static path found for requested path.",
|
|
75
|
-
message: (pathName) => `A \`getStaticPaths()\` route pattern was matched, but no matching static path was found for requested path \`${pathName}\`.`,
|
|
76
|
-
hint: (possibleRoutes) => `Possible dynamic routes being matched: ${possibleRoutes.join(", ")}.`
|
|
77
|
-
},
|
|
78
|
-
/**
|
|
79
|
-
* @docs
|
|
80
|
-
* @message Route returned a `RETURNED_VALUE`. Only a Response can be returned from Astro files.
|
|
81
|
-
* @see
|
|
82
|
-
* - [Response](https://docs.astro.build/en/guides/server-side-rendering/#response)
|
|
83
|
-
* @description
|
|
84
|
-
* Only instances of [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned inside Astro files.
|
|
85
|
-
* ```astro title="pages/login.astro"
|
|
86
|
-
* ---
|
|
87
|
-
* return new Response(null, {
|
|
88
|
-
* status: 404,
|
|
89
|
-
* statusText: 'Not found'
|
|
90
|
-
* });
|
|
91
|
-
*
|
|
92
|
-
* // Alternatively, for redirects, Astro.redirect also returns an instance of Response
|
|
93
|
-
* return Astro.redirect('/login');
|
|
94
|
-
* ---
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
*/
|
|
98
|
-
OnlyResponseCanBeReturned: {
|
|
99
|
-
title: "Invalid type returned by Astro page.",
|
|
100
|
-
message: (route, returnedValue) => `Route \`${route ? route : ""}\` returned a \`${returnedValue}\`. Only a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned from Astro files.`,
|
|
101
|
-
hint: "See https://docs.astro.build/en/guides/server-side-rendering/#response for more information."
|
|
102
|
-
},
|
|
103
|
-
/**
|
|
104
|
-
* @docs
|
|
105
|
-
* @see
|
|
106
|
-
* - [`client:media`](https://docs.astro.build/en/reference/directives-reference/#clientmedia)
|
|
107
|
-
* @description
|
|
108
|
-
* A [media query](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries) parameter is required when using the `client:media` directive.
|
|
109
|
-
*
|
|
110
|
-
* ```astro
|
|
111
|
-
* <Counter client:media="(max-width: 640px)" />
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
MissingMediaQueryDirective: {
|
|
115
|
-
title: "Missing value for `client:media` directive.",
|
|
116
|
-
message: 'Media query not provided for `client:media` directive. A media query similar to `client:media="(max-width: 600px)"` must be provided'
|
|
117
|
-
},
|
|
118
|
-
/**
|
|
119
|
-
* @docs
|
|
120
|
-
* @message Unable to render `COMPONENT_NAME`. There are `RENDERER_COUNT` renderer(s) configured in your `astro.config.mjs` file, but none were able to server-side render `COMPONENT_NAME`.
|
|
121
|
-
* @see
|
|
122
|
-
* - [Frameworks components](https://docs.astro.build/en/core-concepts/framework-components/)
|
|
123
|
-
* - [UI Frameworks](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
|
|
124
|
-
* @description
|
|
125
|
-
* None of the installed integrations were able to render the component you imported. Make sure to install the appropriate integration for the type of component you are trying to include in your page.
|
|
126
|
-
*
|
|
127
|
-
* For JSX / TSX files, [@astrojs/react](https://docs.astro.build/en/guides/integrations-guide/react/), [@astrojs/preact](https://docs.astro.build/en/guides/integrations-guide/preact/) or [@astrojs/solid-js](https://docs.astro.build/en/guides/integrations-guide/solid-js/) can be used. For Vue and Svelte files, the [@astrojs/vue](https://docs.astro.build/en/guides/integrations-guide/vue/) and [@astrojs/svelte](https://docs.astro.build/en/guides/integrations-guide/svelte/) integrations can be used respectively
|
|
128
|
-
*/
|
|
129
|
-
NoMatchingRenderer: {
|
|
130
|
-
title: "No matching renderer found.",
|
|
131
|
-
message: (componentName, componentExtension, plural, validRenderersCount) => `Unable to render \`${componentName}\`.
|
|
1
|
+
const UnknownCompilerError = {
|
|
2
|
+
name: "UnknownCompilerError",
|
|
3
|
+
title: "Unknown compiler error.",
|
|
4
|
+
hint: "This is almost always a problem with the Astro compiler, not your code. Please open an issue at https://astro.build/issues/compiler."
|
|
5
|
+
};
|
|
6
|
+
const StaticRedirectNotAvailable = {
|
|
7
|
+
name: "StaticRedirectNotAvailable",
|
|
8
|
+
title: "`Astro.redirect` is not available in static mode.",
|
|
9
|
+
message: "Redirects are only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
|
|
10
|
+
hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
|
|
11
|
+
};
|
|
12
|
+
const ClientAddressNotAvailable = {
|
|
13
|
+
name: "ClientAddressNotAvailable",
|
|
14
|
+
title: "`Astro.clientAddress` is not available in current adapter.",
|
|
15
|
+
message: (adapterName) => `\`Astro.clientAddress\` is not available in the \`${adapterName}\` adapter. File an issue with the adapter to add support.`
|
|
16
|
+
};
|
|
17
|
+
const StaticClientAddressNotAvailable = {
|
|
18
|
+
name: "StaticClientAddressNotAvailable",
|
|
19
|
+
title: "`Astro.clientAddress` is not available in static mode.",
|
|
20
|
+
message: "`Astro.clientAddress` is only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
|
|
21
|
+
hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
|
|
22
|
+
};
|
|
23
|
+
const NoMatchingStaticPathFound = {
|
|
24
|
+
name: "NoMatchingStaticPathFound",
|
|
25
|
+
title: "No static path found for requested path.",
|
|
26
|
+
message: (pathName) => `A \`getStaticPaths()\` route pattern was matched, but no matching static path was found for requested path \`${pathName}\`.`,
|
|
27
|
+
hint: (possibleRoutes) => `Possible dynamic routes being matched: ${possibleRoutes.join(", ")}.`
|
|
28
|
+
};
|
|
29
|
+
const OnlyResponseCanBeReturned = {
|
|
30
|
+
name: "OnlyResponseCanBeReturned",
|
|
31
|
+
title: "Invalid type returned by Astro page.",
|
|
32
|
+
message: (route, returnedValue) => `Route \`${route ? route : ""}\` returned a \`${returnedValue}\`. Only a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned from Astro files.`,
|
|
33
|
+
hint: "See https://docs.astro.build/en/guides/server-side-rendering/#response for more information."
|
|
34
|
+
};
|
|
35
|
+
const MissingMediaQueryDirective = {
|
|
36
|
+
name: "MissingMediaQueryDirective",
|
|
37
|
+
title: "Missing value for `client:media` directive.",
|
|
38
|
+
message: 'Media query not provided for `client:media` directive. A media query similar to `client:media="(max-width: 600px)"` must be provided'
|
|
39
|
+
};
|
|
40
|
+
const NoMatchingRenderer = {
|
|
41
|
+
name: "NoMatchingRenderer",
|
|
42
|
+
title: "No matching renderer found.",
|
|
43
|
+
message: (componentName, componentExtension, plural, validRenderersCount) => `Unable to render \`${componentName}\`.
|
|
132
44
|
|
|
133
45
|
${validRenderersCount > 0 ? `There ${plural ? "are" : "is"} ${validRenderersCount} renderer${plural ? "s" : ""} configured in your \`astro.config.mjs\` file,
|
|
134
46
|
but ${plural ? "none were" : "it was not"} able to server-side render \`${componentName}\`.` : `No valid renderer was found ${componentExtension ? `for the \`.${componentExtension}\` file extension.` : `for this file extension.`}`}`,
|
|
135
|
-
|
|
47
|
+
hint: (probableRenderers) => `Did you mean to enable the ${probableRenderers} integration?
|
|
136
48
|
|
|
137
49
|
See https://docs.astro.build/en/core-concepts/framework-components/ for more information on how to install and configure integrations.`
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
193
|
-
},
|
|
194
|
-
/**
|
|
195
|
-
* @docs
|
|
196
|
-
* @see
|
|
197
|
-
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
198
|
-
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
199
|
-
* @description
|
|
200
|
-
* `getStaticPaths`'s return value must be an array of objects.
|
|
201
|
-
*
|
|
202
|
-
* ```ts title="pages/blog/[id].astro"
|
|
203
|
-
* export async function getStaticPaths() {
|
|
204
|
-
* return [ // <-- Array
|
|
205
|
-
* { params: { slug: "blog" } },
|
|
206
|
-
* { params: { slug: "about" } }
|
|
207
|
-
* ];
|
|
208
|
-
*}
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
InvalidGetStaticPathsReturn: {
|
|
212
|
-
title: "Invalid value returned by getStaticPaths.",
|
|
213
|
-
message: (returnType) => `Invalid type returned by \`getStaticPaths\`. Expected an \`array\`, got \`${returnType}\``,
|
|
214
|
-
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
215
|
-
},
|
|
216
|
-
/**
|
|
217
|
-
* @docs
|
|
218
|
-
* @see
|
|
219
|
-
* - [RSS Guide](https://docs.astro.build/en/guides/rss/)
|
|
220
|
-
* @description
|
|
221
|
-
* `getStaticPaths` no longer expose an helper for generating a RSS feed. We recommend migrating to the [@astrojs/rss](https://docs.astro.build/en/guides/rss/#setting-up-astrojsrss)integration instead.
|
|
222
|
-
*/
|
|
223
|
-
GetStaticPathsRemovedRSSHelper: {
|
|
224
|
-
title: "getStaticPaths RSS helper is not available anymore.",
|
|
225
|
-
message: "The RSS helper has been removed from `getStaticPaths`. Try the new @astrojs/rss package instead.",
|
|
226
|
-
hint: "See https://docs.astro.build/en/guides/rss/ for more information."
|
|
227
|
-
},
|
|
228
|
-
/**
|
|
229
|
-
* @docs
|
|
230
|
-
* @see
|
|
231
|
-
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
232
|
-
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
233
|
-
* @description
|
|
234
|
-
* Every route specified by `getStaticPaths` require a `params` property specifying the path parameters needed to match the route.
|
|
235
|
-
*
|
|
236
|
-
* For instance, the following code:
|
|
237
|
-
* ```astro title="pages/blog/[id].astro"
|
|
238
|
-
* ---
|
|
239
|
-
* export async function getStaticPaths() {
|
|
240
|
-
* return [
|
|
241
|
-
* { params: { id: '1' } }
|
|
242
|
-
* ];
|
|
243
|
-
* }
|
|
244
|
-
* ---
|
|
245
|
-
* ```
|
|
246
|
-
* Will create the following route: `site.com/blog/1`.
|
|
247
|
-
*/
|
|
248
|
-
GetStaticPathsExpectedParams: {
|
|
249
|
-
title: "Missing params property on `getStaticPaths` route.",
|
|
250
|
-
message: "Missing or empty required `params` property on `getStaticPaths` route.",
|
|
251
|
-
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
252
|
-
},
|
|
253
|
-
/**
|
|
254
|
-
* @docs
|
|
255
|
-
* @see
|
|
256
|
-
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
257
|
-
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
258
|
-
* @description
|
|
259
|
-
* Since `params` are encoded into the URL, only certain types are supported as values.
|
|
260
|
-
*
|
|
261
|
-
* ```astro title="/route/[id].astro"
|
|
262
|
-
* ---
|
|
263
|
-
* export async function getStaticPaths() {
|
|
264
|
-
* return [
|
|
265
|
-
* { params: { id: '1' } } // Works
|
|
266
|
-
* { params: { id: 2 } } // Works
|
|
267
|
-
* { params: { id: false } } // Does not work
|
|
268
|
-
* ];
|
|
269
|
-
* }
|
|
270
|
-
* ---
|
|
271
|
-
* ```
|
|
272
|
-
*
|
|
273
|
-
* In routes using [rest parameters](https://docs.astro.build/en/core-concepts/routing/#rest-parameters), `undefined` can be used to represent a path with no parameters passed in the URL:
|
|
274
|
-
*
|
|
275
|
-
* ```astro title="/route/[...id].astro"
|
|
276
|
-
* ---
|
|
277
|
-
* export async function getStaticPaths() {
|
|
278
|
-
* return [
|
|
279
|
-
* { params: { id: 1 } } // /route/1
|
|
280
|
-
* { params: { id: 2 } } // /route/2
|
|
281
|
-
* { params: { id: undefined } } // /route/
|
|
282
|
-
* ];
|
|
283
|
-
* }
|
|
284
|
-
* ---
|
|
285
|
-
* ```
|
|
286
|
-
*/
|
|
287
|
-
GetStaticPathsInvalidRouteParam: {
|
|
288
|
-
title: "Invalid value for `getStaticPaths` route parameter.",
|
|
289
|
-
message: (key, value, valueType) => `Invalid getStaticPaths route parameter for \`${key}\`. Expected undefined, a string or a number, received \`${valueType}\` (\`${value}\`)`,
|
|
290
|
-
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
291
|
-
},
|
|
292
|
-
/**
|
|
293
|
-
* @docs
|
|
294
|
-
* @see
|
|
295
|
-
* - [Dynamic Routes](https://docs.astro.build/en/core-concepts/routing/#dynamic-routes)
|
|
296
|
-
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
297
|
-
* - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
|
|
298
|
-
* @description
|
|
299
|
-
* In [Static Mode](https://docs.astro.build/en/core-concepts/routing/#static-ssg-mode), all routes must be determined at build time. As such, dynamic routes must `export` a `getStaticPaths` function returning the different paths to generate.
|
|
300
|
-
*/
|
|
301
|
-
GetStaticPathsRequired: {
|
|
302
|
-
title: "`getStaticPaths()` function required for dynamic routes.",
|
|
303
|
-
message: "`getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.",
|
|
304
|
-
hint: `See https://docs.astro.build/en/core-concepts/routing/#dynamic-routes for more information on dynamic routes.
|
|
50
|
+
};
|
|
51
|
+
const NoClientEntrypoint = {
|
|
52
|
+
name: "NoClientEntrypoint",
|
|
53
|
+
title: "No client entrypoint specified in renderer.",
|
|
54
|
+
message: (componentName, clientDirective, rendererName) => `\`${componentName}\` component has a \`client:${clientDirective}\` directive, but no client entrypoint was provided by \`${rendererName}\`.`,
|
|
55
|
+
hint: "See https://docs.astro.build/en/reference/integrations-reference/#addrenderer-option for more information on how to configure your renderer."
|
|
56
|
+
};
|
|
57
|
+
const NoClientOnlyHint = {
|
|
58
|
+
name: "NoClientOnlyHint",
|
|
59
|
+
title: "Missing hint on client:only directive.",
|
|
60
|
+
message: (componentName) => `Unable to render \`${componentName}\`. When using the \`client:only\` hydration strategy, Astro needs a hint to use the correct renderer.`,
|
|
61
|
+
hint: (probableRenderers) => `Did you mean to pass \`client:only="${probableRenderers}"\`? See https://docs.astro.build/en/reference/directives-reference/#clientonly for more information on client:only`
|
|
62
|
+
};
|
|
63
|
+
const InvalidGetStaticPathParam = {
|
|
64
|
+
name: "InvalidGetStaticPathParam",
|
|
65
|
+
title: "Invalid value returned by a `getStaticPaths` path.",
|
|
66
|
+
message: (paramType) => `Invalid params given to \`getStaticPaths\` path. Expected an \`object\`, got \`${paramType}\``,
|
|
67
|
+
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
68
|
+
};
|
|
69
|
+
const InvalidGetStaticPathsEntry = {
|
|
70
|
+
name: "InvalidGetStaticPathsEntry",
|
|
71
|
+
title: "Invalid entry inside getStaticPath's return value",
|
|
72
|
+
message: (entryType) => `Invalid entry returned by getStaticPaths. Expected an object, got \`${entryType}\``,
|
|
73
|
+
hint: "If you're using a `.map` call, you might be looking for `.flatMap()` instead. See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
74
|
+
};
|
|
75
|
+
const InvalidGetStaticPathsReturn = {
|
|
76
|
+
name: "InvalidGetStaticPathsReturn",
|
|
77
|
+
title: "Invalid value returned by getStaticPaths.",
|
|
78
|
+
message: (returnType) => `Invalid type returned by \`getStaticPaths\`. Expected an \`array\`, got \`${returnType}\``,
|
|
79
|
+
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
80
|
+
};
|
|
81
|
+
const GetStaticPathsRemovedRSSHelper = {
|
|
82
|
+
name: "GetStaticPathsRemovedRSSHelper",
|
|
83
|
+
title: "getStaticPaths RSS helper is not available anymore.",
|
|
84
|
+
message: "The RSS helper has been removed from `getStaticPaths`. Try the new @astrojs/rss package instead.",
|
|
85
|
+
hint: "See https://docs.astro.build/en/guides/rss/ for more information."
|
|
86
|
+
};
|
|
87
|
+
const GetStaticPathsExpectedParams = {
|
|
88
|
+
name: "GetStaticPathsExpectedParams",
|
|
89
|
+
title: "Missing params property on `getStaticPaths` route.",
|
|
90
|
+
message: "Missing or empty required `params` property on `getStaticPaths` route.",
|
|
91
|
+
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
92
|
+
};
|
|
93
|
+
const GetStaticPathsInvalidRouteParam = {
|
|
94
|
+
name: "GetStaticPathsInvalidRouteParam",
|
|
95
|
+
title: "Invalid value for `getStaticPaths` route parameter.",
|
|
96
|
+
message: (key, value, valueType) => `Invalid getStaticPaths route parameter for \`${key}\`. Expected undefined, a string or a number, received \`${valueType}\` (\`${value}\`)`,
|
|
97
|
+
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
98
|
+
};
|
|
99
|
+
const GetStaticPathsRequired = {
|
|
100
|
+
name: "GetStaticPathsRequired",
|
|
101
|
+
title: "`getStaticPaths()` function required for dynamic routes.",
|
|
102
|
+
message: "`getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.",
|
|
103
|
+
hint: `See https://docs.astro.build/en/core-concepts/routing/#dynamic-routes for more information on dynamic routes.
|
|
305
104
|
|
|
306
105
|
Alternatively, set \`output: "server"\` in your Astro config file to switch to a non-static server build. This error can also occur if using \`export const prerender = true;\`.
|
|
307
106
|
See https://docs.astro.build/en/guides/server-side-rendering/ for more information on non-static rendering.`
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
* @docs
|
|
335
|
-
* @description
|
|
336
|
-
* No import statement was found for one of the components. If there is an import statement, make sure you are using the same identifier in both the imports and the component usage.
|
|
337
|
-
*/
|
|
338
|
-
NoMatchingImport: {
|
|
339
|
-
title: "No import found for component.",
|
|
340
|
-
message: (componentName) => `Could not render \`${componentName}\`. No matching import has been found for \`${componentName}\`.`,
|
|
341
|
-
hint: "Please make sure the component is properly imported."
|
|
342
|
-
},
|
|
343
|
-
/**
|
|
344
|
-
* @docs
|
|
345
|
-
* @message
|
|
346
|
-
* **Example error messages:**<br/>
|
|
347
|
-
* InvalidPrerenderExport: A `prerender` export has been detected, but its value cannot be statically analyzed.
|
|
348
|
-
* @description
|
|
349
|
-
* The `prerender` feature only supports a subset of valid JavaScript — be sure to use exactly `export const prerender = true` so that our compiler can detect this directive at build time. Variables, `let`, and `var` declarations are not supported.
|
|
350
|
-
*/
|
|
351
|
-
InvalidPrerenderExport: {
|
|
352
|
-
title: "Invalid prerender export.",
|
|
353
|
-
message: (prefix, suffix, isHydridOuput) => {
|
|
354
|
-
const defaultExpectedValue = isHydridOuput ? "false" : "true";
|
|
355
|
-
let msg = `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`;
|
|
356
|
-
if (prefix !== "const")
|
|
357
|
-
msg += `
|
|
107
|
+
};
|
|
108
|
+
const ReservedSlotName = {
|
|
109
|
+
name: "ReservedSlotName",
|
|
110
|
+
title: "Invalid slot name.",
|
|
111
|
+
message: (slotName) => `Unable to create a slot named \`${slotName}\`. \`${slotName}\` is a reserved slot name. Please update the name of this slot.`
|
|
112
|
+
};
|
|
113
|
+
const NoAdapterInstalled = {
|
|
114
|
+
name: "NoAdapterInstalled",
|
|
115
|
+
title: "Cannot use Server-side Rendering without an adapter.",
|
|
116
|
+
message: `Cannot use \`output: 'server'\` or \`output: 'hybrid'\` without an adapter. Please install and configure the appropriate server adapter for your final deployment.`,
|
|
117
|
+
hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information."
|
|
118
|
+
};
|
|
119
|
+
const NoMatchingImport = {
|
|
120
|
+
name: "NoMatchingImport",
|
|
121
|
+
title: "No import found for component.",
|
|
122
|
+
message: (componentName) => `Could not render \`${componentName}\`. No matching import has been found for \`${componentName}\`.`,
|
|
123
|
+
hint: "Please make sure the component is properly imported."
|
|
124
|
+
};
|
|
125
|
+
const InvalidPrerenderExport = {
|
|
126
|
+
name: "InvalidPrerenderExport",
|
|
127
|
+
title: "Invalid prerender export.",
|
|
128
|
+
message: (prefix, suffix, isHydridOuput) => {
|
|
129
|
+
const defaultExpectedValue = isHydridOuput ? "false" : "true";
|
|
130
|
+
let msg = `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`;
|
|
131
|
+
if (prefix !== "const")
|
|
132
|
+
msg += `
|
|
358
133
|
Expected \`const\` declaration but got \`${prefix}\`.`;
|
|
359
|
-
|
|
360
|
-
|
|
134
|
+
if (suffix !== "true")
|
|
135
|
+
msg += `
|
|
361
136
|
Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
362
|
-
|
|
363
|
-
},
|
|
364
|
-
hint: "Mutable values declared at runtime are not supported. Please make sure to use exactly `export const prerender = true`."
|
|
365
|
-
},
|
|
366
|
-
/**
|
|
367
|
-
* @docs
|
|
368
|
-
* @message
|
|
369
|
-
* **Example error messages:**<br/>
|
|
370
|
-
* InvalidComponentArgs: Invalid arguments passed to `<MyAstroComponent>` component.
|
|
371
|
-
* @description
|
|
372
|
-
* Astro components cannot be rendered manually via a function call, such as `Component()` or `{items.map(Component)}`. Prefer the component syntax `<Component />` or `{items.map(item => <Component {...item} />)}`.
|
|
373
|
-
*/
|
|
374
|
-
InvalidComponentArgs: {
|
|
375
|
-
title: "Invalid component arguments.",
|
|
376
|
-
message: (name) => `Invalid arguments passed to${name ? ` <${name}>` : ""} component.`,
|
|
377
|
-
hint: "Astro components cannot be rendered directly via function call, such as `Component()` or `{items.map(Component)}`."
|
|
378
|
-
},
|
|
379
|
-
/**
|
|
380
|
-
* @docs
|
|
381
|
-
* @see
|
|
382
|
-
* - [Pagination](https://docs.astro.build/en/core-concepts/routing/#pagination)
|
|
383
|
-
* @description
|
|
384
|
-
* The page number parameter was not found in your filepath.
|
|
385
|
-
*/
|
|
386
|
-
PageNumberParamNotFound: {
|
|
387
|
-
title: "Page number param not found.",
|
|
388
|
-
message: (paramName) => `[paginate()] page number param \`${paramName}\` not found in your filepath.`,
|
|
389
|
-
hint: "Rename your file to `[page].astro` or `[...page].astro`."
|
|
390
|
-
},
|
|
391
|
-
/**
|
|
392
|
-
* @docs
|
|
393
|
-
* @see
|
|
394
|
-
* - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
|
|
395
|
-
* - [Image component](https://docs.astro.build/en/guides/assets/#image--astroassets)
|
|
396
|
-
* - [Image component#alt](https://docs.astro.build/en/guides/assets/#alt-required)
|
|
397
|
-
* @description
|
|
398
|
-
* The `alt` property allows you to provide descriptive alt text to users of screen readers and other assistive technologies. In order to ensure your images are accessible, the `Image` component requires that an `alt` be specified.
|
|
399
|
-
*
|
|
400
|
-
* If the image is merely decorative (i.e. doesn’t contribute to the understanding of the page), set `alt=""` so that screen readers know to ignore the image.
|
|
401
|
-
*/
|
|
402
|
-
ImageMissingAlt: {
|
|
403
|
-
title: "Missing alt property.",
|
|
404
|
-
message: "The alt property is required.",
|
|
405
|
-
hint: "The `alt` property is important for the purpose of accessibility, without it users using screen readers or other assistive technologies won't be able to understand what your image is supposed to represent. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-alt for more information."
|
|
406
|
-
},
|
|
407
|
-
/**
|
|
408
|
-
* @docs
|
|
409
|
-
* @see
|
|
410
|
-
* - [Image Service API](https://docs.astro.build/en/reference/image-service-reference/)
|
|
411
|
-
* @description
|
|
412
|
-
* There was an error while loading the configured image service. This can be caused by various factors, such as your image service not properly exporting a compatible object in its default export, or an incorrect path.
|
|
413
|
-
*
|
|
414
|
-
* If you believe that your service is properly configured and this error is wrong, please [open an issue](https://astro.build/issues/).
|
|
415
|
-
*/
|
|
416
|
-
InvalidImageService: {
|
|
417
|
-
title: "Error while loading image service.",
|
|
418
|
-
message: "There was an error loading the configured image service. Please see the stack trace for more information."
|
|
419
|
-
},
|
|
420
|
-
/**
|
|
421
|
-
* @docs
|
|
422
|
-
* @message
|
|
423
|
-
* Missing width and height attributes for `IMAGE_URL`. When using remote images, both dimensions are always required in order to avoid cumulative layout shift (CLS).
|
|
424
|
-
* @see
|
|
425
|
-
* - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
|
|
426
|
-
* - [Image component#width-and-height](https://docs.astro.build/en/guides/assets/#width-and-height)
|
|
427
|
-
* @description
|
|
428
|
-
* For remote images, `width` and `height` cannot be inferred from the original file. As such, in order to avoid CLS, those two properties are always required.
|
|
429
|
-
*
|
|
430
|
-
* If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets).
|
|
431
|
-
*/
|
|
432
|
-
MissingImageDimension: {
|
|
433
|
-
title: "Missing image dimensions",
|
|
434
|
-
message: (missingDimension, imageURL) => `Missing ${missingDimension === "both" ? "width and height attributes" : `${missingDimension} attribute`} for ${imageURL}. When using remote images, both dimensions are always required in order to avoid CLS.`,
|
|
435
|
-
hint: "If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets)."
|
|
436
|
-
},
|
|
437
|
-
/**
|
|
438
|
-
* @docs
|
|
439
|
-
* @description
|
|
440
|
-
* The built-in image services do not currently support optimizing all image formats.
|
|
441
|
-
*
|
|
442
|
-
* For unsupported formats such as SVGs and GIFs, you may be able to use an `img` tag directly:
|
|
443
|
-
* ```astro
|
|
444
|
-
* ---
|
|
445
|
-
* import rocket from '../assets/images/rocket.svg';
|
|
446
|
-
* ---
|
|
447
|
-
*
|
|
448
|
-
* <img src={rocket.src} width={rocket.width} height={rocket.height} alt="A rocketship in space." />
|
|
449
|
-
* ```
|
|
450
|
-
*/
|
|
451
|
-
UnsupportedImageFormat: {
|
|
452
|
-
title: "Unsupported image format",
|
|
453
|
-
message: (format, imagePath, supportedFormats) => `Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join(
|
|
454
|
-
", "
|
|
455
|
-
)} are supported by our image services.`,
|
|
456
|
-
hint: "Using an `img` tag directly instead of the `Image` component might be what you're looking for."
|
|
457
|
-
},
|
|
458
|
-
/**
|
|
459
|
-
* @docs
|
|
460
|
-
* @see
|
|
461
|
-
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
462
|
-
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
463
|
-
* @description
|
|
464
|
-
* The endpoint is prerendered with an `undefined` param so the generated path will collide with another route.
|
|
465
|
-
*
|
|
466
|
-
* If you cannot prevent passing `undefined`, then an additional extension can be added to the endpoint file name to generate the file with a different name. For example, renaming `pages/api/[slug].ts` to `pages/api/[slug].json.ts`.
|
|
467
|
-
*/
|
|
468
|
-
PrerenderDynamicEndpointPathCollide: {
|
|
469
|
-
title: "Prerendered dynamic endpoint has path collision.",
|
|
470
|
-
message: (pathname) => `Could not render \`${pathname}\` with an \`undefined\` param as the generated path will collide during prerendering. Prevent passing \`undefined\` as \`params\` for the endpoint's \`getStaticPaths()\` function, or add an additional extension to the endpoint's filename.`,
|
|
471
|
-
hint: (filename) => `Rename \`${filename}\` to \`${filename.replace(/\.(js|ts)/, (m) => `.json` + m)}\``
|
|
472
|
-
},
|
|
473
|
-
/**
|
|
474
|
-
* @docs
|
|
475
|
-
* @see
|
|
476
|
-
* - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
|
|
477
|
-
* @description
|
|
478
|
-
* An image's `src` property is not valid. The Image component requires the `src` attribute to be either an image that has been ESM imported or a string. This is also true for the first parameter of `getImage()`.
|
|
479
|
-
*
|
|
480
|
-
* ```astro
|
|
481
|
-
* ---
|
|
482
|
-
* import { Image } from "astro:assets";
|
|
483
|
-
* import myImage from "../assets/my_image.png";
|
|
484
|
-
* ---
|
|
485
|
-
*
|
|
486
|
-
* <Image src={myImage} alt="..." />
|
|
487
|
-
* <Image src="https://example.com/logo.png" width={300} height={300} alt="..." />
|
|
488
|
-
* ```
|
|
489
|
-
*
|
|
490
|
-
* In most cases, this error happens when the value passed to `src` is undefined.
|
|
491
|
-
*/
|
|
492
|
-
ExpectedImage: {
|
|
493
|
-
title: "Expected src to be an image.",
|
|
494
|
-
message: (options) => `Expected \`src\` property to be either an ESM imported image or a string with the path of a remote image. Received \`${options}\`.`,
|
|
495
|
-
hint: "This error can often happen because of a wrong path. Make sure the path to your image is correct."
|
|
496
|
-
},
|
|
497
|
-
/**
|
|
498
|
-
* @docs
|
|
499
|
-
* @see
|
|
500
|
-
* - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
|
|
501
|
-
* @description
|
|
502
|
-
* `getImage()`'s first parameter should be an object with the different properties to apply to your image.
|
|
503
|
-
*
|
|
504
|
-
* ```ts
|
|
505
|
-
* import { getImage } from "astro:assets";
|
|
506
|
-
* import myImage from "../assets/my_image.png";
|
|
507
|
-
*
|
|
508
|
-
* const optimizedImage = await getImage({src: myImage, width: 300, height: 300});
|
|
509
|
-
* ```
|
|
510
|
-
*
|
|
511
|
-
* In most cases, this error happens because parameters were passed directly instead of inside an object.
|
|
512
|
-
*/
|
|
513
|
-
ExpectedImageOptions: {
|
|
514
|
-
title: "Expected image options.",
|
|
515
|
-
message: (options) => `Expected getImage() parameter to be an object. Received \`${options}\`.`
|
|
516
|
-
},
|
|
517
|
-
/**
|
|
518
|
-
* @docs
|
|
519
|
-
* @message
|
|
520
|
-
* Could not find requested image `IMAGE_PATH` at `FULL_IMAGE_PATH`.
|
|
521
|
-
* @see
|
|
522
|
-
* - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
|
|
523
|
-
* @description
|
|
524
|
-
* Astro could not find an image you included in your Markdown content. Usually, this is simply caused by a typo in the path.
|
|
525
|
-
*
|
|
526
|
-
* Images in Markdown are relative to the current file. To refer to an image that is located in the same folder as the `.md` file, the path should start with `./`
|
|
527
|
-
*/
|
|
528
|
-
MarkdownImageNotFound: {
|
|
529
|
-
title: "Image not found.",
|
|
530
|
-
message: (imagePath, fullImagePath) => `Could not find requested image \`${imagePath}\`${fullImagePath ? ` at \`${fullImagePath}\`.` : "."}`,
|
|
531
|
-
hint: "This is often caused by a typo in the image path. Please make sure the file exists, and is spelled correctly."
|
|
532
|
-
},
|
|
533
|
-
/**
|
|
534
|
-
* @docs
|
|
535
|
-
* @description
|
|
536
|
-
* Making changes to the response, such as setting headers, cookies, and the status code cannot be done outside of page components.
|
|
537
|
-
*/
|
|
538
|
-
ResponseSentError: {
|
|
539
|
-
title: "Unable to set response.",
|
|
540
|
-
message: "The response has already been sent to the browser and cannot be altered."
|
|
541
|
-
},
|
|
542
|
-
/**
|
|
543
|
-
* @docs
|
|
544
|
-
* @description
|
|
545
|
-
* Thrown when the middleware does not return any data or call the `next` function.
|
|
546
|
-
*
|
|
547
|
-
* For example:
|
|
548
|
-
* ```ts
|
|
549
|
-
* import {defineMiddleware} from "astro/middleware";
|
|
550
|
-
* export const onRequest = defineMiddleware((context, _) => {
|
|
551
|
-
* // doesn't return anything or call `next`
|
|
552
|
-
* context.locals.someData = false;
|
|
553
|
-
* });
|
|
554
|
-
* ```
|
|
555
|
-
*/
|
|
556
|
-
MiddlewareNoDataOrNextCalled: {
|
|
557
|
-
title: "The middleware didn't return a response or call `next`.",
|
|
558
|
-
message: "The middleware needs to either return a `Response` object or call the `next` function."
|
|
559
|
-
},
|
|
560
|
-
/**
|
|
561
|
-
* @docs
|
|
562
|
-
* @description
|
|
563
|
-
* Thrown in development mode when middleware returns something that is not a `Response` object.
|
|
564
|
-
*
|
|
565
|
-
* For example:
|
|
566
|
-
* ```ts
|
|
567
|
-
* import {defineMiddleware} from "astro/middleware";
|
|
568
|
-
* export const onRequest = defineMiddleware(() => {
|
|
569
|
-
* return "string"
|
|
570
|
-
* });
|
|
571
|
-
* ```
|
|
572
|
-
*/
|
|
573
|
-
MiddlewareNotAResponse: {
|
|
574
|
-
title: "The middleware returned something that is not a `Response` object.",
|
|
575
|
-
message: "Any data returned from middleware must be a valid `Response` object."
|
|
576
|
-
},
|
|
577
|
-
/**
|
|
578
|
-
* @docs
|
|
579
|
-
* @description
|
|
580
|
-
*
|
|
581
|
-
* Thrown in development mode when `locals` is overwritten with something that is not an object
|
|
582
|
-
*
|
|
583
|
-
* For example:
|
|
584
|
-
* ```ts
|
|
585
|
-
* import {defineMiddleware} from "astro/middleware";
|
|
586
|
-
* export const onRequest = defineMiddleware((context, next) => {
|
|
587
|
-
* context.locals = 1541;
|
|
588
|
-
* return next();
|
|
589
|
-
* });
|
|
590
|
-
* ```
|
|
591
|
-
*/
|
|
592
|
-
LocalsNotAnObject: {
|
|
593
|
-
title: "Value assigned to `locals` is not accepted.",
|
|
594
|
-
message: "`locals` can only be assigned to an object. Other values like numbers, strings, etc. are not accepted.",
|
|
595
|
-
hint: "If you tried to remove some information from the `locals` object, try to use `delete` or set the property to `undefined`."
|
|
596
|
-
},
|
|
597
|
-
/**
|
|
598
|
-
* @docs
|
|
599
|
-
* @see
|
|
600
|
-
* - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
|
|
601
|
-
* @description
|
|
602
|
-
* When using the default image services, `Image`'s and `getImage`'s `src` parameter must be either an imported image or an URL, it cannot be a filepath.
|
|
603
|
-
*
|
|
604
|
-
* ```astro
|
|
605
|
-
* ---
|
|
606
|
-
* import { Image } from "astro:assets";
|
|
607
|
-
* import myImage from "../my_image.png";
|
|
608
|
-
* ---
|
|
609
|
-
*
|
|
610
|
-
* <!-- GOOD: `src` is the full imported image. -->
|
|
611
|
-
* <Image src={myImage} alt="Cool image" />
|
|
612
|
-
*
|
|
613
|
-
* <!-- BAD: `src` is an image's `src` path instead of the full image. -->
|
|
614
|
-
* <Image src={myImage.src} alt="Cool image" />
|
|
615
|
-
* ```
|
|
616
|
-
*/
|
|
617
|
-
LocalImageUsedWrongly: {
|
|
618
|
-
title: "ESM imported images must be passed as-is.",
|
|
619
|
-
message: (imageFilePath) => `\`Image\`'s and \`getImage\`'s \`src\` parameter must be an imported image or an URL, it cannot be a filepath. Received \`${imageFilePath}\`.`
|
|
620
|
-
},
|
|
621
|
-
/**
|
|
622
|
-
* @docs
|
|
623
|
-
* @see
|
|
624
|
-
* - [Astro.glob](https://docs.astro.build/en/reference/api-reference/#astroglob)
|
|
625
|
-
* @description
|
|
626
|
-
* `Astro.glob()` can only be used in `.astro` files. You can use [`import.meta.glob()`](https://vitejs.dev/guide/features.html#glob-import) instead to acheive the same result.
|
|
627
|
-
*/
|
|
628
|
-
AstroGlobUsedOutside: {
|
|
629
|
-
title: "Astro.glob() used outside of an Astro file.",
|
|
630
|
-
message: (globStr) => `\`Astro.glob(${globStr})\` can only be used in \`.astro\` files. \`import.meta.glob(${globStr})\` can be used instead to achieve a similar result.`,
|
|
631
|
-
hint: "See Vite's documentation on `import.meta.glob` for more information: https://vitejs.dev/guide/features.html#glob-import"
|
|
632
|
-
},
|
|
633
|
-
/**
|
|
634
|
-
* @docs
|
|
635
|
-
* @see
|
|
636
|
-
* - [Astro.glob](https://docs.astro.build/en/reference/api-reference/#astroglob)
|
|
637
|
-
* @description
|
|
638
|
-
* `Astro.glob()` did not return any matching files. There might be a typo in the glob pattern.
|
|
639
|
-
*/
|
|
640
|
-
AstroGlobNoMatch: {
|
|
641
|
-
title: "Astro.glob() did not match any files.",
|
|
642
|
-
message: (globStr) => `\`Astro.glob(${globStr})\` did not return any matching files. Check the pattern for typos.`
|
|
643
|
-
},
|
|
644
|
-
/**
|
|
645
|
-
* @docs
|
|
646
|
-
* @see
|
|
647
|
-
* - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#astroredirect)
|
|
648
|
-
* @description
|
|
649
|
-
* A redirect must be given a location with the `Location` header.
|
|
650
|
-
*/
|
|
651
|
-
RedirectWithNoLocation: {
|
|
652
|
-
title: "A redirect must be given a location with the `Location` header."
|
|
653
|
-
},
|
|
654
|
-
/**
|
|
655
|
-
* @docs
|
|
656
|
-
* @see
|
|
657
|
-
* - [Dynamic routes](https://docs.astro.build/en/core-concepts/routing/#dynamic-routes)
|
|
658
|
-
* @description
|
|
659
|
-
* A dynamic route param is invalid. This is often caused by an `undefined` parameter or a missing [rest parameter](https://docs.astro.build/en/core-concepts/routing/#rest-parameters).
|
|
660
|
-
*/
|
|
661
|
-
InvalidDynamicRoute: {
|
|
662
|
-
title: "Invalid dynamic route.",
|
|
663
|
-
message: (route, invalidParam, received) => `The ${invalidParam} param for route ${route} is invalid. Received **${received}**.`
|
|
664
|
-
},
|
|
665
|
-
// No headings here, that way Vite errors are merged with Astro ones in the docs, which makes more sense to users.
|
|
666
|
-
// Vite Errors - 4xxx
|
|
667
|
-
/**
|
|
668
|
-
* @docs
|
|
669
|
-
* @see
|
|
670
|
-
* - [Vite troubleshooting guide](https://vitejs.dev/guide/troubleshooting.html)
|
|
671
|
-
* @description
|
|
672
|
-
* Vite encountered an unknown error while rendering your project. We unfortunately do not know what happened (or we would tell you!)
|
|
673
|
-
*
|
|
674
|
-
* If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
|
|
675
|
-
*/
|
|
676
|
-
UnknownViteError: {
|
|
677
|
-
title: "Unknown Vite Error."
|
|
678
|
-
},
|
|
679
|
-
/**
|
|
680
|
-
* @docs
|
|
681
|
-
* @see
|
|
682
|
-
* - [Type Imports](https://docs.astro.build/en/guides/typescript/#type-imports)
|
|
683
|
-
* @description
|
|
684
|
-
* Astro could not import the requested file. Oftentimes, this is caused by the import path being wrong (either because the file does not exist, or there is a typo in the path)
|
|
685
|
-
*
|
|
686
|
-
* This message can also appear when a type is imported without specifying that it is a [type import](https://docs.astro.build/en/guides/typescript/#type-imports).
|
|
687
|
-
*/
|
|
688
|
-
FailedToLoadModuleSSR: {
|
|
689
|
-
title: "Could not import file.",
|
|
690
|
-
message: (importName) => `Could not import \`${importName}\`.`,
|
|
691
|
-
hint: "This is often caused by a typo in the import path. Please make sure the file exists."
|
|
692
|
-
},
|
|
693
|
-
/**
|
|
694
|
-
* @docs
|
|
695
|
-
* @see
|
|
696
|
-
* - [Glob Patterns](https://docs.astro.build/en/guides/imports/#glob-patterns)
|
|
697
|
-
* @description
|
|
698
|
-
* Astro encountered an invalid glob pattern. This is often caused by the glob pattern not being a valid file path.
|
|
699
|
-
*/
|
|
700
|
-
InvalidGlob: {
|
|
701
|
-
title: "Invalid glob pattern.",
|
|
702
|
-
message: (globPattern) => `Invalid glob pattern: \`${globPattern}\`. Glob patterns must start with './', '../' or '/'.`,
|
|
703
|
-
hint: "See https://docs.astro.build/en/guides/imports/#glob-patterns for more information on supported glob patterns."
|
|
704
|
-
},
|
|
705
|
-
/**
|
|
706
|
-
* @docs
|
|
707
|
-
* @description
|
|
708
|
-
* Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error.
|
|
709
|
-
*/
|
|
710
|
-
FailedToFindPageMapSSR: {
|
|
711
|
-
title: "Astro couldn't find the correct page to render",
|
|
712
|
-
message: "Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error. Please file an issue."
|
|
713
|
-
},
|
|
714
|
-
/**
|
|
715
|
-
* @docs
|
|
716
|
-
* @kind heading
|
|
717
|
-
* @name CSS Errors
|
|
718
|
-
*/
|
|
719
|
-
// CSS Errors - 5xxx
|
|
720
|
-
/**
|
|
721
|
-
* @docs
|
|
722
|
-
* @see
|
|
723
|
-
* - [Styles and CSS](https://docs.astro.build/en/guides/styling/)
|
|
724
|
-
* @description
|
|
725
|
-
* Astro encountered an unknown error while parsing your CSS. Oftentimes, this is caused by a syntax error and the error message should contain more information.
|
|
726
|
-
*/
|
|
727
|
-
UnknownCSSError: {
|
|
728
|
-
title: "Unknown CSS Error."
|
|
729
|
-
},
|
|
730
|
-
/**
|
|
731
|
-
* @docs
|
|
732
|
-
* @message
|
|
733
|
-
* **Example error messages:**<br/>
|
|
734
|
-
* CSSSyntaxError: Missed semicolon<br/>
|
|
735
|
-
* CSSSyntaxError: Unclosed string<br/>
|
|
736
|
-
* @description
|
|
737
|
-
* Astro encountered an error while parsing your CSS, due to a syntax error. This is often caused by a missing semicolon.
|
|
738
|
-
*/
|
|
739
|
-
CSSSyntaxError: {
|
|
740
|
-
title: "CSS Syntax Error."
|
|
137
|
+
return msg;
|
|
741
138
|
},
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
139
|
+
hint: "Mutable values declared at runtime are not supported. Please make sure to use exactly `export const prerender = true`."
|
|
140
|
+
};
|
|
141
|
+
const InvalidComponentArgs = {
|
|
142
|
+
name: "InvalidComponentArgs",
|
|
143
|
+
title: "Invalid component arguments.",
|
|
144
|
+
message: (name) => `Invalid arguments passed to${name ? ` <${name}>` : ""} component.`,
|
|
145
|
+
hint: "Astro components cannot be rendered directly via function call, such as `Component()` or `{items.map(Component)}`."
|
|
146
|
+
};
|
|
147
|
+
const PageNumberParamNotFound = {
|
|
148
|
+
name: "PageNumberParamNotFound",
|
|
149
|
+
title: "Page number param not found.",
|
|
150
|
+
message: (paramName) => `[paginate()] page number param \`${paramName}\` not found in your filepath.`,
|
|
151
|
+
hint: "Rename your file to `[page].astro` or `[...page].astro`."
|
|
152
|
+
};
|
|
153
|
+
const ImageMissingAlt = {
|
|
154
|
+
name: "ImageMissingAlt",
|
|
155
|
+
title: "Missing alt property.",
|
|
156
|
+
message: "The alt property is required.",
|
|
157
|
+
hint: "The `alt` property is important for the purpose of accessibility, without it users using screen readers or other assistive technologies won't be able to understand what your image is supposed to represent. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-alt for more information."
|
|
158
|
+
};
|
|
159
|
+
const InvalidImageService = {
|
|
160
|
+
name: "InvalidImageService",
|
|
161
|
+
title: "Error while loading image service.",
|
|
162
|
+
message: "There was an error loading the configured image service. Please see the stack trace for more information."
|
|
163
|
+
};
|
|
164
|
+
const MissingImageDimension = {
|
|
165
|
+
name: "MissingImageDimension",
|
|
166
|
+
title: "Missing image dimensions",
|
|
167
|
+
message: (missingDimension, imageURL) => `Missing ${missingDimension === "both" ? "width and height attributes" : `${missingDimension} attribute`} for ${imageURL}. When using remote images, both dimensions are always required in order to avoid CLS.`,
|
|
168
|
+
hint: "If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets)."
|
|
169
|
+
};
|
|
170
|
+
const UnsupportedImageFormat = {
|
|
171
|
+
name: "UnsupportedImageFormat",
|
|
172
|
+
title: "Unsupported image format",
|
|
173
|
+
message: (format, imagePath, supportedFormats) => `Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join(
|
|
174
|
+
", "
|
|
175
|
+
)} are supported by our image services.`,
|
|
176
|
+
hint: "Using an `img` tag directly instead of the `Image` component might be what you're looking for."
|
|
177
|
+
};
|
|
178
|
+
const PrerenderDynamicEndpointPathCollide = {
|
|
179
|
+
name: "PrerenderDynamicEndpointPathCollide",
|
|
180
|
+
title: "Prerendered dynamic endpoint has path collision.",
|
|
181
|
+
message: (pathname) => `Could not render \`${pathname}\` with an \`undefined\` param as the generated path will collide during prerendering. Prevent passing \`undefined\` as \`params\` for the endpoint's \`getStaticPaths()\` function, or add an additional extension to the endpoint's filename.`,
|
|
182
|
+
hint: (filename) => `Rename \`${filename}\` to \`${filename.replace(/\.(js|ts)/, (m) => `.json` + m)}\``
|
|
183
|
+
};
|
|
184
|
+
const ExpectedImage = {
|
|
185
|
+
name: "ExpectedImage",
|
|
186
|
+
title: "Expected src to be an image.",
|
|
187
|
+
message: (options) => `Expected \`src\` property to be either an ESM imported image or a string with the path of a remote image. Received \`${options}\`.`,
|
|
188
|
+
hint: "This error can often happen because of a wrong path. Make sure the path to your image is correct."
|
|
189
|
+
};
|
|
190
|
+
const ExpectedImageOptions = {
|
|
191
|
+
name: "ExpectedImageOptions",
|
|
192
|
+
title: "Expected image options.",
|
|
193
|
+
message: (options) => `Expected getImage() parameter to be an object. Received \`${options}\`.`
|
|
194
|
+
};
|
|
195
|
+
const MarkdownImageNotFound = {
|
|
196
|
+
name: "MarkdownImageNotFound",
|
|
197
|
+
title: "Image not found.",
|
|
198
|
+
message: (imagePath, fullImagePath) => `Could not find requested image \`${imagePath}\`${fullImagePath ? ` at \`${fullImagePath}\`.` : "."}`,
|
|
199
|
+
hint: "This is often caused by a typo in the image path. Please make sure the file exists, and is spelled correctly."
|
|
200
|
+
};
|
|
201
|
+
const ResponseSentError = {
|
|
202
|
+
name: "ResponseSentError",
|
|
203
|
+
title: "Unable to set response.",
|
|
204
|
+
message: "The response has already been sent to the browser and cannot be altered."
|
|
205
|
+
};
|
|
206
|
+
const MiddlewareNoDataOrNextCalled = {
|
|
207
|
+
name: "MiddlewareNoDataOrNextCalled",
|
|
208
|
+
title: "The middleware didn't return a response or call `next`.",
|
|
209
|
+
message: "The middleware needs to either return a `Response` object or call the `next` function."
|
|
210
|
+
};
|
|
211
|
+
const MiddlewareNotAResponse = {
|
|
212
|
+
name: "MiddlewareNotAResponse",
|
|
213
|
+
title: "The middleware returned something that is not a `Response` object.",
|
|
214
|
+
message: "Any data returned from middleware must be a valid `Response` object."
|
|
215
|
+
};
|
|
216
|
+
const LocalsNotAnObject = {
|
|
217
|
+
name: "LocalsNotAnObject",
|
|
218
|
+
title: "Value assigned to `locals` is not accepted.",
|
|
219
|
+
message: "`locals` can only be assigned to an object. Other values like numbers, strings, etc. are not accepted.",
|
|
220
|
+
hint: "If you tried to remove some information from the `locals` object, try to use `delete` or set the property to `undefined`."
|
|
221
|
+
};
|
|
222
|
+
const LocalImageUsedWrongly = {
|
|
223
|
+
name: "LocalImageUsedWrongly",
|
|
224
|
+
title: "ESM imported images must be passed as-is.",
|
|
225
|
+
message: (imageFilePath) => `\`Image\`'s and \`getImage\`'s \`src\` parameter must be an imported image or an URL, it cannot be a filepath. Received \`${imageFilePath}\`.`
|
|
226
|
+
};
|
|
227
|
+
const AstroGlobUsedOutside = {
|
|
228
|
+
name: "AstroGlobUsedOutside",
|
|
229
|
+
title: "Astro.glob() used outside of an Astro file.",
|
|
230
|
+
message: (globStr) => `\`Astro.glob(${globStr})\` can only be used in \`.astro\` files. \`import.meta.glob(${globStr})\` can be used instead to achieve a similar result.`,
|
|
231
|
+
hint: "See Vite's documentation on `import.meta.glob` for more information: https://vitejs.dev/guide/features.html#glob-import"
|
|
232
|
+
};
|
|
233
|
+
const AstroGlobNoMatch = {
|
|
234
|
+
name: "AstroGlobNoMatch",
|
|
235
|
+
title: "Astro.glob() did not match any files.",
|
|
236
|
+
message: (globStr) => `\`Astro.glob(${globStr})\` did not return any matching files. Check the pattern for typos.`
|
|
237
|
+
};
|
|
238
|
+
const RedirectWithNoLocation = {
|
|
239
|
+
name: "RedirectWithNoLocation",
|
|
240
|
+
title: "A redirect must be given a location with the `Location` header."
|
|
241
|
+
};
|
|
242
|
+
const InvalidDynamicRoute = {
|
|
243
|
+
name: "InvalidDynamicRoute",
|
|
244
|
+
title: "Invalid dynamic route.",
|
|
245
|
+
message: (route, invalidParam, received) => `The ${invalidParam} param for route ${route} is invalid. Received **${received}**.`
|
|
246
|
+
};
|
|
247
|
+
const UnknownViteError = {
|
|
248
|
+
name: "UnknownViteError",
|
|
249
|
+
title: "Unknown Vite Error."
|
|
250
|
+
};
|
|
251
|
+
const FailedToLoadModuleSSR = {
|
|
252
|
+
name: "FailedToLoadModuleSSR",
|
|
253
|
+
title: "Could not import file.",
|
|
254
|
+
message: (importName) => `Could not import \`${importName}\`.`,
|
|
255
|
+
hint: "This is often caused by a typo in the import path. Please make sure the file exists."
|
|
256
|
+
};
|
|
257
|
+
const InvalidGlob = {
|
|
258
|
+
name: "InvalidGlob",
|
|
259
|
+
title: "Invalid glob pattern.",
|
|
260
|
+
message: (globPattern) => `Invalid glob pattern: \`${globPattern}\`. Glob patterns must start with './', '../' or '/'.`,
|
|
261
|
+
hint: "See https://docs.astro.build/en/guides/imports/#glob-patterns for more information on supported glob patterns."
|
|
262
|
+
};
|
|
263
|
+
const FailedToFindPageMapSSR = {
|
|
264
|
+
name: "FailedToFindPageMapSSR",
|
|
265
|
+
title: "Astro couldn't find the correct page to render",
|
|
266
|
+
message: "Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error. Please file an issue."
|
|
267
|
+
};
|
|
268
|
+
const UnknownCSSError = {
|
|
269
|
+
name: "UnknownCSSError",
|
|
270
|
+
title: "Unknown CSS Error."
|
|
271
|
+
};
|
|
272
|
+
const CSSSyntaxError = {
|
|
273
|
+
name: "CSSSyntaxError",
|
|
274
|
+
title: "CSS Syntax Error."
|
|
275
|
+
};
|
|
276
|
+
const UnknownMarkdownError = {
|
|
277
|
+
name: "UnknownMarkdownError",
|
|
278
|
+
title: "Unknown Markdown Error."
|
|
279
|
+
};
|
|
280
|
+
const MarkdownFrontmatterParseError = {
|
|
281
|
+
name: "MarkdownFrontmatterParseError",
|
|
282
|
+
title: "Failed to parse Markdown frontmatter."
|
|
283
|
+
};
|
|
284
|
+
const InvalidFrontmatterInjectionError = {
|
|
285
|
+
name: "InvalidFrontmatterInjectionError",
|
|
286
|
+
title: "Invalid frontmatter injection.",
|
|
287
|
+
message: 'A remark or rehype plugin attempted to inject invalid frontmatter. Ensure "astro.frontmatter" is set to a valid JSON object that is not `null` or `undefined`.',
|
|
288
|
+
hint: "See the frontmatter injection docs https://docs.astro.build/en/guides/markdown-content/#modifying-frontmatter-programmatically for more information."
|
|
289
|
+
};
|
|
290
|
+
const MdxIntegrationMissingError = {
|
|
291
|
+
name: "MdxIntegrationMissingError",
|
|
292
|
+
title: "MDX integration missing.",
|
|
293
|
+
message: (file) => `Unable to render ${file}. Ensure that the \`@astrojs/mdx\` integration is installed.`,
|
|
294
|
+
hint: "See the MDX integration docs for installation and usage instructions: https://docs.astro.build/en/guides/integrations-guide/mdx/"
|
|
295
|
+
};
|
|
296
|
+
const UnknownConfigError = {
|
|
297
|
+
name: "UnknownConfigError",
|
|
298
|
+
title: "Unknown configuration error."
|
|
299
|
+
};
|
|
300
|
+
const ConfigNotFound = {
|
|
301
|
+
name: "ConfigNotFound",
|
|
302
|
+
title: "Specified configuration file not found.",
|
|
303
|
+
message: (configFile) => `Unable to resolve \`--config "${configFile}"\`. Does the file exist?`
|
|
304
|
+
};
|
|
305
|
+
const ConfigLegacyKey = {
|
|
306
|
+
name: "ConfigLegacyKey",
|
|
307
|
+
title: "Legacy configuration detected.",
|
|
308
|
+
message: (legacyConfigKey) => `Legacy configuration detected: \`${legacyConfigKey}\`.`,
|
|
309
|
+
hint: "Please update your configuration to the new format.\nSee https://astro.build/config for more information."
|
|
310
|
+
};
|
|
311
|
+
const UnknownCLIError = {
|
|
312
|
+
name: "UnknownCLIError",
|
|
313
|
+
title: "Unknown CLI Error."
|
|
314
|
+
};
|
|
315
|
+
const GenerateContentTypesError = {
|
|
316
|
+
name: "GenerateContentTypesError",
|
|
317
|
+
title: "Failed to generate content types.",
|
|
318
|
+
message: (errorMessage) => `\`astro sync\` command failed to generate content collection types: ${errorMessage}`,
|
|
319
|
+
hint: "Check your `src/content/config.*` file for typos."
|
|
320
|
+
};
|
|
321
|
+
const UnknownContentCollectionError = {
|
|
322
|
+
name: "UnknownContentCollectionError",
|
|
323
|
+
title: "Unknown Content Collection Error."
|
|
324
|
+
};
|
|
325
|
+
const InvalidContentEntryFrontmatterError = {
|
|
326
|
+
name: "InvalidContentEntryFrontmatterError",
|
|
327
|
+
title: "Content entry frontmatter does not match schema.",
|
|
328
|
+
message: (collection, entryId, error) => {
|
|
329
|
+
return [
|
|
330
|
+
`**${String(collection)} \u2192 ${String(
|
|
913
331
|
entryId
|
|
914
|
-
)}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
},
|
|
918
|
-
/**
|
|
919
|
-
* @docs
|
|
920
|
-
* @see
|
|
921
|
-
* - [The reserved entry `slug` field](https://docs.astro.build/en/guides/content-collections/#defining-custom-slugs)
|
|
922
|
-
* @description
|
|
923
|
-
* A content collection schema should not contain the `slug` field. This is reserved by Astro for generating entry slugs. Remove `slug` from your schema. You can still use custom slugs in your frontmatter.
|
|
924
|
-
*/
|
|
925
|
-
ContentSchemaContainsSlugError: {
|
|
926
|
-
title: "Content Schema should not contain `slug`.",
|
|
927
|
-
message: (collectionName) => `A content collection schema should not contain \`slug\` since it is reserved for slug generation. Remove this from your ${collectionName} collection schema.`,
|
|
928
|
-
hint: "See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field."
|
|
332
|
+
)}** frontmatter does not match collection schema.`,
|
|
333
|
+
...error.errors.map((zodError) => zodError.message)
|
|
334
|
+
].join("\n");
|
|
929
335
|
},
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
* @see
|
|
960
|
-
* - [Defining content collections](https://docs.astro.build/en/guides/content-collections/#defining-collections)
|
|
961
|
-
* @description
|
|
962
|
-
* Content collections must contain entries of the type configured. Collections are `type: 'content'` by default. Try adding `type: 'data'` to your collection config for data collections.
|
|
963
|
-
*/
|
|
964
|
-
ContentCollectionTypeMismatchError: {
|
|
965
|
-
title: "Collection contains entries of a different type.",
|
|
966
|
-
message: (collection, expectedType, actualType) => {
|
|
967
|
-
return `${collection} contains ${expectedType} entries, but is configured as a ${actualType} collection.`;
|
|
968
|
-
}
|
|
969
|
-
},
|
|
970
|
-
/**
|
|
971
|
-
* @docs
|
|
972
|
-
* @message `COLLECTION_ENTRY_NAME` failed to parse.
|
|
973
|
-
* @description
|
|
974
|
-
* Collection entries of `type: 'data'` must return an object with valid JSON (for `.json` entries) or YAML (for `.yaml` entries).
|
|
975
|
-
*/
|
|
976
|
-
DataCollectionEntryParseError: {
|
|
977
|
-
title: "Data collection entry failed to parse.",
|
|
978
|
-
message: (entryId, errorMessage) => {
|
|
979
|
-
return `**${entryId}** failed to parse: ${errorMessage}`;
|
|
980
|
-
},
|
|
981
|
-
hint: "Ensure your data entry is an object with valid JSON (for `.json` entries) or YAML (for `.yaml` entries)."
|
|
982
|
-
},
|
|
983
|
-
/**
|
|
984
|
-
* @docs
|
|
985
|
-
* @message `COLLECTION_NAME` contains multiple entries with the same slug: `SLUG`. Slugs must be unique.
|
|
986
|
-
* @description
|
|
987
|
-
* Content collection entries must have unique slugs. Duplicates are often caused by the `slug` frontmatter property.
|
|
988
|
-
*/
|
|
989
|
-
DuplicateContentEntrySlugError: {
|
|
990
|
-
title: "Duplicate content entry slug.",
|
|
991
|
-
message: (collection, slug) => {
|
|
992
|
-
return `**${collection}** contains multiple entries with the same slug: \`${slug}\`. Slugs must be unique.`;
|
|
993
|
-
}
|
|
336
|
+
hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas."
|
|
337
|
+
};
|
|
338
|
+
const InvalidContentEntrySlugError = {
|
|
339
|
+
name: "InvalidContentEntrySlugError",
|
|
340
|
+
title: "Invalid content entry slug.",
|
|
341
|
+
message: (collection, entryId) => {
|
|
342
|
+
return `${String(collection)} \u2192 ${String(
|
|
343
|
+
entryId
|
|
344
|
+
)} has an invalid slug. \`slug\` must be a string.`;
|
|
345
|
+
},
|
|
346
|
+
hint: "See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field."
|
|
347
|
+
};
|
|
348
|
+
const ContentSchemaContainsSlugError = {
|
|
349
|
+
name: "ContentSchemaContainsSlugError",
|
|
350
|
+
title: "Content Schema should not contain `slug`.",
|
|
351
|
+
message: (collectionName) => `A content collection schema should not contain \`slug\` since it is reserved for slug generation. Remove this from your ${collectionName} collection schema.`,
|
|
352
|
+
hint: "See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field."
|
|
353
|
+
};
|
|
354
|
+
const CollectionDoesNotExistError = {
|
|
355
|
+
name: "CollectionDoesNotExistError",
|
|
356
|
+
title: "Collection does not exist",
|
|
357
|
+
message: (collectionName) => `The collection **${collectionName}** does not exist. Ensure a collection directory with this name exists.`,
|
|
358
|
+
hint: "See https://docs.astro.build/en/guides/content-collections/ for more on creating collections."
|
|
359
|
+
};
|
|
360
|
+
const MixedContentDataCollectionError = {
|
|
361
|
+
name: "MixedContentDataCollectionError",
|
|
362
|
+
title: "Content and data cannot be in same collection.",
|
|
363
|
+
message: (collection) => {
|
|
364
|
+
return `**${collection}** contains a mix of content and data entries. All entries must be of the same type.`;
|
|
994
365
|
},
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
366
|
+
hint: "Store data entries in a new collection separate from your content collection."
|
|
367
|
+
};
|
|
368
|
+
const ContentCollectionTypeMismatchError = {
|
|
369
|
+
name: "ContentCollectionTypeMismatchError",
|
|
370
|
+
title: "Collection contains entries of a different type.",
|
|
371
|
+
message: (collection, expectedType, actualType) => {
|
|
372
|
+
return `${collection} contains ${expectedType} entries, but is configured as a ${actualType} collection.`;
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
const DataCollectionEntryParseError = {
|
|
376
|
+
name: "DataCollectionEntryParseError",
|
|
377
|
+
title: "Data collection entry failed to parse.",
|
|
378
|
+
message: (entryId, errorMessage) => {
|
|
379
|
+
return `**${entryId}** failed to parse: ${errorMessage}`;
|
|
1007
380
|
},
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
381
|
+
hint: "Ensure your data entry is an object with valid JSON (for `.json` entries) or YAML (for `.yaml` entries)."
|
|
382
|
+
};
|
|
383
|
+
const DuplicateContentEntrySlugError = {
|
|
384
|
+
name: "DuplicateContentEntrySlugError",
|
|
385
|
+
title: "Duplicate content entry slug.",
|
|
386
|
+
message: (collection, slug) => {
|
|
387
|
+
return `**${collection}** contains multiple entries with the same slug: \`${slug}\`. Slugs must be unique.`;
|
|
1011
388
|
}
|
|
1012
389
|
};
|
|
390
|
+
const UnsupportedConfigTransformError = {
|
|
391
|
+
name: "UnsupportedConfigTransformError",
|
|
392
|
+
title: "Unsupported transform in content config.",
|
|
393
|
+
message: (parseError) => `\`transform()\` functions in your content config must return valid JSON, or data types compatible with the devalue library (including Dates, Maps, and Sets).
|
|
394
|
+
Full error: ${parseError}`,
|
|
395
|
+
hint: "See the devalue library for all supported types: https://github.com/rich-harris/devalue"
|
|
396
|
+
};
|
|
397
|
+
const UnknownError = { name: "UnknownError", title: "Unknown Error." };
|
|
1013
398
|
export {
|
|
1014
|
-
|
|
399
|
+
AstroGlobNoMatch,
|
|
400
|
+
AstroGlobUsedOutside,
|
|
401
|
+
CSSSyntaxError,
|
|
402
|
+
ClientAddressNotAvailable,
|
|
403
|
+
CollectionDoesNotExistError,
|
|
404
|
+
ConfigLegacyKey,
|
|
405
|
+
ConfigNotFound,
|
|
406
|
+
ContentCollectionTypeMismatchError,
|
|
407
|
+
ContentSchemaContainsSlugError,
|
|
408
|
+
DataCollectionEntryParseError,
|
|
409
|
+
DuplicateContentEntrySlugError,
|
|
410
|
+
ExpectedImage,
|
|
411
|
+
ExpectedImageOptions,
|
|
412
|
+
FailedToFindPageMapSSR,
|
|
413
|
+
FailedToLoadModuleSSR,
|
|
414
|
+
GenerateContentTypesError,
|
|
415
|
+
GetStaticPathsExpectedParams,
|
|
416
|
+
GetStaticPathsInvalidRouteParam,
|
|
417
|
+
GetStaticPathsRemovedRSSHelper,
|
|
418
|
+
GetStaticPathsRequired,
|
|
419
|
+
ImageMissingAlt,
|
|
420
|
+
InvalidComponentArgs,
|
|
421
|
+
InvalidContentEntryFrontmatterError,
|
|
422
|
+
InvalidContentEntrySlugError,
|
|
423
|
+
InvalidDynamicRoute,
|
|
424
|
+
InvalidFrontmatterInjectionError,
|
|
425
|
+
InvalidGetStaticPathParam,
|
|
426
|
+
InvalidGetStaticPathsEntry,
|
|
427
|
+
InvalidGetStaticPathsReturn,
|
|
428
|
+
InvalidGlob,
|
|
429
|
+
InvalidImageService,
|
|
430
|
+
InvalidPrerenderExport,
|
|
431
|
+
LocalImageUsedWrongly,
|
|
432
|
+
LocalsNotAnObject,
|
|
433
|
+
MarkdownFrontmatterParseError,
|
|
434
|
+
MarkdownImageNotFound,
|
|
435
|
+
MdxIntegrationMissingError,
|
|
436
|
+
MiddlewareNoDataOrNextCalled,
|
|
437
|
+
MiddlewareNotAResponse,
|
|
438
|
+
MissingImageDimension,
|
|
439
|
+
MissingMediaQueryDirective,
|
|
440
|
+
MixedContentDataCollectionError,
|
|
441
|
+
NoAdapterInstalled,
|
|
442
|
+
NoClientEntrypoint,
|
|
443
|
+
NoClientOnlyHint,
|
|
444
|
+
NoMatchingImport,
|
|
445
|
+
NoMatchingRenderer,
|
|
446
|
+
NoMatchingStaticPathFound,
|
|
447
|
+
OnlyResponseCanBeReturned,
|
|
448
|
+
PageNumberParamNotFound,
|
|
449
|
+
PrerenderDynamicEndpointPathCollide,
|
|
450
|
+
RedirectWithNoLocation,
|
|
451
|
+
ReservedSlotName,
|
|
452
|
+
ResponseSentError,
|
|
453
|
+
StaticClientAddressNotAvailable,
|
|
454
|
+
StaticRedirectNotAvailable,
|
|
455
|
+
UnknownCLIError,
|
|
456
|
+
UnknownCSSError,
|
|
457
|
+
UnknownCompilerError,
|
|
458
|
+
UnknownConfigError,
|
|
459
|
+
UnknownContentCollectionError,
|
|
460
|
+
UnknownError,
|
|
461
|
+
UnknownMarkdownError,
|
|
462
|
+
UnknownViteError,
|
|
463
|
+
UnsupportedConfigTransformError,
|
|
464
|
+
UnsupportedImageFormat
|
|
1015
465
|
};
|