astro 6.0.0-alpha.4 → 6.0.0-beta.0
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/dist/assets/build/generate.js +1 -1
- package/dist/assets/build/remote.js +1 -1
- package/dist/assets/endpoint/dev.js +44 -16
- package/dist/assets/fonts/config.d.ts +13 -0
- package/dist/assets/fonts/config.js +4 -2
- package/dist/assets/fonts/constants.js +2 -1
- package/dist/assets/fonts/core/resolve-families.js +1 -0
- package/dist/assets/fonts/definitions.d.ts +10 -2
- package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +2 -2
- package/dist/assets/fonts/infra/unifont-font-resolver.d.ts +24 -0
- package/dist/assets/fonts/infra/unifont-font-resolver.js +59 -0
- package/dist/assets/fonts/orchestrate.d.ts +6 -4
- package/dist/assets/fonts/orchestrate.js +16 -32
- package/dist/assets/fonts/providers/entrypoints/bunny.d.ts +1 -1
- package/dist/assets/fonts/providers/entrypoints/fontshare.d.ts +1 -1
- package/dist/assets/fonts/providers/entrypoints/fontsource.d.ts +1 -1
- package/dist/assets/fonts/providers/index.d.ts +6 -8
- package/dist/assets/fonts/providers/index.js +10 -14
- package/dist/assets/fonts/types.d.ts +17 -4
- package/dist/assets/fonts/vite-plugin-fonts.js +6 -1
- package/dist/assets/utils/vendor/image-size/detector.d.ts +1 -1
- package/dist/assets/utils/vendor/image-size/detector.js +2 -1
- package/dist/assets/utils/vendor/image-size/types/bmp.js +1 -1
- package/dist/assets/utils/vendor/image-size/types/gif.js +1 -1
- package/dist/assets/utils/vendor/image-size/types/heif.js +51 -29
- package/dist/assets/utils/vendor/image-size/types/icns.js +13 -14
- package/dist/assets/utils/vendor/image-size/types/ico.js +5 -5
- package/dist/assets/utils/vendor/image-size/types/index.d.ts +3 -3
- package/dist/assets/utils/vendor/image-size/types/index.js +4 -0
- package/dist/assets/utils/vendor/image-size/types/interface.d.ts +6 -6
- package/dist/assets/utils/vendor/image-size/types/j2c.js +2 -2
- package/dist/assets/utils/vendor/image-size/types/jp2.js +5 -3
- package/dist/assets/utils/vendor/image-size/types/jpg.js +4 -4
- package/dist/assets/utils/vendor/image-size/types/jxl-stream.d.ts +2 -0
- package/dist/assets/utils/vendor/image-size/types/jxl-stream.js +36 -0
- package/dist/assets/utils/vendor/image-size/types/jxl.d.ts +2 -0
- package/dist/assets/utils/vendor/image-size/types/jxl.js +57 -0
- package/dist/assets/utils/vendor/image-size/types/ktx.js +1 -1
- package/dist/assets/utils/vendor/image-size/types/png.js +1 -1
- package/dist/assets/utils/vendor/image-size/types/pnm.js +5 -7
- package/dist/assets/utils/vendor/image-size/types/psd.js +1 -1
- package/dist/assets/utils/vendor/image-size/types/tiff.js +93 -40
- package/dist/assets/utils/vendor/image-size/types/utils.d.ts +3 -2
- package/dist/assets/utils/vendor/image-size/types/utils.js +24 -22
- package/dist/assets/utils/vendor/image-size/types/webp.js +5 -6
- package/dist/assets/utils/vendor/image-size/utils/bit-reader.d.ts +10 -0
- package/dist/assets/utils/vendor/image-size/utils/bit-reader.js +41 -0
- package/dist/assets/vite-plugin-assets.js +7 -0
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/config/entrypoint.d.ts +1 -2
- package/dist/config/entrypoint.js +1 -2
- package/dist/config/index.js +1 -1
- package/dist/content/config.d.ts +25 -9
- package/dist/content/config.js +13 -17
- package/dist/content/content-layer.js +38 -21
- package/dist/content/loaders/glob.d.ts +4 -1
- package/dist/content/loaders/glob.js +36 -8
- package/dist/content/types-generator.js +10 -6
- package/dist/content/utils.d.ts +17 -1
- package/dist/content/utils.js +129 -8
- package/dist/content/vite-plugin-content-assets.d.ts +4 -5
- package/dist/content/vite-plugin-content-assets.js +3 -10
- package/dist/content/vite-plugin-content-imports.js +5 -1
- package/dist/content/vite-plugin-content-virtual-mod.js +10 -2
- package/dist/core/app/app.d.ts +1 -0
- package/dist/core/app/app.js +3 -0
- package/dist/core/app/base.d.ts +12 -0
- package/dist/core/app/base.js +18 -1
- package/dist/core/app/dev/app.d.ts +4 -1
- package/dist/core/app/dev/app.js +24 -3
- package/dist/core/build/app.d.ts +1 -0
- package/dist/core/build/app.js +3 -0
- package/dist/core/build/index.js +1 -1
- package/dist/core/build/plugins/plugin-manifest.d.ts +4 -6
- package/dist/core/build/plugins/plugin-manifest.js +14 -45
- package/dist/core/build/static-build.d.ts +10 -0
- package/dist/core/build/static-build.js +42 -34
- package/dist/core/config/schemas/base.d.ts +19 -2
- package/dist/core/config/schemas/base.js +6 -2
- package/dist/core/config/schemas/relative.d.ts +24 -3
- package/dist/core/config/settings.js +5 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/container.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/preview/index.js +1 -1
- package/dist/core/routing/dev.d.ts +14 -0
- package/dist/core/routing/dev.js +67 -0
- package/dist/core/routing/index.d.ts +0 -1
- package/dist/core/routing/index.js +0 -2
- package/dist/core/routing/manifest/create.js +9 -6
- package/dist/core/sync/index.js +11 -3
- package/dist/prerender/routing.d.ts +1 -1
- package/dist/prerender/routing.js +4 -4
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js +1 -0
- package/dist/runtime/server/jsx.js +18 -4
- package/dist/runtime/server/render/astro/render.js +26 -3
- package/dist/runtime/server/render/common.d.ts +1 -0
- package/dist/runtime/server/render/common.js +16 -0
- package/dist/runtime/server/render/component.js +28 -4
- package/dist/runtime/server/render/instruction.d.ts +6 -1
- package/dist/runtime/server/render/script.d.ts +5 -1
- package/dist/runtime/server/render/script.js +7 -10
- package/dist/runtime/server/render/slot.d.ts +5 -0
- package/dist/runtime/server/render/slot.js +9 -4
- package/dist/transitions/router.js +2 -0
- package/dist/types/public/config.d.ts +21 -3
- package/dist/types/public/context.d.ts +307 -291
- package/dist/vite-plugin-app/app.d.ts +3 -0
- package/dist/vite-plugin-app/app.js +30 -80
- package/dist/vite-plugin-app/pipeline.d.ts +0 -1
- package/dist/vite-plugin-app/pipeline.js +3 -12
- package/dist/vite-plugin-astro-server/base.js +3 -2
- package/dist/vite-plugin-astro-server/response.js +4 -6
- package/dist/vite-plugin-config-alias/index.js +3 -2
- package/dist/vite-plugin-pages/pages.js +17 -1
- package/dist/vite-plugin-routes/index.js +1 -1
- package/package.json +13 -13
- package/dist/assets/fonts/core/dedupe-font-faces.d.ts +0 -2
- package/dist/assets/fonts/core/dedupe-font-faces.js +0 -30
- package/dist/assets/fonts/core/extract-unifont-providers.d.ts +0 -10
- package/dist/assets/fonts/core/extract-unifont-providers.js +0 -28
|
@@ -3,181 +3,93 @@ import type { AstroCookies } from '../../core/cookies/cookies.js';
|
|
|
3
3
|
import type { CspDirective, CspHash } from '../../core/csp/config.js';
|
|
4
4
|
import type { AstroSession } from '../../core/session/runtime.js';
|
|
5
5
|
import type { AstroComponentFactory } from '../../runtime/server/index.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { RewritePayload } from './common.js';
|
|
7
7
|
import type { ValidRedirectStatus } from './config.js';
|
|
8
8
|
/**
|
|
9
9
|
* Astro global available in all contexts in .astro files
|
|
10
10
|
*
|
|
11
|
-
* [Astro reference](https://docs.astro.build/reference/api-reference
|
|
11
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/)
|
|
12
12
|
*/
|
|
13
|
-
export interface AstroGlobal<Props extends Record<string, any> = Record<string, any>, Self = AstroComponentFactory, Params extends Record<string, string | undefined> = Record<string, string | undefined>> extends
|
|
13
|
+
export interface AstroGlobal<Props extends Record<string, any> = Record<string, any>, Self = AstroComponentFactory, Params extends Record<string, string | undefined> = Record<string, string | undefined>> extends APIContext<Props, Params> {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* A standard [ResponseInit](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#init) object describing the outgoing response.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
site: URL | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Returns a string with the current version of Astro.
|
|
22
|
-
*
|
|
23
|
-
* Useful for using `<meta name="generator" content={Astro.generator} />` or crediting Astro in a site footer.
|
|
24
|
-
*
|
|
25
|
-
* [HTML Specification for `generator`](https://html.spec.whatwg.org/multipage/semantics.html#meta-generator)
|
|
26
|
-
*
|
|
27
|
-
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astrogenerator)
|
|
28
|
-
*/
|
|
29
|
-
generator: string;
|
|
30
|
-
/**
|
|
31
|
-
* A full URL object of the request URL.
|
|
32
|
-
* Equivalent to: `new URL(Astro.request.url)`
|
|
33
|
-
*
|
|
34
|
-
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#url)
|
|
35
|
-
*/
|
|
36
|
-
url: AstroSharedContext['url'];
|
|
37
|
-
/** Parameters passed to a dynamic page generated using [getStaticPaths](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
|
|
38
|
-
*
|
|
39
|
-
* Example usage:
|
|
40
|
-
* ```astro
|
|
41
|
-
* ---
|
|
42
|
-
* export async function getStaticPaths() {
|
|
43
|
-
* return [
|
|
44
|
-
* { params: { id: '1' } },
|
|
45
|
-
* ];
|
|
46
|
-
* }
|
|
47
|
-
*
|
|
48
|
-
* const { id } = Astro.params;
|
|
49
|
-
* ---
|
|
50
|
-
* <h1>{id}</h1>
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astroparams)
|
|
54
|
-
*/
|
|
55
|
-
params: AstroSharedContext<Props, Params>['params'];
|
|
56
|
-
/** List of props passed to this component
|
|
57
|
-
*
|
|
58
|
-
* A common way to get specific props is through [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment), ex:
|
|
59
|
-
* ```typescript
|
|
60
|
-
* const { name } = Astro.props
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* [Astro reference](https://docs.astro.build/en/basics/astro-components/#component-props)
|
|
64
|
-
*/
|
|
65
|
-
props: AstroSharedContext<Props, Params>['props'];
|
|
66
|
-
/** Information about the current request. This is a standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object
|
|
67
|
-
*
|
|
68
|
-
* For example, to get a URL object of the current URL, you can use:
|
|
69
|
-
* ```typescript
|
|
70
|
-
* const url = new URL(Astro.request.url);
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astrorequest)
|
|
74
|
-
*/
|
|
75
|
-
request: Request;
|
|
76
|
-
/** Information about the outgoing response. This is a standard [ResponseInit](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#init) object
|
|
17
|
+
* ## Example
|
|
77
18
|
*
|
|
78
|
-
*
|
|
19
|
+
* You can change the status code by assigning a value to this property:
|
|
79
20
|
* ```typescript
|
|
80
21
|
* Astro.response.status = 404;
|
|
81
22
|
* ```
|
|
82
23
|
*
|
|
83
|
-
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#
|
|
24
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#response)
|
|
84
25
|
*/
|
|
85
26
|
response: ResponseInit & {
|
|
86
27
|
readonly headers: Headers;
|
|
87
28
|
};
|
|
88
29
|
/**
|
|
89
|
-
*
|
|
90
|
-
* Expects the action function as a parameter.
|
|
91
|
-
* Returns a type-safe result with the action data when
|
|
92
|
-
* a matching POST request is received
|
|
93
|
-
* and `undefined` otherwise.
|
|
30
|
+
* Allows a component to be recursively called.
|
|
94
31
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* ```typescript
|
|
98
|
-
* import { actions } from 'astro:actions';
|
|
99
|
-
*
|
|
100
|
-
* const result = await Astro.getActionResult(actions.myAction);
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
getActionResult: AstroSharedContext['getActionResult'];
|
|
104
|
-
/**
|
|
105
|
-
* Call an Action directly from an Astro page or API endpoint.
|
|
106
|
-
* Expects the action function as the first parameter,
|
|
107
|
-
* and the type-safe action input as the second parameter.
|
|
108
|
-
* Returns a Promise with the action result.
|
|
109
|
-
*
|
|
110
|
-
* Example usage:
|
|
111
|
-
*
|
|
112
|
-
* ```typescript
|
|
113
|
-
* import { actions } from 'astro:actions';
|
|
114
|
-
*
|
|
115
|
-
* const result = await Astro.callAction(actions.getPost, { postId: 'test' });
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
callAction: AstroSharedContext['callAction'];
|
|
119
|
-
/** Redirect to another page
|
|
120
|
-
*
|
|
121
|
-
* Example usage:
|
|
122
|
-
* ```typescript
|
|
123
|
-
* if(!isLoggedIn) {
|
|
124
|
-
* return Astro.redirect('/login');
|
|
125
|
-
* }
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astroredirect)
|
|
129
|
-
*/
|
|
130
|
-
redirect: AstroSharedContext['redirect'];
|
|
131
|
-
/**
|
|
132
|
-
* It rewrites to another page. As opposed to redirects, the URL won't change, and Astro will render the HTML emitted
|
|
133
|
-
* by the rewritten URL passed as argument.
|
|
32
|
+
* This is useful when you need to render an Astro component from within
|
|
33
|
+
* itself. `Astro.self` accepts the same properties as the component itself.
|
|
134
34
|
*
|
|
135
35
|
* ## Example
|
|
136
36
|
*
|
|
137
|
-
* ```
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
37
|
+
* ```astro
|
|
38
|
+
* ---
|
|
39
|
+
* const { items } = Astro.props;
|
|
40
|
+
* ---
|
|
41
|
+
* <ul>
|
|
42
|
+
* {items.map((item) => (
|
|
43
|
+
* <li>
|
|
44
|
+
* {Array.isArray(item) ? (
|
|
45
|
+
* <Astro.self items={item} />
|
|
46
|
+
* ) : (
|
|
47
|
+
* item
|
|
48
|
+
* )}
|
|
49
|
+
* </li>
|
|
50
|
+
* ))}
|
|
51
|
+
* </ul>
|
|
141
52
|
* ```
|
|
142
|
-
*/
|
|
143
|
-
rewrite: AstroSharedContext['rewrite'];
|
|
144
|
-
/**
|
|
145
|
-
* The route currently rendered. It's stripped of the `srcDir` and the `pages` folder, and it doesn't contain the extension.
|
|
146
|
-
*
|
|
147
|
-
* ## Example
|
|
148
|
-
* - The value when rendering `src/pages/index.astro` will be `/`.
|
|
149
|
-
* - The value when rendering `src/pages/blog/[slug].astro` will be `/blog/[slug]`.
|
|
150
|
-
* - The value when rendering `src/pages/[...path].astro` will be `/[...path]`.
|
|
151
|
-
*/
|
|
152
|
-
routePattern: string;
|
|
153
|
-
/**
|
|
154
|
-
* The <Astro.self /> element allows a component to reference itself recursively.
|
|
155
53
|
*
|
|
156
|
-
* [Astro reference](https://docs.astro.build/en/reference/
|
|
54
|
+
* [Astro reference](https://docs.astro.build/en/reference/astro-syntax/#astroself)
|
|
157
55
|
*/
|
|
158
56
|
self: Self;
|
|
159
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* An object containing utility functions for modifying an Astro component’s
|
|
59
|
+
* slotted children.
|
|
160
60
|
*
|
|
161
|
-
* [Astro reference](https://docs.astro.build/en/reference/
|
|
61
|
+
* [Astro reference](https://docs.astro.build/en/reference/astro-syntax/#astroslots)
|
|
162
62
|
*/
|
|
163
63
|
slots: Record<string, true | undefined> & {
|
|
164
64
|
/**
|
|
165
65
|
* Check whether content for this slot name exists
|
|
166
66
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
67
|
+
* @param {string} slotName - The name of the slot to check.
|
|
68
|
+
* @returns {boolean} Whether the slot exists.
|
|
69
|
+
*
|
|
70
|
+
* ## Example
|
|
71
|
+
*
|
|
72
|
+
* ```astro
|
|
73
|
+
* ---
|
|
74
|
+
* ---
|
|
75
|
+
* <slot />
|
|
76
|
+
* {Astro.slots.has('more') && (
|
|
170
77
|
* // Do something...
|
|
171
|
-
*
|
|
78
|
+
* }
|
|
172
79
|
* ```
|
|
173
80
|
*
|
|
174
|
-
* [Astro reference](https://docs.astro.build/en/reference/
|
|
81
|
+
* [Astro reference](https://docs.astro.build/en/reference/astro-syntax/#astroslotshas)
|
|
175
82
|
*/
|
|
176
83
|
has(slotName: string): boolean;
|
|
177
84
|
/**
|
|
178
|
-
* Asynchronously renders
|
|
85
|
+
* Asynchronously renders the contents of a slot to a string of HTML.
|
|
86
|
+
*
|
|
87
|
+
* @param {string} slotName - The name of the slot to render.
|
|
88
|
+
* @param {any[]} [args] - The additional arguments to pass to the callback.
|
|
89
|
+
* @returns {Promise<string>} The rendered slot as HTML string.
|
|
90
|
+
*
|
|
91
|
+
* ## Examples
|
|
179
92
|
*
|
|
180
|
-
* Example usage:
|
|
181
93
|
* ```astro
|
|
182
94
|
* ---
|
|
183
95
|
* let html: string = '';
|
|
@@ -190,7 +102,6 @@ export interface AstroGlobal<Props extends Record<string, any> = Record<string,
|
|
|
190
102
|
*
|
|
191
103
|
* A second parameter can be used to pass arguments to a slotted callback
|
|
192
104
|
*
|
|
193
|
-
* Example usage:
|
|
194
105
|
* ```astro
|
|
195
106
|
* ---
|
|
196
107
|
* html = await Astro.slots.render('default', ["Hello", "World"])
|
|
@@ -203,181 +114,169 @@ export interface AstroGlobal<Props extends Record<string, any> = Record<string,
|
|
|
203
114
|
* </Component>
|
|
204
115
|
* ```
|
|
205
116
|
*
|
|
206
|
-
* [Astro reference](https://docs.astro.build/en/reference/
|
|
117
|
+
* [Astro reference](https://docs.astro.build/en/reference/astro-syntax/#astroslotsrender)
|
|
207
118
|
*/
|
|
208
119
|
render(slotName: string, args?: any[]): Promise<string>;
|
|
209
120
|
};
|
|
210
121
|
}
|
|
211
|
-
|
|
122
|
+
/**
|
|
123
|
+
* The `APIContext` is the object made available to endpoints and middleware.
|
|
124
|
+
* It is a subset of the `Astro` global object available in pages.
|
|
125
|
+
*
|
|
126
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/)
|
|
127
|
+
*/
|
|
128
|
+
export interface APIContext<Props extends Record<string, any> = Record<string, any>, Params extends Record<string, string | undefined> = Record<string, string | undefined>> {
|
|
212
129
|
/**
|
|
213
|
-
* The
|
|
130
|
+
* The site provided in the astro config, parsed as an instance of `URL`, without base.
|
|
131
|
+
* `undefined` if the site is not provided in the config.
|
|
214
132
|
*
|
|
215
|
-
*
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
*
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* Information about the current request. This is a standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object
|
|
228
|
-
*/
|
|
229
|
-
request: Request;
|
|
230
|
-
/**
|
|
231
|
-
* A full URL object of the request URL.
|
|
232
|
-
*/
|
|
233
|
-
url: URL;
|
|
234
|
-
/**
|
|
235
|
-
* The origin pathname of the request URL.
|
|
236
|
-
* Useful to track the original URL before rewrites were applied.
|
|
237
|
-
*/
|
|
238
|
-
originPathname: string;
|
|
239
|
-
/**
|
|
240
|
-
* Get action result on the server when using a form POST.
|
|
241
|
-
*/
|
|
242
|
-
getActionResult: <TAction extends ActionClient<any, any, any>>(action: TAction) => ActionReturnType<TAction> | undefined;
|
|
243
|
-
/**
|
|
244
|
-
* Call action handler from the server.
|
|
245
|
-
*/
|
|
246
|
-
callAction: <TAction extends ActionClient<any, any, any> | ActionClient<any, any, any>['orThrow']>(action: TAction, input: Parameters<TAction>[0]) => Promise<ActionReturnType<TAction>>;
|
|
247
|
-
/**
|
|
248
|
-
* Route parameters for this request if this is a dynamic route.
|
|
249
|
-
*/
|
|
250
|
-
params: RouteParams;
|
|
251
|
-
/**
|
|
252
|
-
* List of props returned for this path by `getStaticPaths` (**Static Only**).
|
|
133
|
+
* ## Example
|
|
134
|
+
*
|
|
135
|
+
* ```astro
|
|
136
|
+
* <link
|
|
137
|
+
* rel="alternate"
|
|
138
|
+
* type="application/rss+xml"
|
|
139
|
+
* title="Your Site's Title"
|
|
140
|
+
* href={new URL("rss.xml", Astro.site)}
|
|
141
|
+
* />
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#site)
|
|
253
145
|
*/
|
|
254
|
-
|
|
146
|
+
site: URL | undefined;
|
|
255
147
|
/**
|
|
256
|
-
*
|
|
148
|
+
* A human-readable string representing the Astro version used to create the project. It follows the format "Astro v5.x.x".
|
|
149
|
+
*
|
|
150
|
+
* ## Example
|
|
151
|
+
*
|
|
152
|
+
* ```astro
|
|
153
|
+
* <meta name="generator" content={Astro.generator} />
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#generator)
|
|
257
157
|
*/
|
|
258
|
-
|
|
158
|
+
generator: string;
|
|
259
159
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
160
|
+
* The address (usually IP address) of the user.
|
|
161
|
+
*
|
|
162
|
+
* Throws an error if used within a static site, or within a prerendered page.
|
|
262
163
|
*
|
|
263
164
|
* ## Example
|
|
264
165
|
*
|
|
265
|
-
* ```
|
|
266
|
-
*
|
|
267
|
-
*
|
|
166
|
+
* ```ts
|
|
167
|
+
* import type { APIContext } from 'astro';
|
|
168
|
+
*
|
|
169
|
+
* export function GET({ clientAddress }: APIContext) {
|
|
170
|
+
* return new Response(`Your IP address is: ${clientAddress}`);
|
|
268
171
|
* }
|
|
269
172
|
* ```
|
|
173
|
+
*
|
|
174
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
270
175
|
*/
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Object accessed via Astro middleware
|
|
274
|
-
*/
|
|
275
|
-
locals: App.Locals;
|
|
276
|
-
/**
|
|
277
|
-
* The current locale that is computed from the `Accept-Language` header of the browser (**SSR Only**).
|
|
278
|
-
*/
|
|
279
|
-
preferredLocale: string | undefined;
|
|
280
|
-
/**
|
|
281
|
-
* The list of locales computed from the `Accept-Language` header of the browser, sorted by quality value (**SSR Only**).
|
|
282
|
-
*/
|
|
283
|
-
preferredLocaleList: string[] | undefined;
|
|
284
|
-
/**
|
|
285
|
-
* The current locale computed from the URL of the request. It matches the locales in `i18n.locales`, and returns `undefined` otherwise.
|
|
286
|
-
*/
|
|
287
|
-
currentLocale: string | undefined;
|
|
176
|
+
clientAddress: string;
|
|
288
177
|
/**
|
|
289
|
-
*
|
|
178
|
+
* An object containing utilities for reading and manipulating the values of cookies in on-demand routes.
|
|
179
|
+
*
|
|
180
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#cookies)
|
|
290
181
|
*/
|
|
291
|
-
|
|
182
|
+
cookies: AstroCookies;
|
|
292
183
|
/**
|
|
293
|
-
*
|
|
184
|
+
* An object containing utilities for handling sessions in on-demand rendered routes.
|
|
185
|
+
*
|
|
186
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#session)
|
|
294
187
|
*/
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
export type AstroSharedContextCsp = {
|
|
188
|
+
session?: AstroSession;
|
|
298
189
|
/**
|
|
299
|
-
*
|
|
190
|
+
* A standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object containing information about the current request.
|
|
300
191
|
*
|
|
301
192
|
* ## Example
|
|
302
193
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
194
|
+
* To get a URL object of the current URL, you can use:
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const url = new URL(Astro.request.url);
|
|
305
197
|
* ```
|
|
198
|
+
*
|
|
199
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#request)
|
|
306
200
|
*/
|
|
307
|
-
|
|
201
|
+
request: Request;
|
|
308
202
|
/**
|
|
309
|
-
*
|
|
203
|
+
* A URL object constructed from the current `request.url` value. This is
|
|
204
|
+
* equivalent to doing `new URL(context.request.url)`.
|
|
310
205
|
*
|
|
311
206
|
* ## Example
|
|
312
207
|
*
|
|
313
|
-
* ```
|
|
314
|
-
*
|
|
208
|
+
* ```astro
|
|
209
|
+
* <p>The current URL is: {Astro.url}</p>
|
|
210
|
+
* <p>The current URL pathname is: {Astro.url.pathname}</p>
|
|
211
|
+
* <p>The current URL origin is: {Astro.url.origin}</p>
|
|
315
212
|
* ```
|
|
213
|
+
*
|
|
214
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#url)
|
|
316
215
|
*/
|
|
317
|
-
|
|
216
|
+
url: URL;
|
|
318
217
|
/**
|
|
319
|
-
*
|
|
218
|
+
* The origin pathname of the request URL.
|
|
219
|
+
* Useful to track the original URL before rewrites were applied.
|
|
320
220
|
*
|
|
321
221
|
* ## Example
|
|
322
222
|
*
|
|
323
|
-
* ```
|
|
324
|
-
*
|
|
223
|
+
* ```astro
|
|
224
|
+
* <p>The origin path is {Astro.originPathname}</p>
|
|
225
|
+
* <p>The rewritten path is {Astro.url.pathname}</p>
|
|
325
226
|
* ```
|
|
227
|
+
*
|
|
228
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#originpathname)
|
|
326
229
|
*/
|
|
327
|
-
|
|
230
|
+
originPathname: string;
|
|
328
231
|
/**
|
|
329
|
-
*
|
|
232
|
+
* A function that returns the result of an Action submission when using a form POST.
|
|
233
|
+
*
|
|
234
|
+
* This accepts an action function as an argument and returns a type-safe
|
|
235
|
+
* data or error object when a submission is received. Otherwise, it will
|
|
236
|
+
* return undefined.
|
|
237
|
+
*
|
|
238
|
+
* @param {TAction} action - The action function to process.
|
|
239
|
+
* @returns {ActionReturnType<TAction> | undefined} An object describing the result of an action.
|
|
330
240
|
*
|
|
331
241
|
* ## Example
|
|
332
242
|
*
|
|
333
|
-
* ```
|
|
334
|
-
*
|
|
243
|
+
* ```astro
|
|
244
|
+
* import { actions } from 'astro:actions';
|
|
245
|
+
*
|
|
246
|
+
* const result = await Astro.getActionResult(actions.myAction);
|
|
335
247
|
* ```
|
|
248
|
+
*
|
|
249
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#getactionresult)
|
|
336
250
|
*/
|
|
337
|
-
|
|
251
|
+
getActionResult: <TAction extends ActionClient<any, any, any>>(action: TAction) => ActionReturnType<TAction> | undefined;
|
|
338
252
|
/**
|
|
339
|
-
*
|
|
253
|
+
* A function used to call an Action handler directly from your Astro
|
|
254
|
+
* component or API endpoint.
|
|
255
|
+
*
|
|
256
|
+
* This accepts an Action function and a type-safe action input, and returns
|
|
257
|
+
* the result of the action as a Promise.
|
|
340
258
|
*
|
|
341
259
|
* ## Example
|
|
342
260
|
*
|
|
343
|
-
* ```
|
|
344
|
-
*
|
|
345
|
-
* ```
|
|
346
|
-
*/
|
|
347
|
-
insertScriptHash: (hash: CspHash) => void;
|
|
348
|
-
};
|
|
349
|
-
/**
|
|
350
|
-
* The `APIContext` is the object made available to endpoints and middleware.
|
|
351
|
-
* It is a subset of the `Astro` global object available in pages.
|
|
352
|
-
*
|
|
353
|
-
* [Reference](https://docs.astro.build/en/reference/api-reference/#endpoint-context)
|
|
354
|
-
*/
|
|
355
|
-
export interface APIContext<Props extends Record<string, any> = Record<string, any>, APIParams extends Record<string, string | undefined> = Record<string, string | undefined>> extends AstroSharedContext<Props, Params> {
|
|
356
|
-
/**
|
|
357
|
-
* The site provided in the astro config, parsed as an instance of `URL`, without base.
|
|
358
|
-
* `undefined` if the site is not provided in the config.
|
|
359
|
-
*/
|
|
360
|
-
site: URL | undefined;
|
|
361
|
-
/**
|
|
362
|
-
* A human-readable string representing the Astro version used to create the project.
|
|
363
|
-
* For example, `"Astro v1.1.1"`.
|
|
364
|
-
*/
|
|
365
|
-
generator: string;
|
|
366
|
-
/**
|
|
367
|
-
* The url of the current request, parsed as an instance of `URL`.
|
|
261
|
+
* ```typescript
|
|
262
|
+
* import { actions } from 'astro:actions';
|
|
368
263
|
*
|
|
369
|
-
*
|
|
370
|
-
* ```ts
|
|
371
|
-
* new URL(context.request.url)
|
|
264
|
+
* const result = await Astro.callAction(actions.getPost, { postId: 'test' });
|
|
372
265
|
* ```
|
|
266
|
+
*
|
|
267
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#callaction)
|
|
268
|
+
*
|
|
269
|
+
* @param {TAction} action - Any Action function.
|
|
270
|
+
* @param {Parameters<TAction>[0]} input - Any input that the given action receives.
|
|
373
271
|
*/
|
|
374
|
-
|
|
272
|
+
callAction: <TAction extends ActionClient<any, any, any> | ActionClient<any, any, any>['orThrow']>(action: TAction, input: Parameters<TAction>[0]) => Promise<ActionReturnType<TAction>>;
|
|
375
273
|
/**
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* In
|
|
274
|
+
* An object containing the values of dynamic route segments matched for a request.
|
|
275
|
+
*
|
|
276
|
+
* In static builds, this will be the `params` returned by [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths). With on-demand rendering, `params` can be any value matching the path segments in the dynamic route pattern.
|
|
277
|
+
*
|
|
278
|
+
* ## Example
|
|
379
279
|
*
|
|
380
|
-
* Example usage:
|
|
381
280
|
* ```ts
|
|
382
281
|
* import type { APIContext } from "astro"
|
|
383
282
|
*
|
|
@@ -389,18 +288,19 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
|
|
|
389
288
|
* ];
|
|
390
289
|
* }
|
|
391
290
|
*
|
|
392
|
-
* export
|
|
393
|
-
* return new Response(`
|
|
291
|
+
* export function GET({ params }: APIContext): Response {
|
|
292
|
+
* return new Response(`The current id is ${params.id}.`);
|
|
394
293
|
* }
|
|
395
294
|
* ```
|
|
396
295
|
*
|
|
397
|
-
* [
|
|
296
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#params)
|
|
398
297
|
*/
|
|
399
|
-
params:
|
|
298
|
+
params: Params;
|
|
400
299
|
/**
|
|
401
|
-
*
|
|
300
|
+
* An object containing any values that have been passed as component attributes. In static builds, this can also be the `props` returned by [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths).
|
|
301
|
+
*
|
|
302
|
+
* ## Example
|
|
402
303
|
*
|
|
403
|
-
* Example usage:
|
|
404
304
|
* ```ts
|
|
405
305
|
* import type { APIContext } from "astro"
|
|
406
306
|
*
|
|
@@ -417,13 +317,20 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
|
|
|
417
317
|
* }
|
|
418
318
|
* ```
|
|
419
319
|
*
|
|
420
|
-
* [
|
|
320
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#props)
|
|
421
321
|
*/
|
|
422
|
-
props:
|
|
322
|
+
props: Props;
|
|
423
323
|
/**
|
|
424
324
|
* Create a response that redirects to another page.
|
|
425
325
|
*
|
|
426
|
-
*
|
|
326
|
+
* This accepts a custom status code when redirecting for on-demand rendered routes only.
|
|
327
|
+
*
|
|
328
|
+
* @param {string} path - The path to redirect to.
|
|
329
|
+
* @param {ValidRedirectStatus} [status] - An optional HTTP status code.
|
|
330
|
+
* @returns {Response} A Response object describing the redirection.
|
|
331
|
+
*
|
|
332
|
+
* ## Example
|
|
333
|
+
*
|
|
427
334
|
* ```ts
|
|
428
335
|
* // src/pages/secret.ts
|
|
429
336
|
* export function GET({ redirect }) {
|
|
@@ -431,12 +338,18 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
|
|
|
431
338
|
* }
|
|
432
339
|
* ```
|
|
433
340
|
*
|
|
434
|
-
* [
|
|
341
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#redirect)
|
|
435
342
|
*/
|
|
436
|
-
redirect:
|
|
343
|
+
redirect: (path: string, status?: ValidRedirectStatus) => Response;
|
|
437
344
|
/**
|
|
438
|
-
*
|
|
439
|
-
*
|
|
345
|
+
* Allows you to serve content from a different URL or path without
|
|
346
|
+
* redirecting the browser to a new page.
|
|
347
|
+
*
|
|
348
|
+
* As opposed to redirects, the URL won't change, and Astro will render the
|
|
349
|
+
* HTML emitted by the rerouted URL passed as argument.
|
|
350
|
+
*
|
|
351
|
+
* @param {RewritePayload} rewritePayload - The location of the path.
|
|
352
|
+
* @returns {Promise<Response>} A Response object describing the rewrite.
|
|
440
353
|
*
|
|
441
354
|
* ## Example
|
|
442
355
|
*
|
|
@@ -446,14 +359,16 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
|
|
|
446
359
|
* return ctx.rewrite(new URL("../"), ctx.url);
|
|
447
360
|
* }
|
|
448
361
|
* ```
|
|
362
|
+
*
|
|
363
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#rewrite)
|
|
449
364
|
*/
|
|
450
|
-
rewrite:
|
|
365
|
+
rewrite: (rewritePayload: RewritePayload) => Promise<Response>;
|
|
451
366
|
/**
|
|
452
367
|
* An object that middlewares can use to store extra information related to the request.
|
|
453
368
|
*
|
|
454
369
|
* It will be made available to pages as `Astro.locals`, and to endpoints as `context.locals`.
|
|
455
370
|
*
|
|
456
|
-
* Example
|
|
371
|
+
* ## Example
|
|
457
372
|
*
|
|
458
373
|
* ```ts
|
|
459
374
|
* // src/middleware.ts
|
|
@@ -464,7 +379,7 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
|
|
|
464
379
|
* return next();
|
|
465
380
|
* });
|
|
466
381
|
* ```
|
|
467
|
-
*
|
|
382
|
+
* You can then access the value inside a `.astro` file:
|
|
468
383
|
* ```astro
|
|
469
384
|
* ---
|
|
470
385
|
* // src/pages/index.astro
|
|
@@ -473,47 +388,148 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
|
|
|
473
388
|
* <h1>{greeting}</h1>
|
|
474
389
|
* ```
|
|
475
390
|
*
|
|
476
|
-
* [
|
|
391
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#locals)
|
|
477
392
|
*/
|
|
478
393
|
locals: App.Locals;
|
|
479
394
|
/**
|
|
480
|
-
*
|
|
395
|
+
* A computed value to find the best match between your visitor’s browser
|
|
396
|
+
* language preferences and the locales supported by your site.
|
|
481
397
|
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
398
|
+
* This property is only available for routes rendered on demand and cannot
|
|
399
|
+
* be used on prerendered, static pages.
|
|
484
400
|
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
401
|
+
* The preferred locale of the user is computed by checking the supported
|
|
402
|
+
* locales in `i18n.locales` and locales supported by the users's browser via
|
|
403
|
+
* the header `Accept-Language`.
|
|
487
404
|
*
|
|
488
|
-
*
|
|
405
|
+
* ## Example
|
|
406
|
+
*
|
|
407
|
+
* Given `i18n.locales` equals to `['fr', 'de']`, and the `Accept-Language` value equals to `en, de;q=0.2, fr;q=0.6`, the
|
|
408
|
+
* `Astro.preferredLanguage` will be `fr` because `en` is not supported, its [quality value](https://developer.mozilla.org/en-US/docs/Glossary/Quality_values) is the highest.
|
|
409
|
+
*
|
|
410
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#preferredlocale)
|
|
489
411
|
*/
|
|
490
412
|
preferredLocale: string | undefined;
|
|
491
413
|
/**
|
|
492
|
-
*
|
|
414
|
+
* Represents the list of all locales, sorted via [quality value](https://developer.mozilla.org/en-US/docs/Glossary/Quality_values), that are both
|
|
415
|
+
* requested by the browser and supported by your website.
|
|
493
416
|
*
|
|
494
|
-
*
|
|
417
|
+
* This property is only available for routes rendered on demand and cannot
|
|
418
|
+
* be used on prerendered, static pages.
|
|
495
419
|
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
* header.
|
|
420
|
+
* When the `Accept-Header` is `*`, the original `i18n.locales` are returned.
|
|
421
|
+
* The value `*` means no preferences, so Astro returns all the supported locales.
|
|
499
422
|
*
|
|
500
|
-
*
|
|
423
|
+
* ## Example
|
|
424
|
+
*
|
|
425
|
+
* Given `i18n.locales` equals to `['fr', 'pt', 'de']`, and the
|
|
426
|
+
* `Accept-Language` value equals to `en, de;q=0.2, fr;q=0.6`, the
|
|
427
|
+
* `Astro.preferredLocaleList` will be equal to `['fs', 'de']` because `en`
|
|
428
|
+
* isn't supported, and `pt` isn't part of the locales contained in the
|
|
429
|
+
* header.
|
|
501
430
|
*
|
|
502
|
-
* [
|
|
431
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#preferredlocalelist)
|
|
503
432
|
*/
|
|
504
433
|
preferredLocaleList: string[] | undefined;
|
|
505
434
|
/**
|
|
506
435
|
* The current locale computed from the URL of the request. It matches the locales in `i18n.locales`, and returns `undefined` otherwise.
|
|
436
|
+
*
|
|
437
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#currentlocale)
|
|
507
438
|
*/
|
|
508
439
|
currentLocale: string | undefined;
|
|
440
|
+
/**
|
|
441
|
+
* Whether the current route is prerendered or not.
|
|
442
|
+
*
|
|
443
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#isprerendered)
|
|
444
|
+
*/
|
|
445
|
+
isPrerendered: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* It exposes utilities to control CSP headers
|
|
448
|
+
*
|
|
449
|
+
* [Astro reference](https://docs.astro.build/en/reference/experimental-flags/csp/)
|
|
450
|
+
*/
|
|
451
|
+
csp: {
|
|
452
|
+
/**
|
|
453
|
+
* It adds a specific CSP directive to the route being rendered.
|
|
454
|
+
*
|
|
455
|
+
* @param {CspDirective} directive - The directive to add to the current page.
|
|
456
|
+
*
|
|
457
|
+
* ## Example
|
|
458
|
+
*
|
|
459
|
+
* ```js
|
|
460
|
+
* ctx.insertDirective("default-src 'self' 'unsafe-inline' https://example.com")
|
|
461
|
+
* ```
|
|
462
|
+
*
|
|
463
|
+
* [Astro reference](https://docs.astro.build/en/reference/experimental-flags/csp/#cspinsertdirective)
|
|
464
|
+
*/
|
|
465
|
+
insertDirective: (directive: CspDirective) => void;
|
|
466
|
+
/**
|
|
467
|
+
* It set the resource for the directive `style-src` in the route being rendered. It overrides Astro's default.
|
|
468
|
+
*
|
|
469
|
+
* @param {string} payload - The source to insert in the `style-src` directive.
|
|
470
|
+
*
|
|
471
|
+
* ## Example
|
|
472
|
+
*
|
|
473
|
+
* ```js
|
|
474
|
+
* ctx.insertStyleResource("https://styles.cdn.example.com/")
|
|
475
|
+
* ```
|
|
476
|
+
*
|
|
477
|
+
* [Astro reference](https://docs.astro.build/en/reference/experimental-flags/csp/#cspinsertstyleresource)
|
|
478
|
+
*/
|
|
479
|
+
insertStyleResource: (payload: string) => void;
|
|
480
|
+
/**
|
|
481
|
+
* Insert a single style hash to the route being rendered.
|
|
482
|
+
*
|
|
483
|
+
* @param {CspHash} hash - The hash to insert in the `style-src` directive.
|
|
484
|
+
*
|
|
485
|
+
* ## Example
|
|
486
|
+
*
|
|
487
|
+
* ```js
|
|
488
|
+
* ctx.insertStyleHash("sha256-1234567890abcdef1234567890")
|
|
489
|
+
* ```
|
|
490
|
+
*
|
|
491
|
+
* [Astro reference](https://docs.astro.build/en/reference/experimental-flags/csp/#cspinsertstylehash)
|
|
492
|
+
*/
|
|
493
|
+
insertStyleHash: (hash: CspHash) => void;
|
|
494
|
+
/**
|
|
495
|
+
* It set the resource for the directive `script-src` in the route being rendered.
|
|
496
|
+
*
|
|
497
|
+
* @param {string} resource - The source to insert in the `script-src` directive.
|
|
498
|
+
*
|
|
499
|
+
* ## Example
|
|
500
|
+
*
|
|
501
|
+
* ```js
|
|
502
|
+
* ctx.insertScriptResource("https://scripts.cdn.example.com/")
|
|
503
|
+
* ```
|
|
504
|
+
*
|
|
505
|
+
* [Astro reference](https://docs.astro.build/en/reference/experimental-flags/csp/#cspinsertscriptresource)
|
|
506
|
+
*/
|
|
507
|
+
insertScriptResource: (resource: string) => void;
|
|
508
|
+
/**
|
|
509
|
+
* Insert a single script hash to the route being rendered.
|
|
510
|
+
*
|
|
511
|
+
* @param {CspHash} hash - The hash to insert in the `script-src` directive.
|
|
512
|
+
*
|
|
513
|
+
* ## Example
|
|
514
|
+
*
|
|
515
|
+
* ```js
|
|
516
|
+
* ctx.insertScriptHash("sha256-1234567890abcdef1234567890")
|
|
517
|
+
* ```
|
|
518
|
+
*
|
|
519
|
+
* [Astro reference](https://docs.astro.build/en/reference/experimental-flags/csp/#cspinsertscripthash)
|
|
520
|
+
*/
|
|
521
|
+
insertScriptHash: (hash: CspHash) => void;
|
|
522
|
+
};
|
|
509
523
|
/**
|
|
510
524
|
* The route currently rendered. It's stripped of the `srcDir` and the `pages` folder, and it doesn't contain the extension.
|
|
511
525
|
*
|
|
512
526
|
* ## Example
|
|
527
|
+
*
|
|
513
528
|
* - The value when rendering `src/pages/index.astro` will be `/`.
|
|
514
529
|
* - The value when rendering `src/pages/blog/[slug].astro` will be `/blog/[slug]`.
|
|
515
530
|
* - The value when rendering `src/pages/[...path].astro` will be `/[...path]`.
|
|
531
|
+
*
|
|
532
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#routepattern)
|
|
516
533
|
*/
|
|
517
534
|
routePattern: string;
|
|
518
535
|
}
|
|
519
|
-
export {};
|