astro 2.6.6 → 2.7.1
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/README.md +3 -6
- package/dist/@types/astro.d.ts +30 -15
- package/dist/assets/utils/emitAsset.js +1 -2
- package/dist/content/utils.d.ts +1 -2
- package/dist/content/utils.js +3 -4
- package/dist/content/vite-plugin-content-imports.js +0 -1
- package/dist/content/vite-plugin-content-virtual-mod.d.ts +1 -1
- package/dist/content/vite-plugin-content-virtual-mod.js +7 -1
- package/dist/core/add/babel.d.ts +8 -2
- package/dist/core/app/index.d.ts +3 -4
- package/dist/core/app/index.js +21 -14
- package/dist/core/app/node.d.ts +1 -1
- package/dist/core/app/node.js +9 -5
- package/dist/core/app/types.d.ts +5 -5
- package/dist/core/build/generate.js +9 -12
- package/dist/core/build/index.js +1 -8
- package/dist/core/build/internal.d.ts +3 -1
- package/dist/core/build/internal.js +5 -6
- package/dist/core/build/plugins/index.js +2 -1
- package/dist/core/build/plugins/plugin-middleware.js +15 -0
- package/dist/core/build/plugins/plugin-pages.d.ts +1 -2
- package/dist/core/build/plugins/plugin-pages.js +6 -9
- package/dist/core/build/plugins/plugin-ssr.d.ts +13 -2
- package/dist/core/build/plugins/plugin-ssr.js +220 -73
- package/dist/core/build/plugins/util.d.ts +15 -0
- package/dist/core/build/plugins/util.js +17 -1
- package/dist/core/build/static-build.d.ts +33 -0
- package/dist/core/build/static-build.js +57 -26
- package/dist/core/build/types.d.ts +5 -3
- package/dist/core/compile/compile.js +0 -5
- package/dist/core/compile/style.js +0 -1
- package/dist/core/config/schema.d.ts +12 -0
- package/dist/core/config/schema.js +6 -3
- package/dist/core/config/settings.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/endpoint/dev/index.js +1 -1
- package/dist/core/endpoint/index.d.ts +2 -2
- package/dist/core/endpoint/index.js +3 -3
- package/dist/core/errors/dev/vite.js +1 -9
- package/dist/core/errors/errors-data.d.ts +29 -70
- package/dist/core/errors/errors-data.js +20 -75
- package/dist/core/errors/errors.d.ts +1 -9
- package/dist/core/errors/errors.js +8 -9
- package/dist/core/errors/index.d.ts +1 -1
- package/dist/core/errors/utils.d.ts +2 -3
- package/dist/core/errors/utils.js +3 -3
- package/dist/core/messages.js +2 -2
- package/dist/core/module-loader/loader.d.ts +4 -0
- package/dist/core/redirects/component.js +1 -4
- package/dist/core/render/context.d.ts +1 -0
- package/dist/core/render/context.js +17 -1
- package/dist/core/render/core.d.ts +3 -3
- package/dist/core/render/core.js +3 -4
- package/dist/core/render/dev/index.js +18 -8
- package/dist/core/render/dev/vite.js +25 -19
- package/dist/core/render/ssr-element.js +3 -4
- package/dist/core/request.d.ts +2 -1
- package/dist/core/request.js +3 -2
- package/dist/core/routing/manifest/create.js +3 -4
- package/dist/core/util.d.ts +1 -0
- package/dist/core/util.js +5 -4
- package/dist/events/error.d.ts +0 -1
- package/dist/events/error.js +1 -5
- package/dist/integrations/index.d.ts +6 -7
- package/dist/integrations/index.js +8 -11
- package/dist/jsx/babel.js +3 -3
- package/dist/vite-plugin-astro/compile.js +2 -0
- package/dist/vite-plugin-astro-server/route.js +4 -1
- package/dist/vite-plugin-jsx/index.js +2 -0
- package/dist/vite-plugin-load-fallback/index.js +2 -2
- package/dist/vite-plugin-markdown/content-entry-type.d.ts +0 -5
- package/dist/vite-plugin-markdown/content-entry-type.js +1 -26
- package/dist/vite-plugin-markdown/index.js +0 -2
- package/package.json +39 -40
- package/dist/content/template/types.d.js +0 -0
- package/dist/content/template/virtual-mod.d.mts +0 -7
- /package/{src/content/template/virtual-mod.mjs → content-module.template.mjs} +0 -0
- /package/{src/content/template/types.d.ts → content-types.template.d.ts} +0 -0
|
@@ -17,7 +17,6 @@ const AstroErrorData = {
|
|
|
17
17
|
*/
|
|
18
18
|
UnknownCompilerError: {
|
|
19
19
|
title: "Unknown compiler error.",
|
|
20
|
-
code: 1e3,
|
|
21
20
|
hint: "This is almost always a problem with the Astro compiler, not your code. Please open an issue at https://astro.build/issues/compiler."
|
|
22
21
|
},
|
|
23
22
|
// 1xxx and 2xxx codes are reserved for compiler errors and warnings respectively
|
|
@@ -34,7 +33,6 @@ const AstroErrorData = {
|
|
|
34
33
|
*/
|
|
35
34
|
StaticRedirectNotAvailable: {
|
|
36
35
|
title: "`Astro.redirect` is not available in static mode.",
|
|
37
|
-
code: 3001,
|
|
38
36
|
message: "Redirects are only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
|
|
39
37
|
hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
|
|
40
38
|
},
|
|
@@ -48,7 +46,6 @@ const AstroErrorData = {
|
|
|
48
46
|
*/
|
|
49
47
|
ClientAddressNotAvailable: {
|
|
50
48
|
title: "`Astro.clientAddress` is not available in current adapter.",
|
|
51
|
-
code: 3002,
|
|
52
49
|
message: (adapterName) => `\`Astro.clientAddress\` is not available in the \`${adapterName}\` adapter. File an issue with the adapter to add support.`
|
|
53
50
|
},
|
|
54
51
|
/**
|
|
@@ -63,7 +60,6 @@ const AstroErrorData = {
|
|
|
63
60
|
*/
|
|
64
61
|
StaticClientAddressNotAvailable: {
|
|
65
62
|
title: "`Astro.clientAddress` is not available in static mode.",
|
|
66
|
-
code: 3003,
|
|
67
63
|
message: "`Astro.clientAddress` is only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
|
|
68
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."
|
|
69
65
|
},
|
|
@@ -76,7 +72,6 @@ const AstroErrorData = {
|
|
|
76
72
|
*/
|
|
77
73
|
NoMatchingStaticPathFound: {
|
|
78
74
|
title: "No static path found for requested path.",
|
|
79
|
-
code: 3004,
|
|
80
75
|
message: (pathName) => `A \`getStaticPaths()\` route pattern was matched, but no matching static path was found for requested path \`${pathName}\`.`,
|
|
81
76
|
hint: (possibleRoutes) => `Possible dynamic routes being matched: ${possibleRoutes.join(", ")}.`
|
|
82
77
|
},
|
|
@@ -102,7 +97,6 @@ const AstroErrorData = {
|
|
|
102
97
|
*/
|
|
103
98
|
OnlyResponseCanBeReturned: {
|
|
104
99
|
title: "Invalid type returned by Astro page.",
|
|
105
|
-
code: 3005,
|
|
106
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.`,
|
|
107
101
|
hint: "See https://docs.astro.build/en/guides/server-side-rendering/#response for more information."
|
|
108
102
|
},
|
|
@@ -119,7 +113,6 @@ const AstroErrorData = {
|
|
|
119
113
|
*/
|
|
120
114
|
MissingMediaQueryDirective: {
|
|
121
115
|
title: "Missing value for `client:media` directive.",
|
|
122
|
-
code: 3006,
|
|
123
116
|
message: 'Media query not provided for `client:media` directive. A media query similar to `client:media="(max-width: 600px)"` must be provided'
|
|
124
117
|
},
|
|
125
118
|
/**
|
|
@@ -135,7 +128,6 @@ const AstroErrorData = {
|
|
|
135
128
|
*/
|
|
136
129
|
NoMatchingRenderer: {
|
|
137
130
|
title: "No matching renderer found.",
|
|
138
|
-
code: 3007,
|
|
139
131
|
message: (componentName, componentExtension, plural, validRenderersCount) => `Unable to render \`${componentName}\`.
|
|
140
132
|
|
|
141
133
|
${validRenderersCount > 0 ? `There ${plural ? "are" : "is"} ${validRenderersCount} renderer${plural ? "s" : ""} configured in your \`astro.config.mjs\` file,
|
|
@@ -155,7 +147,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
155
147
|
*/
|
|
156
148
|
NoClientEntrypoint: {
|
|
157
149
|
title: "No client entrypoint specified in renderer.",
|
|
158
|
-
code: 3008,
|
|
159
150
|
message: (componentName, clientDirective, rendererName) => `\`${componentName}\` component has a \`client:${clientDirective}\` directive, but no client entrypoint was provided by \`${rendererName}\`.`,
|
|
160
151
|
hint: "See https://docs.astro.build/en/reference/integrations-reference/#addrenderer-option for more information on how to configure your renderer."
|
|
161
152
|
},
|
|
@@ -173,7 +164,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
173
164
|
*/
|
|
174
165
|
NoClientOnlyHint: {
|
|
175
166
|
title: "Missing hint on client:only directive.",
|
|
176
|
-
code: 3009,
|
|
177
167
|
message: (componentName) => `Unable to render \`${componentName}\`. When using the \`client:only\` hydration strategy, Astro needs a hint to use the correct renderer.`,
|
|
178
168
|
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`
|
|
179
169
|
},
|
|
@@ -198,7 +188,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
198
188
|
*/
|
|
199
189
|
InvalidGetStaticPathParam: {
|
|
200
190
|
title: "Invalid value returned by a `getStaticPaths` path.",
|
|
201
|
-
code: 3010,
|
|
202
191
|
message: (paramType) => `Invalid params given to \`getStaticPaths\` path. Expected an \`object\`, got \`${paramType}\``,
|
|
203
192
|
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
204
193
|
},
|
|
@@ -221,7 +210,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
221
210
|
*/
|
|
222
211
|
InvalidGetStaticPathsReturn: {
|
|
223
212
|
title: "Invalid value returned by getStaticPaths.",
|
|
224
|
-
code: 3011,
|
|
225
213
|
message: (returnType) => `Invalid type returned by \`getStaticPaths\`. Expected an \`array\`, got \`${returnType}\``,
|
|
226
214
|
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
227
215
|
},
|
|
@@ -234,7 +222,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
234
222
|
*/
|
|
235
223
|
GetStaticPathsRemovedRSSHelper: {
|
|
236
224
|
title: "getStaticPaths RSS helper is not available anymore.",
|
|
237
|
-
code: 3012,
|
|
238
225
|
message: "The RSS helper has been removed from `getStaticPaths`. Try the new @astrojs/rss package instead.",
|
|
239
226
|
hint: "See https://docs.astro.build/en/guides/rss/ for more information."
|
|
240
227
|
},
|
|
@@ -260,7 +247,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
260
247
|
*/
|
|
261
248
|
GetStaticPathsExpectedParams: {
|
|
262
249
|
title: "Missing params property on `getStaticPaths` route.",
|
|
263
|
-
code: 3013,
|
|
264
250
|
message: "Missing or empty required `params` property on `getStaticPaths` route.",
|
|
265
251
|
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
266
252
|
},
|
|
@@ -300,7 +286,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
300
286
|
*/
|
|
301
287
|
GetStaticPathsInvalidRouteParam: {
|
|
302
288
|
title: "Invalid value for `getStaticPaths` route parameter.",
|
|
303
|
-
code: 3014,
|
|
304
289
|
message: (key, value, valueType) => `Invalid getStaticPaths route parameter for \`${key}\`. Expected undefined, a string or a number, received \`${valueType}\` (\`${value}\`)`,
|
|
305
290
|
hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
|
|
306
291
|
},
|
|
@@ -315,7 +300,6 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
|
|
|
315
300
|
*/
|
|
316
301
|
GetStaticPathsRequired: {
|
|
317
302
|
title: "`getStaticPaths()` function required for dynamic routes.",
|
|
318
|
-
code: 3015,
|
|
319
303
|
message: "`getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.",
|
|
320
304
|
hint: `See https://docs.astro.build/en/core-concepts/routing/#dynamic-routes for more information on dynamic routes.
|
|
321
305
|
|
|
@@ -331,7 +315,6 @@ See https://docs.astro.build/en/guides/server-side-rendering/ for more informati
|
|
|
331
315
|
*/
|
|
332
316
|
ReservedSlotName: {
|
|
333
317
|
title: "Invalid slot name.",
|
|
334
|
-
code: 3016,
|
|
335
318
|
message: (slotName) => `Unable to create a slot named \`${slotName}\`. \`${slotName}\` is a reserved slot name. Please update the name of this slot.`
|
|
336
319
|
},
|
|
337
320
|
/**
|
|
@@ -344,7 +327,6 @@ See https://docs.astro.build/en/guides/server-side-rendering/ for more informati
|
|
|
344
327
|
*/
|
|
345
328
|
NoAdapterInstalled: {
|
|
346
329
|
title: "Cannot use Server-side Rendering without an adapter.",
|
|
347
|
-
code: 3017,
|
|
348
330
|
message: `Cannot use \`output: 'server'\` or \`output: 'hybrid'\` without an adapter. Please install and configure the appropriate server adapter for your final deployment.`,
|
|
349
331
|
hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information."
|
|
350
332
|
},
|
|
@@ -355,7 +337,6 @@ See https://docs.astro.build/en/guides/server-side-rendering/ for more informati
|
|
|
355
337
|
*/
|
|
356
338
|
NoMatchingImport: {
|
|
357
339
|
title: "No import found for component.",
|
|
358
|
-
code: 3018,
|
|
359
340
|
message: (componentName) => `Could not render \`${componentName}\`. No matching import has been found for \`${componentName}\`.`,
|
|
360
341
|
hint: "Please make sure the component is properly imported."
|
|
361
342
|
},
|
|
@@ -369,7 +350,6 @@ See https://docs.astro.build/en/guides/server-side-rendering/ for more informati
|
|
|
369
350
|
*/
|
|
370
351
|
InvalidPrerenderExport: {
|
|
371
352
|
title: "Invalid prerender export.",
|
|
372
|
-
code: 3019,
|
|
373
353
|
message: (prefix, suffix, isHydridOuput) => {
|
|
374
354
|
const defaultExpectedValue = isHydridOuput ? "false" : "true";
|
|
375
355
|
let msg = `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`;
|
|
@@ -393,7 +373,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
393
373
|
*/
|
|
394
374
|
InvalidComponentArgs: {
|
|
395
375
|
title: "Invalid component arguments.",
|
|
396
|
-
code: 3020,
|
|
397
376
|
message: (name) => `Invalid arguments passed to${name ? ` <${name}>` : ""} component.`,
|
|
398
377
|
hint: "Astro components cannot be rendered directly via function call, such as `Component()` or `{items.map(Component)}`."
|
|
399
378
|
},
|
|
@@ -406,7 +385,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
406
385
|
*/
|
|
407
386
|
PageNumberParamNotFound: {
|
|
408
387
|
title: "Page number param not found.",
|
|
409
|
-
code: 3021,
|
|
410
388
|
message: (paramName) => `[paginate()] page number param \`${paramName}\` not found in your filepath.`,
|
|
411
389
|
hint: "Rename your file to `[page].astro` or `[...page].astro`."
|
|
412
390
|
},
|
|
@@ -423,7 +401,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
423
401
|
*/
|
|
424
402
|
ImageMissingAlt: {
|
|
425
403
|
title: "Missing alt property.",
|
|
426
|
-
code: 3022,
|
|
427
404
|
message: "The alt property is required.",
|
|
428
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."
|
|
429
406
|
},
|
|
@@ -438,7 +415,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
438
415
|
*/
|
|
439
416
|
InvalidImageService: {
|
|
440
417
|
title: "Error while loading image service.",
|
|
441
|
-
code: 3023,
|
|
442
418
|
message: "There was an error loading the configured image service. Please see the stack trace for more information."
|
|
443
419
|
},
|
|
444
420
|
/**
|
|
@@ -455,7 +431,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
455
431
|
*/
|
|
456
432
|
MissingImageDimension: {
|
|
457
433
|
title: "Missing image dimensions",
|
|
458
|
-
code: 3024,
|
|
459
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.`,
|
|
460
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)."
|
|
461
436
|
},
|
|
@@ -475,7 +450,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
475
450
|
*/
|
|
476
451
|
UnsupportedImageFormat: {
|
|
477
452
|
title: "Unsupported image format",
|
|
478
|
-
code: 3025,
|
|
479
453
|
message: (format, imagePath, supportedFormats) => `Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join(
|
|
480
454
|
", "
|
|
481
455
|
)} are supported for optimization.`,
|
|
@@ -493,7 +467,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
493
467
|
*/
|
|
494
468
|
PrerenderDynamicEndpointPathCollide: {
|
|
495
469
|
title: "Prerendered dynamic endpoint has path collision.",
|
|
496
|
-
code: 3026,
|
|
497
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.`,
|
|
498
471
|
hint: (filename) => `Rename \`${filename}\` to \`${filename.replace(/\.(js|ts)/, (m) => `.json` + m)}\``
|
|
499
472
|
},
|
|
@@ -518,7 +491,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
518
491
|
*/
|
|
519
492
|
ExpectedImage: {
|
|
520
493
|
title: "Expected src to be an image.",
|
|
521
|
-
code: 3027,
|
|
522
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}\`.`,
|
|
523
495
|
hint: "This error can often happen because of a wrong path. Make sure the path to your image is correct."
|
|
524
496
|
},
|
|
@@ -540,7 +512,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
540
512
|
*/
|
|
541
513
|
ExpectedImageOptions: {
|
|
542
514
|
title: "Expected image options.",
|
|
543
|
-
code: 3028,
|
|
544
515
|
message: (options) => `Expected getImage() parameter to be an object. Received \`${options}\`.`
|
|
545
516
|
},
|
|
546
517
|
/**
|
|
@@ -556,7 +527,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
556
527
|
*/
|
|
557
528
|
MarkdownImageNotFound: {
|
|
558
529
|
title: "Image not found.",
|
|
559
|
-
code: 3029,
|
|
560
530
|
message: (imagePath, fullImagePath) => `Could not find requested image \`${imagePath}\`${fullImagePath ? ` at \`${fullImagePath}\`.` : "."}`,
|
|
561
531
|
hint: "This is often caused by a typo in the image path. Please make sure the file exists, and is spelled correctly."
|
|
562
532
|
},
|
|
@@ -567,7 +537,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
567
537
|
*/
|
|
568
538
|
ResponseSentError: {
|
|
569
539
|
title: "Unable to set response.",
|
|
570
|
-
code: 3030,
|
|
571
540
|
message: "The response has already been sent to the browser and cannot be altered."
|
|
572
541
|
},
|
|
573
542
|
/**
|
|
@@ -586,7 +555,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
586
555
|
*/
|
|
587
556
|
MiddlewareNoDataOrNextCalled: {
|
|
588
557
|
title: "The middleware didn't return a response or call `next`.",
|
|
589
|
-
code: 3031,
|
|
590
558
|
message: "The middleware needs to either return a `Response` object or call the `next` function."
|
|
591
559
|
},
|
|
592
560
|
/**
|
|
@@ -604,7 +572,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
604
572
|
*/
|
|
605
573
|
MiddlewareNotAResponse: {
|
|
606
574
|
title: "The middleware returned something that is not a `Response` object.",
|
|
607
|
-
code: 3032,
|
|
608
575
|
message: "Any data returned from middleware must be a valid `Response` object."
|
|
609
576
|
},
|
|
610
577
|
/**
|
|
@@ -624,11 +591,10 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
624
591
|
*/
|
|
625
592
|
LocalsNotAnObject: {
|
|
626
593
|
title: "Value assigned to `locals` is not accepted.",
|
|
627
|
-
code: 3033,
|
|
628
594
|
message: "`locals` can only be assigned to an object. Other values like numbers, strings, etc. are not accepted.",
|
|
629
595
|
hint: "If you tried to remove some information from the `locals` object, try to use `delete` or set the property to `undefined`."
|
|
630
596
|
},
|
|
631
|
-
|
|
597
|
+
/**
|
|
632
598
|
* @docs
|
|
633
599
|
* @see
|
|
634
600
|
* - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
|
|
@@ -650,7 +616,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
650
616
|
*/
|
|
651
617
|
LocalImageUsedWrongly: {
|
|
652
618
|
title: "ESM imported images must be passed as-is.",
|
|
653
|
-
code: 3034,
|
|
654
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}\`.`
|
|
655
620
|
},
|
|
656
621
|
/**
|
|
@@ -662,7 +627,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
662
627
|
*/
|
|
663
628
|
AstroGlobUsedOutside: {
|
|
664
629
|
title: "Astro.glob() used outside of an Astro file.",
|
|
665
|
-
code: 3035,
|
|
666
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.`,
|
|
667
631
|
hint: "See Vite's documentation on `import.meta.glob` for more information: https://vitejs.dev/guide/features.html#glob-import"
|
|
668
632
|
},
|
|
@@ -675,7 +639,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
675
639
|
*/
|
|
676
640
|
AstroGlobNoMatch: {
|
|
677
641
|
title: "Astro.glob() did not match any files.",
|
|
678
|
-
code: 3036,
|
|
679
642
|
message: (globStr) => `\`Astro.glob(${globStr})\` did not return any matching files. Check the pattern for typos.`
|
|
680
643
|
},
|
|
681
644
|
/**
|
|
@@ -686,8 +649,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
686
649
|
* A redirect must be given a location with the `Location` header.
|
|
687
650
|
*/
|
|
688
651
|
RedirectWithNoLocation: {
|
|
689
|
-
title: "A redirect must be given a location with the `Location` header."
|
|
690
|
-
code: 3037
|
|
652
|
+
title: "A redirect must be given a location with the `Location` header."
|
|
691
653
|
},
|
|
692
654
|
/**
|
|
693
655
|
* @docs
|
|
@@ -698,7 +660,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
698
660
|
*/
|
|
699
661
|
InvalidDynamicRoute: {
|
|
700
662
|
title: "Invalid dynamic route.",
|
|
701
|
-
code: 3038,
|
|
702
663
|
message: (route, invalidParam, received) => `The ${invalidParam} param for route ${route} is invalid. Received **${received}**.`
|
|
703
664
|
},
|
|
704
665
|
// No headings here, that way Vite errors are merged with Astro ones in the docs, which makes more sense to users.
|
|
@@ -713,8 +674,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
713
674
|
* If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
|
|
714
675
|
*/
|
|
715
676
|
UnknownViteError: {
|
|
716
|
-
title: "Unknown Vite Error."
|
|
717
|
-
code: 4e3
|
|
677
|
+
title: "Unknown Vite Error."
|
|
718
678
|
},
|
|
719
679
|
/**
|
|
720
680
|
* @docs
|
|
@@ -727,7 +687,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
727
687
|
*/
|
|
728
688
|
FailedToLoadModuleSSR: {
|
|
729
689
|
title: "Could not import file.",
|
|
730
|
-
code: 4001,
|
|
731
690
|
message: (importName) => `Could not import \`${importName}\`.`,
|
|
732
691
|
hint: "This is often caused by a typo in the import path. Please make sure the file exists."
|
|
733
692
|
},
|
|
@@ -740,10 +699,18 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
740
699
|
*/
|
|
741
700
|
InvalidGlob: {
|
|
742
701
|
title: "Invalid glob pattern.",
|
|
743
|
-
code: 4002,
|
|
744
702
|
message: (globPattern) => `Invalid glob pattern: \`${globPattern}\`. Glob patterns must start with './', '../' or '/'.`,
|
|
745
703
|
hint: "See https://docs.astro.build/en/guides/imports/#glob-patterns for more information on supported glob patterns."
|
|
746
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
|
+
},
|
|
747
714
|
/**
|
|
748
715
|
* @docs
|
|
749
716
|
* @kind heading
|
|
@@ -758,8 +725,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
758
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.
|
|
759
726
|
*/
|
|
760
727
|
UnknownCSSError: {
|
|
761
|
-
title: "Unknown CSS Error."
|
|
762
|
-
code: 5e3
|
|
728
|
+
title: "Unknown CSS Error."
|
|
763
729
|
},
|
|
764
730
|
/**
|
|
765
731
|
* @docs
|
|
@@ -771,8 +737,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
771
737
|
* Astro encountered an error while parsing your CSS, due to a syntax error. This is often caused by a missing semicolon.
|
|
772
738
|
*/
|
|
773
739
|
CSSSyntaxError: {
|
|
774
|
-
title: "CSS Syntax Error."
|
|
775
|
-
code: 5001
|
|
740
|
+
title: "CSS Syntax Error."
|
|
776
741
|
},
|
|
777
742
|
/**
|
|
778
743
|
* @docs
|
|
@@ -786,8 +751,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
786
751
|
* Astro encountered an unknown error while parsing your Markdown. Oftentimes, this is caused by a syntax error and the error message should contain more information.
|
|
787
752
|
*/
|
|
788
753
|
UnknownMarkdownError: {
|
|
789
|
-
title: "Unknown Markdown Error."
|
|
790
|
-
code: 6e3
|
|
754
|
+
title: "Unknown Markdown Error."
|
|
791
755
|
},
|
|
792
756
|
/**
|
|
793
757
|
* @docs
|
|
@@ -801,8 +765,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
801
765
|
* This is often caused by a mistake in the syntax, such as a missing colon or a missing end quote.
|
|
802
766
|
*/
|
|
803
767
|
MarkdownFrontmatterParseError: {
|
|
804
|
-
title: "Failed to parse Markdown frontmatter."
|
|
805
|
-
code: 6001
|
|
768
|
+
title: "Failed to parse Markdown frontmatter."
|
|
806
769
|
},
|
|
807
770
|
/**
|
|
808
771
|
* @docs
|
|
@@ -813,7 +776,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
813
776
|
*/
|
|
814
777
|
InvalidFrontmatterInjectionError: {
|
|
815
778
|
title: "Invalid frontmatter injection.",
|
|
816
|
-
code: 6003,
|
|
817
779
|
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`.',
|
|
818
780
|
hint: "See the frontmatter injection docs https://docs.astro.build/en/guides/markdown-content/#modifying-frontmatter-programmatically for more information."
|
|
819
781
|
},
|
|
@@ -826,7 +788,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
826
788
|
*/
|
|
827
789
|
MdxIntegrationMissingError: {
|
|
828
790
|
title: "MDX integration missing.",
|
|
829
|
-
code: 6004,
|
|
830
791
|
message: (file) => `Unable to render ${file}. Ensure that the \`@astrojs/mdx\` integration is installed.`,
|
|
831
792
|
hint: "See the MDX integration docs for installation and usage instructions: https://docs.astro.build/en/guides/integrations-guide/mdx/"
|
|
832
793
|
},
|
|
@@ -842,8 +803,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
842
803
|
* If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
|
|
843
804
|
*/
|
|
844
805
|
UnknownConfigError: {
|
|
845
|
-
title: "Unknown configuration error."
|
|
846
|
-
code: 7e3
|
|
806
|
+
title: "Unknown configuration error."
|
|
847
807
|
},
|
|
848
808
|
/**
|
|
849
809
|
* @docs
|
|
@@ -854,7 +814,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
854
814
|
*/
|
|
855
815
|
ConfigNotFound: {
|
|
856
816
|
title: "Specified configuration file not found.",
|
|
857
|
-
code: 7001,
|
|
858
817
|
message: (configFile) => `Unable to resolve \`--config "${configFile}"\`. Does the file exist?`
|
|
859
818
|
},
|
|
860
819
|
/**
|
|
@@ -866,7 +825,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
866
825
|
*/
|
|
867
826
|
ConfigLegacyKey: {
|
|
868
827
|
title: "Legacy configuration detected.",
|
|
869
|
-
code: 7002,
|
|
870
828
|
message: (legacyConfigKey) => `Legacy configuration detected: \`${legacyConfigKey}\`.`,
|
|
871
829
|
hint: "Please update your configuration to the new format.\nSee https://astro.build/config for more information."
|
|
872
830
|
},
|
|
@@ -884,8 +842,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
884
842
|
* If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
|
|
885
843
|
*/
|
|
886
844
|
UnknownCLIError: {
|
|
887
|
-
title: "Unknown CLI Error."
|
|
888
|
-
code: 8e3
|
|
845
|
+
title: "Unknown CLI Error."
|
|
889
846
|
},
|
|
890
847
|
/**
|
|
891
848
|
* @docs
|
|
@@ -896,7 +853,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
896
853
|
*/
|
|
897
854
|
GenerateContentTypesError: {
|
|
898
855
|
title: "Failed to generate content types.",
|
|
899
|
-
code: 8001,
|
|
900
856
|
message: (errorMessage) => `\`astro sync\` command failed to generate content collection types: ${errorMessage}`,
|
|
901
857
|
hint: "Check your `src/content/config.*` file for typos."
|
|
902
858
|
},
|
|
@@ -915,8 +871,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
915
871
|
* If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
|
|
916
872
|
*/
|
|
917
873
|
UnknownContentCollectionError: {
|
|
918
|
-
title: "Unknown Content Collection Error."
|
|
919
|
-
code: 9e3
|
|
874
|
+
title: "Unknown Content Collection Error."
|
|
920
875
|
},
|
|
921
876
|
/**
|
|
922
877
|
* @docs
|
|
@@ -933,7 +888,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
933
888
|
*/
|
|
934
889
|
InvalidContentEntryFrontmatterError: {
|
|
935
890
|
title: "Content entry frontmatter does not match schema.",
|
|
936
|
-
code: 9001,
|
|
937
891
|
message: (collection, entryId, error) => {
|
|
938
892
|
return [
|
|
939
893
|
`**${String(collection)} \u2192 ${String(
|
|
@@ -954,7 +908,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
954
908
|
*/
|
|
955
909
|
InvalidContentEntrySlugError: {
|
|
956
910
|
title: "Invalid content entry slug.",
|
|
957
|
-
code: 9002,
|
|
958
911
|
message: (collection, entryId) => {
|
|
959
912
|
return `${String(collection)} \u2192 ${String(
|
|
960
913
|
entryId
|
|
@@ -971,7 +924,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
971
924
|
*/
|
|
972
925
|
ContentSchemaContainsSlugError: {
|
|
973
926
|
title: "Content Schema should not contain `slug`.",
|
|
974
|
-
code: 9003,
|
|
975
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.`,
|
|
976
928
|
hint: "See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field."
|
|
977
929
|
},
|
|
@@ -983,7 +935,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
983
935
|
*/
|
|
984
936
|
CollectionDoesNotExistError: {
|
|
985
937
|
title: "Collection does not exist",
|
|
986
|
-
code: 9004,
|
|
987
938
|
message: (collectionName) => `The collection **${collectionName}** does not exist. Ensure a collection directory with this name exists.`,
|
|
988
939
|
hint: "See https://docs.astro.build/en/guides/content-collections/ for more on creating collections."
|
|
989
940
|
},
|
|
@@ -997,7 +948,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
997
948
|
*/
|
|
998
949
|
MixedContentDataCollectionError: {
|
|
999
950
|
title: "Content and data cannot be in same collection.",
|
|
1000
|
-
code: 9005,
|
|
1001
951
|
message: (collection) => {
|
|
1002
952
|
return `**${collection}** contains a mix of content and data entries. All entries must be of the same type.`;
|
|
1003
953
|
},
|
|
@@ -1013,7 +963,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
1013
963
|
*/
|
|
1014
964
|
ContentCollectionTypeMismatchError: {
|
|
1015
965
|
title: "Collection contains entries of a different type.",
|
|
1016
|
-
code: 9006,
|
|
1017
966
|
message: (collection, expectedType, actualType) => {
|
|
1018
967
|
return `${collection} contains ${expectedType} entries, but is configured as a ${actualType} collection.`;
|
|
1019
968
|
}
|
|
@@ -1026,7 +975,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
1026
975
|
*/
|
|
1027
976
|
DataCollectionEntryParseError: {
|
|
1028
977
|
title: "Data collection entry failed to parse.",
|
|
1029
|
-
code: 9007,
|
|
1030
978
|
message: (entryId, errorMessage) => {
|
|
1031
979
|
return `**${entryId}** failed to parse: ${errorMessage}`;
|
|
1032
980
|
},
|
|
@@ -1040,7 +988,6 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
1040
988
|
*/
|
|
1041
989
|
DuplicateContentEntrySlugError: {
|
|
1042
990
|
title: "Duplicate content entry slug.",
|
|
1043
|
-
code: 9008,
|
|
1044
991
|
message: (collection, slug) => {
|
|
1045
992
|
return `**${collection}** contains multiple entries with the same slug: \`${slug}\`. Slugs must be unique.`;
|
|
1046
993
|
}
|
|
@@ -1054,15 +1001,13 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
|
|
|
1054
1001
|
*/
|
|
1055
1002
|
UnsupportedConfigTransformError: {
|
|
1056
1003
|
title: "Unsupported transform in content config.",
|
|
1057
|
-
code: 9008,
|
|
1058
1004
|
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).
|
|
1059
1005
|
Full error: ${parseError}`,
|
|
1060
1006
|
hint: "See the devalue library for all supported types: https://github.com/rich-harris/devalue"
|
|
1061
1007
|
},
|
|
1062
1008
|
// Generic catch-all - Only use this in extreme cases, like if there was a cosmic ray bit flip
|
|
1063
1009
|
UnknownError: {
|
|
1064
|
-
title: "Unknown Error."
|
|
1065
|
-
code: 99999
|
|
1010
|
+
title: "Unknown Error."
|
|
1066
1011
|
}
|
|
1067
1012
|
};
|
|
1068
1013
|
export {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { DiagnosticCode } from '@astrojs/compiler/shared/diagnostics.js';
|
|
2
|
-
import type { AstroErrorCodes } from './errors-data.js';
|
|
3
1
|
interface ErrorProperties {
|
|
4
|
-
code: AstroErrorCodes | DiagnosticCode;
|
|
5
2
|
title?: string;
|
|
6
3
|
name?: string;
|
|
7
4
|
message?: string;
|
|
@@ -18,14 +15,12 @@ export interface ErrorLocation {
|
|
|
18
15
|
type ErrorTypes = 'AstroError' | 'CompilerError' | 'CSSError' | 'MarkdownError' | 'InternalError' | 'AggregateError';
|
|
19
16
|
export declare function isAstroError(e: unknown): e is AstroError;
|
|
20
17
|
export declare class AstroError extends Error {
|
|
21
|
-
errorCode: AstroErrorCodes | DiagnosticCode;
|
|
22
18
|
loc: ErrorLocation | undefined;
|
|
23
19
|
title: string | undefined;
|
|
24
20
|
hint: string | undefined;
|
|
25
21
|
frame: string | undefined;
|
|
26
22
|
type: ErrorTypes;
|
|
27
23
|
constructor(props: ErrorProperties, ...params: any);
|
|
28
|
-
setErrorCode(errorCode: AstroErrorCodes): void;
|
|
29
24
|
setLocation(location: ErrorLocation): void;
|
|
30
25
|
setName(name: string): void;
|
|
31
26
|
setMessage(message: string): void;
|
|
@@ -35,9 +30,7 @@ export declare class AstroError extends Error {
|
|
|
35
30
|
}
|
|
36
31
|
export declare class CompilerError extends AstroError {
|
|
37
32
|
type: ErrorTypes;
|
|
38
|
-
constructor(props:
|
|
39
|
-
code: DiagnosticCode;
|
|
40
|
-
}, ...params: any);
|
|
33
|
+
constructor(props: ErrorProperties, ...params: any);
|
|
41
34
|
static is(err: Error | unknown): err is CompilerError;
|
|
42
35
|
}
|
|
43
36
|
export declare class CSSError extends AstroError {
|
|
@@ -71,7 +64,6 @@ export interface ErrorWithMetadata {
|
|
|
71
64
|
type?: ErrorTypes;
|
|
72
65
|
message: string;
|
|
73
66
|
stack: string;
|
|
74
|
-
errorCode?: number;
|
|
75
67
|
hint?: string;
|
|
76
68
|
id?: string;
|
|
77
69
|
frame?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { codeFrame } from "./printer.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getErrorDataByTitle } from "./utils.js";
|
|
3
3
|
function isAstroError(e) {
|
|
4
4
|
return e instanceof Error && e.type === "AstroError";
|
|
5
5
|
}
|
|
@@ -8,14 +8,16 @@ class AstroError extends Error {
|
|
|
8
8
|
var _a;
|
|
9
9
|
super(...params);
|
|
10
10
|
this.type = "AstroError";
|
|
11
|
-
const {
|
|
12
|
-
this.
|
|
11
|
+
const { name, title, message, stack, location, hint, frame } = props;
|
|
12
|
+
this.title = title;
|
|
13
13
|
if (name && name !== "Error") {
|
|
14
14
|
this.name = name;
|
|
15
|
-
} else {
|
|
16
|
-
|
|
15
|
+
} else if (this.title) {
|
|
16
|
+
const errorData = (_a = getErrorDataByTitle(this.title)) == null ? void 0 : _a.name;
|
|
17
|
+
if (errorData) {
|
|
18
|
+
this.name = errorData;
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
|
-
this.title = title;
|
|
19
21
|
if (message)
|
|
20
22
|
this.message = message;
|
|
21
23
|
this.stack = stack ? stack : this.stack;
|
|
@@ -23,9 +25,6 @@ class AstroError extends Error {
|
|
|
23
25
|
this.hint = hint;
|
|
24
26
|
this.frame = frame;
|
|
25
27
|
}
|
|
26
|
-
setErrorCode(errorCode) {
|
|
27
|
-
this.errorCode = errorCode;
|
|
28
|
-
}
|
|
29
28
|
setLocation(location) {
|
|
30
29
|
this.loc = location;
|
|
31
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ErrorLocation, ErrorWithMetadata } from './errors';
|
|
2
|
-
export { AstroErrorData
|
|
2
|
+
export { AstroErrorData } from './errors-data.js';
|
|
3
3
|
export { AggregateError, AstroError, CompilerError, CSSError, isAstroError, MarkdownError, } from './errors.js';
|
|
4
4
|
export { codeFrame } from './printer.js';
|
|
5
5
|
export { createSafeError, positionAt } from './utils.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { DiagnosticCode } from '@astrojs/compiler/shared/diagnostics.js';
|
|
2
1
|
import type { YAMLException } from 'js-yaml';
|
|
3
2
|
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
|
4
|
-
import { type
|
|
3
|
+
import { type ErrorData } from './errors-data.js';
|
|
5
4
|
/**
|
|
6
5
|
* Get the line and character based on the offset
|
|
7
6
|
* @param offset The index of the position
|
|
@@ -17,7 +16,7 @@ export declare function formatYAMLException(e: YAMLException): ViteErrorPayload[
|
|
|
17
16
|
/** Coalesce any throw variable to an Error instance. */
|
|
18
17
|
export declare function createSafeError(err: any): Error;
|
|
19
18
|
export declare function normalizeLF(code: string): string;
|
|
20
|
-
export declare function
|
|
19
|
+
export declare function getErrorDataByTitle(title: string): {
|
|
21
20
|
name: string;
|
|
22
21
|
data: ErrorData;
|
|
23
22
|
} | undefined;
|
|
@@ -70,8 +70,8 @@ function createSafeError(err) {
|
|
|
70
70
|
function normalizeLF(code) {
|
|
71
71
|
return code.replace(/\r\n|\r(?!\n)|\n/g, "\n");
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const entry = Object.entries(AstroErrorData).find((data) => data[1].
|
|
73
|
+
function getErrorDataByTitle(title) {
|
|
74
|
+
const entry = Object.entries(AstroErrorData).find((data) => data[1].title === title);
|
|
75
75
|
if (entry) {
|
|
76
76
|
return {
|
|
77
77
|
name: entry[0],
|
|
@@ -82,7 +82,7 @@ function getErrorDataByCode(code) {
|
|
|
82
82
|
export {
|
|
83
83
|
createSafeError,
|
|
84
84
|
formatYAMLException,
|
|
85
|
-
|
|
85
|
+
getErrorDataByTitle,
|
|
86
86
|
isYAMLException,
|
|
87
87
|
normalizeLF,
|
|
88
88
|
positionAt
|
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function serverStart({
|
|
|
47
47
|
base,
|
|
48
48
|
isRestart = false
|
|
49
49
|
}) {
|
|
50
|
-
const version = "2.
|
|
50
|
+
const version = "2.7.1";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
53
53
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -233,7 +233,7 @@ function printHelp({
|
|
|
233
233
|
message.push(
|
|
234
234
|
linebreak(),
|
|
235
235
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
236
|
-
`v${"2.
|
|
236
|
+
`v${"2.7.1"}`
|
|
237
237
|
)} ${headline}`
|
|
238
238
|
);
|
|
239
239
|
}
|