astro 4.6.0 → 4.6.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/dist/@types/astro.d.ts +1 -1
- package/dist/content/runtime.js +25 -21
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render-context.js +2 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +7 -2
- package/dist/i18n/middleware.js +0 -1
- package/package.json +1 -1
package/dist/@types/astro.d.ts
CHANGED
|
@@ -1725,7 +1725,7 @@ export interface AstroUserConfig {
|
|
|
1725
1725
|
* });
|
|
1726
1726
|
* ```
|
|
1727
1727
|
*
|
|
1728
|
-
* Both page routes built and URLs returned by the `astro:i18n` helper functions [`getAbsoluteLocaleUrl()`](https://docs.astro.build/en/
|
|
1728
|
+
* Both page routes built and URLs returned by the `astro:i18n` helper functions [`getAbsoluteLocaleUrl()`](https://docs.astro.build/en/reference/api-reference/#getabsolutelocaleurl) and [`getAbsoluteLocaleUrlList()`](https://docs.astro.build/en/reference/api-reference/#getabsolutelocaleurllist) will use the options set in `i18n.domains`.
|
|
1729
1729
|
*
|
|
1730
1730
|
* See the [Internationalization Guide](https://docs.astro.build/en/guides/internationalization/#domains-experimental) for more details, including the limitations of this experimental feature.
|
|
1731
1731
|
*/
|
package/dist/content/runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import pLimit from "p-limit";
|
|
1
2
|
import { ZodIssueCode, string as zodString } from "zod";
|
|
2
3
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
3
4
|
import { prependForwardSlash } from "../core/path.js";
|
|
@@ -58,28 +59,31 @@ function createGetCollection({
|
|
|
58
59
|
if (!import.meta.env?.DEV && cacheEntriesByCollection.has(collection)) {
|
|
59
60
|
entries = [...cacheEntriesByCollection.get(collection)];
|
|
60
61
|
} else {
|
|
62
|
+
const limit = pLimit(10);
|
|
61
63
|
entries = await Promise.all(
|
|
62
|
-
lazyImports.map(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
lazyImports.map(
|
|
65
|
+
(lazyImport) => limit(async () => {
|
|
66
|
+
const entry = await lazyImport();
|
|
67
|
+
return type === "content" ? {
|
|
68
|
+
id: entry.id,
|
|
69
|
+
slug: entry.slug,
|
|
70
|
+
body: entry.body,
|
|
71
|
+
collection: entry.collection,
|
|
72
|
+
data: entry.data,
|
|
73
|
+
async render() {
|
|
74
|
+
return render({
|
|
75
|
+
collection: entry.collection,
|
|
76
|
+
id: entry.id,
|
|
77
|
+
renderEntryImport: await getRenderEntryImport(collection, entry.slug)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
} : {
|
|
81
|
+
id: entry.id,
|
|
82
|
+
collection: entry.collection,
|
|
83
|
+
data: entry.data
|
|
84
|
+
};
|
|
85
|
+
})
|
|
86
|
+
)
|
|
83
87
|
);
|
|
84
88
|
cacheEntriesByCollection.set(collection, entries);
|
|
85
89
|
}
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.6.
|
|
26
|
+
const currentVersion = "4.6.1";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
|
@@ -340,7 +340,7 @@ const MissingIndexForInternationalization = {
|
|
|
340
340
|
const IncorrectStrategyForI18n = {
|
|
341
341
|
name: "IncorrectStrategyForI18n",
|
|
342
342
|
title: "You can't use the current function with the current strategy",
|
|
343
|
-
message: (functionName) => `The function \`${functionName}
|
|
343
|
+
message: (functionName) => `The function \`${functionName}\` can only be used when the \`i18n.routing.strategy\` is set to \`"manual"\`.`
|
|
344
344
|
};
|
|
345
345
|
const NoPrerenderedRoutesWithDomains = {
|
|
346
346
|
name: "NoPrerenderedRoutesWithDomains",
|
package/dist/core/messages.js
CHANGED
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.6.
|
|
39
|
+
const version = "4.6.1";
|
|
40
40
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
41
41
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
42
42
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -261,7 +261,7 @@ function printHelp({
|
|
|
261
261
|
message.push(
|
|
262
262
|
linebreak(),
|
|
263
263
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
264
|
-
`v${"4.6.
|
|
264
|
+
`v${"4.6.1"}`
|
|
265
265
|
)} ${headline}`
|
|
266
266
|
);
|
|
267
267
|
}
|
|
@@ -216,7 +216,8 @@ class RenderContext {
|
|
|
216
216
|
};
|
|
217
217
|
const slots = new Slots(result, slotValues, pipeline.logger);
|
|
218
218
|
const astroGlobalCombined = {
|
|
219
|
-
|
|
219
|
+
generator: astroGlobalPartial.generator,
|
|
220
|
+
glob: astroGlobalPartial.glob,
|
|
220
221
|
cookies,
|
|
221
222
|
get clientAddress() {
|
|
222
223
|
return renderContext.clientAddress();
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -95,6 +95,6 @@ export type MiddlewarePayload = {
|
|
|
95
95
|
export declare function redirectToDefaultLocale({ trailingSlash, format, base, defaultLocale, }: MiddlewarePayload): (context: APIContext, statusCode?: ValidRedirectStatus) => Response;
|
|
96
96
|
export declare function notFound({ base, locales }: MiddlewarePayload): (context: APIContext, response?: Response) => Response | undefined;
|
|
97
97
|
export type RedirectToFallback = (context: APIContext, response: Response) => Response;
|
|
98
|
-
export declare function redirectToFallback({ fallback, locales, defaultLocale, strategy, }: MiddlewarePayload): (context: APIContext, response: Response) => Response;
|
|
98
|
+
export declare function redirectToFallback({ fallback, locales, defaultLocale, strategy, base, }: MiddlewarePayload): (context: APIContext, response: Response) => Response;
|
|
99
99
|
export declare function createMiddleware(i18nManifest: SSRManifest['i18n'], base: SSRManifest['base'], trailingSlash: SSRManifest['trailingSlash'], format: SSRManifest['buildFormat']): import("../@types/astro.js").MiddlewareHandler;
|
|
100
100
|
export {};
|
package/dist/i18n/index.js
CHANGED
|
@@ -210,7 +210,8 @@ function redirectToFallback({
|
|
|
210
210
|
fallback,
|
|
211
211
|
locales,
|
|
212
212
|
defaultLocale,
|
|
213
|
-
strategy
|
|
213
|
+
strategy,
|
|
214
|
+
base
|
|
214
215
|
}) {
|
|
215
216
|
return function(context, response) {
|
|
216
217
|
if (response.status >= 300 && fallback) {
|
|
@@ -233,7 +234,11 @@ function redirectToFallback({
|
|
|
233
234
|
const pathFallbackLocale = getPathByLocale(fallbackLocale, locales);
|
|
234
235
|
let newPathname;
|
|
235
236
|
if (pathFallbackLocale === defaultLocale && strategy === "pathname-prefix-other-locales") {
|
|
236
|
-
|
|
237
|
+
if (context.url.pathname.includes(`${base}`)) {
|
|
238
|
+
newPathname = context.url.pathname.replace(`/${urlLocale}`, ``);
|
|
239
|
+
} else {
|
|
240
|
+
newPathname = context.url.pathname.replace(`/${urlLocale}`, `/`);
|
|
241
|
+
}
|
|
237
242
|
} else {
|
|
238
243
|
newPathname = context.url.pathname.replace(`/${urlLocale}`, `/${pathFallbackLocale}`);
|
|
239
244
|
}
|
package/dist/i18n/middleware.js
CHANGED