astro 4.2.4 → 4.2.6
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/client.d.ts +1 -141
- package/dist/@types/astro.d.ts +256 -256
- package/dist/content/types-generator.js +8 -8
- package/dist/core/app/common.js +4 -0
- package/dist/core/app/index.d.ts +1 -1
- package/dist/core/app/index.js +9 -14
- package/dist/core/app/types.d.ts +3 -2
- package/dist/core/build/generate.d.ts +1 -9
- package/dist/core/build/generate.js +20 -15
- package/dist/core/build/page-data.js +4 -2
- package/dist/core/build/plugins/plugin-manifest.js +8 -11
- package/dist/core/build/plugins/plugin-pages.d.ts +0 -2
- package/dist/core/build/plugins/plugin-pages.js +1 -16
- package/dist/core/build/plugins/plugin-prerender.js +29 -0
- package/dist/core/build/plugins/plugin-ssr.js +38 -38
- package/dist/core/build/static-build.js +1 -1
- package/dist/core/build/types.d.ts +1 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +36 -1
- package/dist/core/errors/errors-data.js +13 -5
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/vite-plugin.js +6 -6
- package/dist/core/routing/manifest/create.js +4 -3
- package/dist/events/toolbar.d.ts +10 -0
- package/dist/events/toolbar.js +10 -0
- package/dist/i18n/index.d.ts +9 -6
- package/dist/i18n/index.js +11 -1
- package/dist/i18n/middleware.d.ts +1 -1
- package/dist/i18n/middleware.js +4 -10
- package/dist/i18n/vite-plugin-i18n.d.ts +3 -1
- package/dist/i18n/vite-plugin-i18n.js +29 -46
- package/dist/runtime/client/dev-toolbar/apps/audit/a11y.js +1 -29
- package/dist/runtime/client/dev-toolbar/toolbar.js +5 -0
- package/dist/runtime/server/consts.d.ts +1 -0
- package/dist/runtime/server/consts.js +4 -0
- package/dist/runtime/server/endpoint.js +2 -1
- package/dist/runtime/server/transition.js +2 -4
- package/dist/virtual-modules/i18n.d.ts +126 -1
- package/dist/virtual-modules/i18n.js +62 -1
- package/dist/vite-plugin-astro-server/plugin.js +4 -1
- package/dist/vite-plugin-astro-server/route.js +8 -13
- package/dist/vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js +24 -3
- package/dist/vite-plugin-env/index.js +8 -0
- package/package.json +3 -1
package/client.d.ts
CHANGED
|
@@ -149,147 +149,7 @@ declare module 'astro:prefetch' {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
declare module 'astro:i18n' {
|
|
152
|
-
export
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @param {string} locale A locale
|
|
156
|
-
* @param {string} [path=""] An optional path to add after the `locale`.
|
|
157
|
-
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
|
|
158
|
-
* @return {string}
|
|
159
|
-
*
|
|
160
|
-
* Returns a _relative_ path with passed locale.
|
|
161
|
-
*
|
|
162
|
-
* ## Errors
|
|
163
|
-
*
|
|
164
|
-
* Throws an error if the locale doesn't exist in the list of locales defined in the configuration.
|
|
165
|
-
*
|
|
166
|
-
* ## Examples
|
|
167
|
-
*
|
|
168
|
-
* ```js
|
|
169
|
-
* import { getRelativeLocaleUrl } from "astro:i18n";
|
|
170
|
-
* getRelativeLocaleUrl("es"); // /es
|
|
171
|
-
* getRelativeLocaleUrl("es", "getting-started"); // /es/getting-started
|
|
172
|
-
* getRelativeLocaleUrl("es_US", "getting-started", { prependWith: "blog" }); // /blog/es-us/getting-started
|
|
173
|
-
* getRelativeLocaleUrl("es_US", "getting-started", { prependWith: "blog", normalizeLocale: false }); // /blog/es_US/getting-started
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
export const getRelativeLocaleUrl: (
|
|
177
|
-
locale: string,
|
|
178
|
-
path?: string,
|
|
179
|
-
options?: GetLocaleOptions
|
|
180
|
-
) => string;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
184
|
-
* @param {string} locale A locale
|
|
185
|
-
* @param {string} [path=""] An optional path to add after the `locale`.
|
|
186
|
-
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
|
|
187
|
-
* @return {string}
|
|
188
|
-
*
|
|
189
|
-
* Returns an absolute path with the passed locale. The behaviour is subject to change based on `site` configuration.
|
|
190
|
-
* If _not_ provided, the function will return a _relative_ URL.
|
|
191
|
-
*
|
|
192
|
-
* ## Errors
|
|
193
|
-
*
|
|
194
|
-
* Throws an error if the locale doesn't exist in the list of locales defined in the configuration.
|
|
195
|
-
*
|
|
196
|
-
* ## Examples
|
|
197
|
-
*
|
|
198
|
-
* If `site` is `https://example.com`:
|
|
199
|
-
*
|
|
200
|
-
* ```js
|
|
201
|
-
* import { getAbsoluteLocaleUrl } from "astro:i18n";
|
|
202
|
-
* getAbsoluteLocaleUrl("es"); // https://example.com/es
|
|
203
|
-
* getAbsoluteLocaleUrl("es", "getting-started"); // https://example.com/es/getting-started
|
|
204
|
-
* getAbsoluteLocaleUrl("es_US", "getting-started", { prependWith: "blog" }); // https://example.com/blog/es-us/getting-started
|
|
205
|
-
* getAbsoluteLocaleUrl("es_US", "getting-started", { prependWith: "blog", normalizeLocale: false }); // https://example.com/blog/es_US/getting-started
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
export const getAbsoluteLocaleUrl: (
|
|
209
|
-
locale: string,
|
|
210
|
-
path?: string,
|
|
211
|
-
options?: GetLocaleOptions
|
|
212
|
-
) => string;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* @param {string} [path=""] An optional path to add after the `locale`.
|
|
216
|
-
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
|
|
217
|
-
* @return {string[]}
|
|
218
|
-
*
|
|
219
|
-
* Works like `getRelativeLocaleUrl` but it emits the relative URLs for ALL locales:
|
|
220
|
-
*/
|
|
221
|
-
export const getRelativeLocaleUrlList: (path?: string, options?: GetLocaleOptions) => string[];
|
|
222
|
-
/**
|
|
223
|
-
* @param {string} [path=""] An optional path to add after the `locale`.
|
|
224
|
-
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
|
|
225
|
-
* @return {string[]}
|
|
226
|
-
*
|
|
227
|
-
* Works like `getAbsoluteLocaleUrl` but it emits the absolute URLs for ALL locales:
|
|
228
|
-
*/
|
|
229
|
-
export const getAbsoluteLocaleUrlList: (path?: string, options?: GetLocaleOptions) => string[];
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* A function that return the `path` associated to a locale (defined as code). It's particularly useful in case you decide
|
|
233
|
-
* to use locales that are broken down in paths and codes.
|
|
234
|
-
*
|
|
235
|
-
* @param {string} code The code of the locale
|
|
236
|
-
* @returns {string} The path associated to the locale
|
|
237
|
-
*
|
|
238
|
-
* ## Example
|
|
239
|
-
*
|
|
240
|
-
* ```js
|
|
241
|
-
* // astro.config.mjs
|
|
242
|
-
*
|
|
243
|
-
* export default defineConfig({
|
|
244
|
-
* i18n: {
|
|
245
|
-
* locales: [
|
|
246
|
-
* { codes: ["it", "it-VT"], path: "italiano" },
|
|
247
|
-
* "es"
|
|
248
|
-
* ]
|
|
249
|
-
* }
|
|
250
|
-
* })
|
|
251
|
-
* ```
|
|
252
|
-
*
|
|
253
|
-
* ```js
|
|
254
|
-
* import { getPathByLocale } from "astro:i18n";
|
|
255
|
-
* getPathByLocale("it"); // returns "italiano"
|
|
256
|
-
* getPathByLocale("it-VT"); // returns "italiano"
|
|
257
|
-
* getPathByLocale("es"); // returns "es"
|
|
258
|
-
* ```
|
|
259
|
-
*/
|
|
260
|
-
export const getPathByLocale: (code: string) => string;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* A function that returns the preferred locale given a certain path. This is particularly useful if you configure a locale using
|
|
264
|
-
* `path` and `codes`. When you define multiple `code`, this function will return the first code of the array.
|
|
265
|
-
*
|
|
266
|
-
* Astro will treat the first code as the one that the user prefers.
|
|
267
|
-
*
|
|
268
|
-
* @param {string} path The path that maps to a locale
|
|
269
|
-
* @returns {string} The path associated to the locale
|
|
270
|
-
*
|
|
271
|
-
* ## Example
|
|
272
|
-
*
|
|
273
|
-
* ```js
|
|
274
|
-
* // astro.config.mjs
|
|
275
|
-
*
|
|
276
|
-
* export default defineConfig({
|
|
277
|
-
* i18n: {
|
|
278
|
-
* locales: [
|
|
279
|
-
* { codes: ["it-VT", "it"], path: "italiano" },
|
|
280
|
-
* "es"
|
|
281
|
-
* ]
|
|
282
|
-
* }
|
|
283
|
-
* })
|
|
284
|
-
* ```
|
|
285
|
-
*
|
|
286
|
-
* ```js
|
|
287
|
-
* import { getLocaleByPath } from "astro:i18n";
|
|
288
|
-
* getLocaleByPath("italiano"); // returns "it-VT" because that's the first code configured
|
|
289
|
-
* getLocaleByPath("es"); // returns "es"
|
|
290
|
-
* ```
|
|
291
|
-
*/
|
|
292
|
-
export const getLocaleByPath: (path: string) => string;
|
|
152
|
+
export * from 'astro/virtual-modules/i18n.js';
|
|
293
153
|
}
|
|
294
154
|
|
|
295
155
|
declare module 'astro:middleware' {
|