astro 1.6.9 → 1.6.11
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/astro-jsx.d.ts +4 -0
- package/dist/core/build/vite-plugin-analyzer.js +3 -5
- package/dist/core/compile/compile.js +7 -3
- package/dist/core/config/vite-load.js +13 -8
- 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/endpoint/index.js +3 -3
- package/dist/core/errors/errors-data.d.ts +341 -21
- package/dist/core/errors/errors-data.js +68 -38
- package/dist/core/errors/errors.d.ts +3 -1
- package/dist/core/errors/errors.js +6 -5
- package/dist/core/errors/utils.d.ts +43 -13
- package/dist/core/messages.js +3 -4
- package/dist/core/path.d.ts +1 -0
- package/dist/core/path.js +5 -0
- package/dist/core/render/result.js +3 -5
- package/dist/core/render/route-cache.js +1 -1
- package/dist/core/routing/validation.js +3 -3
- package/dist/runtime/server/hydration.js +1 -4
- package/dist/runtime/server/render/astro.d.ts +1 -0
- package/dist/runtime/server/render/astro.js +13 -1
- package/dist/vite-plugin-jsx/index.js +2 -0
- package/dist/vite-plugin-jsx/tag.js +8 -7
- package/dist/vite-plugin-load-fallback/index.d.ts +2 -3
- package/dist/vite-plugin-load-fallback/index.js +15 -9
- package/package.json +1 -1
package/astro-jsx.d.ts
CHANGED
|
@@ -663,6 +663,7 @@ declare namespace astroHTML.JSX {
|
|
|
663
663
|
allow?: string | undefined | null;
|
|
664
664
|
allowfullscreen?: boolean | string | undefined | null;
|
|
665
665
|
allowtransparency?: boolean | string | undefined | null;
|
|
666
|
+
fetchpriority?: 'auto' | 'high' | 'low' | undefined | null;
|
|
666
667
|
/** @deprecated */
|
|
667
668
|
frameborder?: number | string | undefined | null;
|
|
668
669
|
height?: number | string | undefined | null;
|
|
@@ -686,6 +687,7 @@ declare namespace astroHTML.JSX {
|
|
|
686
687
|
alt?: string | undefined | null;
|
|
687
688
|
crossorigin?: 'anonymous' | 'use-credentials' | '' | undefined | null;
|
|
688
689
|
decoding?: 'async' | 'auto' | 'sync' | undefined | null;
|
|
690
|
+
fetchpriority?: 'auto' | 'high' | 'low' | undefined | null;
|
|
689
691
|
height?: number | string | undefined | null;
|
|
690
692
|
loading?: 'eager' | 'lazy' | undefined | null;
|
|
691
693
|
referrerpolicy?: HTMLAttributeReferrerPolicy | undefined | null;
|
|
@@ -784,6 +786,7 @@ declare namespace astroHTML.JSX {
|
|
|
784
786
|
crossorigin?: boolean | string | undefined | null;
|
|
785
787
|
href?: string | URL | undefined | null;
|
|
786
788
|
hreflang?: string | undefined | null;
|
|
789
|
+
fetchpriority?: 'auto' | 'high' | 'low' | undefined | null;
|
|
787
790
|
integrity?: string | undefined | null;
|
|
788
791
|
media?: string | undefined | null;
|
|
789
792
|
imageSrcSet?: string | undefined | null;
|
|
@@ -893,6 +896,7 @@ declare namespace astroHTML.JSX {
|
|
|
893
896
|
charset?: string | undefined | null;
|
|
894
897
|
crossorigin?: string | undefined | null;
|
|
895
898
|
defer?: boolean | string | undefined | null;
|
|
899
|
+
fetchpriority?: 'auto' | 'high' | 'low' | undefined | null;
|
|
896
900
|
integrity?: string | undefined | null;
|
|
897
901
|
nomodule?: boolean | string | undefined | null;
|
|
898
902
|
nonce?: string | undefined | null;
|
|
@@ -75,11 +75,9 @@ function vitePluginAnalyzer(internals) {
|
|
|
75
75
|
const cid = c.resolvedPath ? decodeURI(c.resolvedPath) : c.specifier;
|
|
76
76
|
internals.discoveredClientOnlyComponents.add(cid);
|
|
77
77
|
clientOnlys.push(cid);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
clientOnlys.push(resolvedId.id);
|
|
82
|
-
}
|
|
78
|
+
const resolvedId = await this.resolve(c.specifier, id);
|
|
79
|
+
if (resolvedId) {
|
|
80
|
+
clientOnlys.push(resolvedId.id);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
for (const [pageInfo] of getTopLevelPages(id, this)) {
|
|
@@ -61,13 +61,17 @@ async function compile({
|
|
|
61
61
|
return result;
|
|
62
62
|
case 1: {
|
|
63
63
|
let error = cssTransformErrors[0];
|
|
64
|
-
if (!error.
|
|
65
|
-
error.
|
|
64
|
+
if (!error.errorCode) {
|
|
65
|
+
error.errorCode = AstroErrorData.UnknownCSSError.code;
|
|
66
66
|
}
|
|
67
67
|
throw cssTransformErrors[0];
|
|
68
68
|
}
|
|
69
69
|
default: {
|
|
70
|
-
throw new AggregateError({
|
|
70
|
+
throw new AggregateError({
|
|
71
|
+
...cssTransformErrors[0],
|
|
72
|
+
code: cssTransformErrors[0].errorCode,
|
|
73
|
+
errors: cssTransformErrors
|
|
74
|
+
});
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import npath from "path";
|
|
2
2
|
import { pathToFileURL } from "url";
|
|
3
3
|
import * as vite from "vite";
|
|
4
|
+
import loadFallbackPlugin from "../../vite-plugin-load-fallback/index.js";
|
|
4
5
|
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
5
6
|
import load from "@proload/core";
|
|
6
7
|
import loadTypeScript from "@proload/plugin-tsm";
|
|
7
8
|
load.use([loadTypeScript]);
|
|
8
|
-
async function createViteLoader(root) {
|
|
9
|
+
async function createViteLoader(root, fs) {
|
|
9
10
|
const viteServer = await vite.createServer({
|
|
10
11
|
server: { middlewareMode: true, hmr: false },
|
|
11
12
|
optimizeDeps: { entries: [] },
|
|
@@ -13,7 +14,8 @@ async function createViteLoader(root) {
|
|
|
13
14
|
appType: "custom",
|
|
14
15
|
ssr: {
|
|
15
16
|
external: ["@astrojs/tailwind", "@astrojs/mdx", "@astrojs/react"]
|
|
16
|
-
}
|
|
17
|
+
},
|
|
18
|
+
plugins: [loadFallbackPlugin({ fs, root: pathToFileURL(root) })]
|
|
17
19
|
});
|
|
18
20
|
return {
|
|
19
21
|
root,
|
|
@@ -71,15 +73,18 @@ async function loadConfigWithVite({
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
if (/\.[cm]?js$/.test(file)) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
try {
|
|
77
|
+
const config = await import(pathToFileURL(file).toString());
|
|
78
|
+
return {
|
|
79
|
+
value: config.default ?? {},
|
|
80
|
+
filePath: file
|
|
81
|
+
};
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
79
84
|
}
|
|
80
85
|
let loader;
|
|
81
86
|
try {
|
|
82
|
-
loader = await createViteLoader(root);
|
|
87
|
+
loader = await createViteLoader(root, fs);
|
|
83
88
|
const mod = await loader.viteServer.ssrLoadModule(file);
|
|
84
89
|
return {
|
|
85
90
|
value: mod.default ?? {},
|
package/dist/core/constants.js
CHANGED
package/dist/core/create-vite.js
CHANGED
|
@@ -63,7 +63,7 @@ async function createVite(commandConfig, { settings, logging, mode, fs = nodeFs
|
|
|
63
63
|
},
|
|
64
64
|
plugins: [
|
|
65
65
|
configAliasVitePlugin({ settings }),
|
|
66
|
-
astroLoadFallbackPlugin({ fs, settings }),
|
|
66
|
+
astroLoadFallbackPlugin({ fs, root: settings.config.root }),
|
|
67
67
|
astroVitePlugin({ settings, logging }),
|
|
68
68
|
astroScriptsPlugin({ settings }),
|
|
69
69
|
mode !== "build" && vitePluginAstroServer({ settings, logging, fs }),
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -30,7 +30,7 @@ async function dev(settings, options) {
|
|
|
30
30
|
isRestart: options.isRestart
|
|
31
31
|
})
|
|
32
32
|
);
|
|
33
|
-
const currentVersion = "1.6.
|
|
33
|
+
const currentVersion = "1.6.11";
|
|
34
34
|
if (currentVersion.includes("-")) {
|
|
35
35
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
36
36
|
}
|
|
@@ -31,8 +31,8 @@ function createAPIContext({
|
|
|
31
31
|
if (!(clientAddressSymbol in request)) {
|
|
32
32
|
if (adapterName) {
|
|
33
33
|
throw new AstroError({
|
|
34
|
-
...AstroErrorData.
|
|
35
|
-
message: AstroErrorData.
|
|
34
|
+
...AstroErrorData.ClientAddressNotAvailable,
|
|
35
|
+
message: AstroErrorData.ClientAddressNotAvailable.message(adapterName)
|
|
36
36
|
});
|
|
37
37
|
} else {
|
|
38
38
|
throw new AstroError(AstroErrorData.StaticClientAddressNotAvailable);
|
|
@@ -87,7 +87,7 @@ function isRedirect(statusCode) {
|
|
|
87
87
|
}
|
|
88
88
|
function throwIfRedirectNotAllowed(response, config) {
|
|
89
89
|
if (config.output !== "server" && isRedirect(response.status)) {
|
|
90
|
-
throw new AstroError(AstroErrorData.
|
|
90
|
+
throw new AstroError(AstroErrorData.StaticRedirectNotAvailable);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
export {
|
|
@@ -1,132 +1,452 @@
|
|
|
1
1
|
export declare const AstroErrorData: {
|
|
2
2
|
readonly UnknownCompilerError: {
|
|
3
|
+
readonly title: "Unknown compiler error.";
|
|
3
4
|
readonly code: 1000;
|
|
4
5
|
};
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @docs
|
|
8
|
+
* @kind heading
|
|
9
|
+
* @name Astro Errors
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @docs
|
|
13
|
+
* @see
|
|
14
|
+
* - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)
|
|
15
|
+
* - [Astro.redirect](https://docs.astro.build/en/guides/server-side-rendering/#astroredirect)
|
|
16
|
+
* @description
|
|
17
|
+
* The `Astro.redirect` function is only available when [Server-side rendering](/en/guides/server-side-rendering/) is enabled.
|
|
18
|
+
*
|
|
19
|
+
* To redirect on a static website, the [meta refresh attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) can be used. Certain hosts also provide config-based redirects (ex: [Netlify redirects](https://docs.netlify.com/routing/redirects/)).
|
|
20
|
+
*/
|
|
21
|
+
readonly StaticRedirectNotAvailable: {
|
|
22
|
+
readonly title: "`Astro.redirect` is not available in static mode.";
|
|
6
23
|
readonly code: 3001;
|
|
7
|
-
readonly message: "Redirects are only available when using output: 'server'
|
|
24
|
+
readonly message: "Redirects are only available when using `output: 'server'`. Update your Astro config if you need SSR features.";
|
|
8
25
|
readonly hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR.";
|
|
9
26
|
};
|
|
10
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @docs
|
|
29
|
+
* @see
|
|
30
|
+
* - [Official integrations](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
|
|
31
|
+
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress)
|
|
32
|
+
* @description
|
|
33
|
+
* The adapter you.'re using unfortunately does not support `Astro.clientAddress`.
|
|
34
|
+
*/
|
|
35
|
+
readonly ClientAddressNotAvailable: {
|
|
36
|
+
readonly title: "`Astro.clientAddress` is not available in current adapter.";
|
|
11
37
|
readonly code: 3002;
|
|
12
38
|
readonly message: (adapterName: string) => string;
|
|
13
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* @docs
|
|
42
|
+
* @see
|
|
43
|
+
* - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)
|
|
44
|
+
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress)
|
|
45
|
+
* @description
|
|
46
|
+
* The `Astro.clientAddress` property is only available when [Server-side rendering](https://docs.astro.build/en/guides/server-side-rendering/) is enabled.
|
|
47
|
+
*
|
|
48
|
+
* 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/core-concepts/astro-components/#client-side-scripts) or it may be possible to get the user's IP using a serverless function hosted on your hosting provider.
|
|
49
|
+
*/
|
|
14
50
|
readonly StaticClientAddressNotAvailable: {
|
|
51
|
+
readonly title: "`Astro.clientAddress` is not available in static mode.";
|
|
15
52
|
readonly code: 3003;
|
|
16
|
-
readonly message: "Astro.clientAddress is only available when using output: 'server'
|
|
53
|
+
readonly message: "`Astro.clientAddress` is only available when using `output: 'server'`. Update your Astro config if you need SSR features.";
|
|
17
54
|
readonly hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR.";
|
|
18
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* @docs
|
|
58
|
+
* @see
|
|
59
|
+
* - [getStaticPaths()](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
60
|
+
* @description
|
|
61
|
+
* 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.
|
|
62
|
+
*/
|
|
19
63
|
readonly NoMatchingStaticPathFound: {
|
|
64
|
+
readonly title: "No static path found for requested path.";
|
|
20
65
|
readonly code: 3004;
|
|
21
66
|
readonly message: (pathName: string) => string;
|
|
22
67
|
readonly hint: (possibleRoutes: string[]) => string;
|
|
23
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* @docs
|
|
71
|
+
* @message Route returned a `RETURNED_VALUE`. Only a Response can be returned from Astro files.
|
|
72
|
+
* @see
|
|
73
|
+
* - [Response](https://docs.astro.build/en/guides/server-side-rendering/#response)
|
|
74
|
+
* @description
|
|
75
|
+
* Only instances of [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned inside Astro files.
|
|
76
|
+
* ```astro title="pages/login.astro"
|
|
77
|
+
* ---
|
|
78
|
+
* return new Response(null, {
|
|
79
|
+
* status: 404,
|
|
80
|
+
* statusText: 'Not found'
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // Alternatively, for redirects, Astro.redirect also returns an instance of Response
|
|
84
|
+
* return Astro.redirect('/login');
|
|
85
|
+
* ---
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
24
89
|
readonly OnlyResponseCanBeReturned: {
|
|
90
|
+
readonly title: "Invalid type returned by Astro page.";
|
|
25
91
|
readonly code: 3005;
|
|
26
92
|
readonly message: (route: string | undefined, returnedValue: string) => string;
|
|
27
93
|
readonly hint: "See https://docs.astro.build/en/guides/server-side-rendering/#response for more information.";
|
|
28
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* @docs
|
|
97
|
+
* @see
|
|
98
|
+
* - [`client:media`](https://docs.astro.build/en/reference/directives-reference/#clientmedia)
|
|
99
|
+
* @description
|
|
100
|
+
* 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.
|
|
101
|
+
*
|
|
102
|
+
* ```astro
|
|
103
|
+
* <Counter client:media="(max-width: 640px)" />
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
29
106
|
readonly MissingMediaQueryDirective: {
|
|
107
|
+
readonly title: "Missing value for `client:media` directive.";
|
|
30
108
|
readonly code: 3006;
|
|
31
|
-
readonly message: (
|
|
109
|
+
readonly message: "Media query not provided for `client:media` directive. A media query similar to `client:media=\"(max-width: 600px)\"` must be provided";
|
|
32
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* @docs
|
|
113
|
+
* @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`.
|
|
114
|
+
* @see
|
|
115
|
+
* - [Frameworks components](https://docs.astro.build/en/core-concepts/framework-components/)
|
|
116
|
+
* - [UI Frameworks](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
|
|
117
|
+
* @description
|
|
118
|
+
* 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.
|
|
119
|
+
*
|
|
120
|
+
* 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
|
|
121
|
+
*/
|
|
33
122
|
readonly NoMatchingRenderer: {
|
|
123
|
+
readonly title: "No matching renderer found.";
|
|
34
124
|
readonly code: 3007;
|
|
35
125
|
readonly message: (componentName: string, componentExtension: string | undefined, plural: boolean, validRenderersCount: number) => string;
|
|
36
126
|
readonly hint: (probableRenderers: string) => string;
|
|
37
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* @docs
|
|
130
|
+
* @see
|
|
131
|
+
* - [addRenderer option](https://docs.astro.build/en/reference/integrations-reference/#addrenderer-option)
|
|
132
|
+
* - [Hydrating framework components](https://docs.astro.build/en/core-concepts/framework-components/#hydrating-interactive-components)
|
|
133
|
+
* @description
|
|
134
|
+
* Astro tried to hydrate a component on the client, but the renderer used does not provide a client entrypoint to use to hydrate.
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
38
137
|
readonly NoClientEntrypoint: {
|
|
138
|
+
readonly title: "No client entrypoint specified in renderer.";
|
|
39
139
|
readonly code: 3008;
|
|
40
140
|
readonly message: (componentName: string, clientDirective: string, rendererName: string) => string;
|
|
41
141
|
readonly hint: "See https://docs.astro.build/en/reference/integrations-reference/#addrenderer-option for more information on how to configure your renderer.";
|
|
42
142
|
};
|
|
143
|
+
/**
|
|
144
|
+
* @docs
|
|
145
|
+
* @see
|
|
146
|
+
* - [`client:only`](https://docs.astro.build/en/reference/directives-reference/#clientonly)
|
|
147
|
+
* @description
|
|
148
|
+
*
|
|
149
|
+
* `client:only` components are not ran on the server, as such Astro does not know (and cannot guess) which renderer to use and require a hint. Like such:
|
|
150
|
+
*
|
|
151
|
+
* ```astro
|
|
152
|
+
* <SomeReactComponent client:only="react" />
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
43
155
|
readonly NoClientOnlyHint: {
|
|
156
|
+
readonly title: "Missing hint on client:only directive.";
|
|
44
157
|
readonly code: 3009;
|
|
45
158
|
readonly message: (componentName: string) => string;
|
|
46
159
|
readonly hint: (probableRenderers: string) => string;
|
|
47
160
|
};
|
|
48
|
-
|
|
161
|
+
/**
|
|
162
|
+
* @docs
|
|
163
|
+
* @see
|
|
164
|
+
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
165
|
+
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
166
|
+
* @description
|
|
167
|
+
* The `params` property in `getStaticPaths`'s return value (an array of objects) should also be an object.
|
|
168
|
+
*
|
|
169
|
+
* ```astro title="pages/blog/[id].astro"
|
|
170
|
+
* ---
|
|
171
|
+
* export async function getStaticPaths() {
|
|
172
|
+
* return [
|
|
173
|
+
* { params: { slug: "blog" } },
|
|
174
|
+
* { params: { slug: "about" } }
|
|
175
|
+
* ];
|
|
176
|
+
*}
|
|
177
|
+
*---
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
readonly InvalidGetStaticPathParam: {
|
|
181
|
+
readonly title: "Invalid value returned by a `getStaticPaths` path.";
|
|
49
182
|
readonly code: 3010;
|
|
50
183
|
readonly message: (paramType: any) => string;
|
|
51
184
|
readonly hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths.";
|
|
52
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* @docs
|
|
188
|
+
* @see
|
|
189
|
+
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
190
|
+
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
191
|
+
* @description
|
|
192
|
+
* `getStaticPaths`'s return value must be an array of objects.
|
|
193
|
+
*
|
|
194
|
+
* ```ts title="pages/blog/[id].astro"
|
|
195
|
+
* export async function getStaticPaths() {
|
|
196
|
+
* return [ // <-- Array
|
|
197
|
+
* { params: { slug: "blog" } },
|
|
198
|
+
* { params: { slug: "about" } }
|
|
199
|
+
* ];
|
|
200
|
+
*}
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
53
203
|
readonly InvalidGetStaticPathsReturn: {
|
|
204
|
+
readonly title: "Invalid value returned by getStaticPaths.";
|
|
54
205
|
readonly code: 3011;
|
|
55
206
|
readonly message: (returnType: any) => string;
|
|
56
207
|
readonly hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths.";
|
|
57
208
|
};
|
|
58
|
-
|
|
209
|
+
/**
|
|
210
|
+
* @docs
|
|
211
|
+
* @see
|
|
212
|
+
* - [RSS Guide](https://docs.astro.build/en/guides/rss/)
|
|
213
|
+
* @description
|
|
214
|
+
* `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.
|
|
215
|
+
*/
|
|
216
|
+
readonly GetStaticPathsRemovedRSSHelper: {
|
|
217
|
+
readonly title: "getStaticPaths RSS helper is not available anymore.";
|
|
59
218
|
readonly code: 3012;
|
|
60
|
-
readonly message: "The RSS helper has been removed from getStaticPaths
|
|
219
|
+
readonly message: "The RSS helper has been removed from `getStaticPaths`. Try the new @astrojs/rss package instead.";
|
|
61
220
|
readonly hint: "See https://docs.astro.build/en/guides/rss/ for more information.";
|
|
62
221
|
};
|
|
222
|
+
/**
|
|
223
|
+
* @docs
|
|
224
|
+
* @see
|
|
225
|
+
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
226
|
+
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
227
|
+
* @description
|
|
228
|
+
* Every route specified by `getStaticPaths` require a `params` property specifying the path parameters needed to match the route.
|
|
229
|
+
*
|
|
230
|
+
* For instance, the following code:
|
|
231
|
+
* ```astro title="pages/blog/[id].astro"
|
|
232
|
+
* ---
|
|
233
|
+
* export async function getStaticPaths() {
|
|
234
|
+
* return [
|
|
235
|
+
* { params: { id: '1' } }
|
|
236
|
+
* ];
|
|
237
|
+
* }
|
|
238
|
+
* ---
|
|
239
|
+
* ```
|
|
240
|
+
* Will create the following route: `site.com/blog/1`.
|
|
241
|
+
*/
|
|
63
242
|
readonly GetStaticPathsExpectedParams: {
|
|
243
|
+
readonly title: "Missing params property on `getStaticPaths` route.";
|
|
64
244
|
readonly code: 3013;
|
|
65
|
-
readonly message: "Missing or empty required params property on getStaticPaths route";
|
|
245
|
+
readonly message: "Missing or empty required `params` property on `getStaticPaths` route.";
|
|
66
246
|
readonly hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths.";
|
|
67
247
|
};
|
|
248
|
+
/**
|
|
249
|
+
* @docs
|
|
250
|
+
* @see
|
|
251
|
+
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
252
|
+
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
253
|
+
* @description
|
|
254
|
+
* Since `params` are encoded into the URL, only certain types are supported as values.
|
|
255
|
+
*
|
|
256
|
+
* ```astro title="/route/[id].astro"
|
|
257
|
+
* ---
|
|
258
|
+
* export async function getStaticPaths() {
|
|
259
|
+
* return [
|
|
260
|
+
* { params: { id: '1' } } // Works
|
|
261
|
+
* { params: { id: 2 } } // Works
|
|
262
|
+
* { params: { id: false } } // Does not work
|
|
263
|
+
* ];
|
|
264
|
+
* }
|
|
265
|
+
* ---
|
|
266
|
+
* ```
|
|
267
|
+
*
|
|
268
|
+
* 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:
|
|
269
|
+
*
|
|
270
|
+
* ```astro title="/route/[...id].astro"
|
|
271
|
+
* ---
|
|
272
|
+
* export async function getStaticPaths() {
|
|
273
|
+
* return [
|
|
274
|
+
* { params: { id: 1 } } // /route/1
|
|
275
|
+
* { params: { id: 2 } } // /route/2
|
|
276
|
+
* { params: { id: undefined } } // /route/
|
|
277
|
+
* ];
|
|
278
|
+
* }
|
|
279
|
+
* ---
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
68
282
|
readonly GetStaticPathsInvalidRouteParam: {
|
|
283
|
+
readonly title: "Invalid value for `getStaticPaths` route parameter.";
|
|
69
284
|
readonly code: 3014;
|
|
70
|
-
readonly message: (key: string, value: any) => string;
|
|
285
|
+
readonly message: (key: string, value: any, valueType: any) => string;
|
|
71
286
|
readonly hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths.";
|
|
72
287
|
};
|
|
288
|
+
/**
|
|
289
|
+
* @docs
|
|
290
|
+
* @see
|
|
291
|
+
* - [Dynamic Routes](https://docs.astro.build/en/core-concepts/routing/#dynamic-routes)
|
|
292
|
+
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
293
|
+
* - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
|
|
294
|
+
* @description
|
|
295
|
+
* 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.
|
|
296
|
+
*/
|
|
73
297
|
readonly GetStaticPathsRequired: {
|
|
298
|
+
readonly title: "`getStaticPaths()` function required for dynamic routes.";
|
|
74
299
|
readonly code: 3015;
|
|
75
|
-
readonly message: "getStaticPaths() function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.";
|
|
300
|
+
readonly message: "`getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.";
|
|
76
301
|
readonly hint: "See https://docs.astro.build/en/core-concepts/routing/#dynamic-routes for more information on dynamic routes.\n\nAlternatively, set `output: \"server\"` in your Astro config file to switch to a non-static server build.\nSee https://docs.astro.build/en/guides/server-side-rendering/ for more information on non-static rendering.";
|
|
77
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* @docs
|
|
305
|
+
* @see
|
|
306
|
+
* - [Named slots](https://docs.astro.build/en/core-concepts/astro-components/#named-slots)
|
|
307
|
+
* @description
|
|
308
|
+
* Certain words cannot be used for slot names due to being already used internally.
|
|
309
|
+
*/
|
|
78
310
|
readonly ReservedSlotName: {
|
|
311
|
+
readonly title: "Invalid slot name.";
|
|
79
312
|
readonly code: 3016;
|
|
80
313
|
readonly message: (slotName: string) => string;
|
|
81
314
|
};
|
|
315
|
+
/**
|
|
316
|
+
* @docs
|
|
317
|
+
* @see
|
|
318
|
+
* - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
|
|
319
|
+
* - [Adding an Adapter](https://docs.astro.build/en/guides/server-side-rendering/#adding-an-adapter)
|
|
320
|
+
* @description
|
|
321
|
+
* To use server-side rendering, an adapter needs to be installed so Astro knows how to generate the proper output for your targetted deployment platform.
|
|
322
|
+
*/
|
|
82
323
|
readonly NoAdapterInstalled: {
|
|
324
|
+
readonly title: "Cannot use Server-side Rendering without an adapter.";
|
|
83
325
|
readonly code: 3017;
|
|
84
326
|
readonly message: "Cannot use `output: 'server'` without an adapter. Please install and configure the appropriate server adapter for your final deployment.";
|
|
85
327
|
readonly hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information.";
|
|
86
328
|
};
|
|
329
|
+
/**
|
|
330
|
+
* @docs
|
|
331
|
+
* @description
|
|
332
|
+
* 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.
|
|
333
|
+
*/
|
|
87
334
|
readonly NoMatchingImport: {
|
|
335
|
+
readonly title: "No import found for component.";
|
|
88
336
|
readonly code: 3018;
|
|
89
337
|
readonly message: (componentName: string) => string;
|
|
90
338
|
readonly hint: "Please make sure the component is properly imported.";
|
|
91
339
|
};
|
|
92
|
-
readonly UnknownCSSError: {
|
|
93
|
-
readonly code: 4000;
|
|
94
|
-
};
|
|
95
|
-
readonly CSSSyntaxError: {
|
|
96
|
-
readonly code: 4001;
|
|
97
|
-
};
|
|
98
340
|
readonly UnknownViteError: {
|
|
99
|
-
readonly
|
|
341
|
+
readonly title: "Unknown Vite Error.";
|
|
342
|
+
readonly code: 4000;
|
|
100
343
|
};
|
|
344
|
+
/**
|
|
345
|
+
* @docs
|
|
346
|
+
* @see
|
|
347
|
+
* - [Type Imports](https://docs.astro.build/en/guides/typescript/#type-imports)
|
|
348
|
+
* @description
|
|
349
|
+
* 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)
|
|
350
|
+
*
|
|
351
|
+
* 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).
|
|
352
|
+
*/
|
|
101
353
|
readonly FailedToLoadModuleSSR: {
|
|
102
|
-
readonly
|
|
354
|
+
readonly title: "Could not import file.";
|
|
355
|
+
readonly code: 4001;
|
|
103
356
|
readonly message: (importName: string) => string;
|
|
104
357
|
readonly hint: "This is often caused by a typo in the import path. Please make sure the file exists.";
|
|
105
358
|
};
|
|
359
|
+
/**
|
|
360
|
+
* @docs
|
|
361
|
+
* @see
|
|
362
|
+
* - [Glob Patterns](https://docs.astro.build/en/guides/imports/#glob-patterns)
|
|
363
|
+
* @description
|
|
364
|
+
* Astro encountered an invalid glob pattern. This is often caused by the glob pattern not being a valid file path.
|
|
365
|
+
*/
|
|
106
366
|
readonly InvalidGlob: {
|
|
107
|
-
readonly
|
|
367
|
+
readonly title: "Invalid glob pattern.";
|
|
368
|
+
readonly code: 4002;
|
|
108
369
|
readonly message: (globPattern: string) => string;
|
|
109
370
|
readonly hint: "See https://docs.astro.build/en/guides/imports/#glob-patterns for more information on supported glob patterns.";
|
|
110
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* @docs
|
|
374
|
+
* @kind heading
|
|
375
|
+
* @name CSS Errors
|
|
376
|
+
*/
|
|
377
|
+
readonly UnknownCSSError: {
|
|
378
|
+
readonly title: "Unknown CSS Error.";
|
|
379
|
+
readonly code: 5000;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* @docs
|
|
383
|
+
* @message
|
|
384
|
+
* **Example error messages:**<br/>
|
|
385
|
+
* CSSSyntaxError: Missed semicolon<br/>
|
|
386
|
+
* CSSSyntaxError: Unclosed string<br/>
|
|
387
|
+
* @description
|
|
388
|
+
* Astro encountered an error while parsing your CSS, due to a syntax error. This is often caused by a missing semicolon
|
|
389
|
+
*/
|
|
390
|
+
readonly CSSSyntaxError: {
|
|
391
|
+
readonly title: "CSS Syntax Error.";
|
|
392
|
+
readonly code: 5001;
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* @docs
|
|
396
|
+
* @kind heading
|
|
397
|
+
* @name Markdown Errors
|
|
398
|
+
*/
|
|
111
399
|
readonly UnknownMarkdownError: {
|
|
400
|
+
readonly title: "Unknown Markdown Error.";
|
|
112
401
|
readonly code: 6000;
|
|
113
402
|
};
|
|
403
|
+
/**
|
|
404
|
+
* @docs
|
|
405
|
+
* @message
|
|
406
|
+
* **Example error messages:**<br/>
|
|
407
|
+
* can not read an implicit mapping pair; a colon is missed<br/>
|
|
408
|
+
* unexpected end of the stream within a double quoted scalar<br/>
|
|
409
|
+
* can not read a block mapping entry; a multiline key may not be an implicit key
|
|
410
|
+
* @description
|
|
411
|
+
* Astro encountered an error while parsing the frontmatter of your Markdown file.
|
|
412
|
+
* This is often caused by a mistake in the syntax, such as a missing colon or a missing end quote.
|
|
413
|
+
*/
|
|
114
414
|
readonly MarkdownFrontmatterParseError: {
|
|
415
|
+
readonly title: "Failed to parse Markdown frontmatter.";
|
|
115
416
|
readonly code: 6001;
|
|
116
417
|
};
|
|
117
418
|
readonly UnknownConfigError: {
|
|
419
|
+
readonly title: "Unknown configuration error.";
|
|
118
420
|
readonly code: 7000;
|
|
119
421
|
};
|
|
422
|
+
/**
|
|
423
|
+
* @docs
|
|
424
|
+
* @see
|
|
425
|
+
* - [--config](https://docs.astro.build/en/reference/cli-reference/#--config-path)
|
|
426
|
+
* @description
|
|
427
|
+
* The specified configuration file using `--config` could not be found. Make sure that it exists or that the path is correct
|
|
428
|
+
*/
|
|
120
429
|
readonly ConfigNotFound: {
|
|
430
|
+
readonly title: "Specified configuration file not found.";
|
|
121
431
|
readonly code: 7001;
|
|
122
432
|
readonly message: (configFile: string) => string;
|
|
123
433
|
};
|
|
434
|
+
/**
|
|
435
|
+
* @docs
|
|
436
|
+
* @see
|
|
437
|
+
* - [Configuration reference](https://docs.astro.build/en/reference/configuration-reference/)
|
|
438
|
+
* - [Migration guide](https://docs.astro.build/en/migrate/)
|
|
439
|
+
* @description
|
|
440
|
+
* Astro detected a legacy configuration option in your configuration file.
|
|
441
|
+
*/
|
|
124
442
|
readonly ConfigLegacyKey: {
|
|
443
|
+
readonly title: "Legacy configuration detected.";
|
|
125
444
|
readonly code: 7002;
|
|
126
445
|
readonly message: (legacyConfigKey: string) => string;
|
|
127
|
-
readonly hint: "Please update your configuration to the new format
|
|
446
|
+
readonly hint: "Please update your configuration to the new format.\nSee https://astro.build/config for more information.";
|
|
128
447
|
};
|
|
129
448
|
readonly UnknownError: {
|
|
449
|
+
readonly title: "Unknown Error.";
|
|
130
450
|
readonly code: 99999;
|
|
131
451
|
};
|
|
132
452
|
};
|