astro 5.5.5 → 5.5.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/dist/actions/runtime/utils.d.ts +8 -2
- package/dist/cli/add/index.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +1 -1
- package/dist/core/errors/errors-data.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render-context.js +5 -2
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +12 -0
- package/dist/i18n/utils.js +7 -11
- package/dist/types/public/context.d.ts +1 -1
- package/package.json +11 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { APIContext } from '../../types/public/context.js';
|
|
1
|
+
import type { APIContext, AstroSharedContext } from '../../types/public/context.js';
|
|
2
2
|
import type { SerializedActionResult } from './virtual/shared.js';
|
|
3
3
|
export type ActionPayload = {
|
|
4
4
|
actionResult: SerializedActionResult;
|
|
@@ -10,7 +10,13 @@ export type Locals = {
|
|
|
10
10
|
export declare const ACTION_API_CONTEXT_SYMBOL: unique symbol;
|
|
11
11
|
export declare const formContentTypes: string[];
|
|
12
12
|
export declare function hasContentType(contentType: string, expected: string[]): boolean;
|
|
13
|
-
export type ActionAPIContext =
|
|
13
|
+
export type ActionAPIContext = Pick<APIContext, 'rewrite' | 'request' | 'url' | 'isPrerendered' | 'locals' | 'clientAddress' | 'cookies' | 'currentLocale' | 'generator' | 'routePattern' | 'site' | 'params' | 'preferredLocale' | 'preferredLocaleList' | 'originPathname' | 'session'> & {
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* The use of `rewrite` in Actions is deprecated
|
|
17
|
+
*/
|
|
18
|
+
rewrite: AstroSharedContext['rewrite'];
|
|
19
|
+
};
|
|
14
20
|
export type MaybePromise<T> = T | Promise<T>;
|
|
15
21
|
/**
|
|
16
22
|
* Used to preserve the input schema type in the error object.
|
package/dist/cli/add/index.js
CHANGED
|
@@ -143,7 +143,7 @@ async function add(names, { flags }) {
|
|
|
143
143
|
logger.info(
|
|
144
144
|
"SKIP_FORMAT",
|
|
145
145
|
`
|
|
146
|
-
@
|
|
146
|
+
@tailwindcss/vite requires additional configuration. Please refer to https://docs.astro.build/en/guides/integrations-guide/tailwind/`
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
} else {
|
|
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
|
|
|
153
153
|
logger.info("Content config changed");
|
|
154
154
|
shouldClear = true;
|
|
155
155
|
}
|
|
156
|
-
if (previousAstroVersion && previousAstroVersion !== "5.5.
|
|
156
|
+
if (previousAstroVersion && previousAstroVersion !== "5.5.6") {
|
|
157
157
|
logger.info("Astro version changed");
|
|
158
158
|
shouldClear = true;
|
|
159
159
|
}
|
|
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
|
|
|
161
161
|
logger.info("Clearing content store");
|
|
162
162
|
this.#store.clearAll();
|
|
163
163
|
}
|
|
164
|
-
if ("5.5.
|
|
165
|
-
await this.#store.metaStore().set("astro-version", "5.5.
|
|
164
|
+
if ("5.5.6") {
|
|
165
|
+
await this.#store.metaStore().set("astro-version", "5.5.6");
|
|
166
166
|
}
|
|
167
167
|
if (currentConfigDigest) {
|
|
168
168
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "5.5.
|
|
25
|
+
const currentVersion = "5.5.6";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
|
@@ -16,7 +16,7 @@ const ClientAddressNotAvailable = {
|
|
|
16
16
|
const PrerenderClientAddressNotAvailable = {
|
|
17
17
|
name: "PrerenderClientAddressNotAvailable",
|
|
18
18
|
title: "`Astro.clientAddress` cannot be used inside prerendered routes.",
|
|
19
|
-
message: `\`Astro.clientAddress\` cannot be used inside prerendered
|
|
19
|
+
message: (name) => `\`Astro.clientAddress\` cannot be used inside prerendered route ${name}`
|
|
20
20
|
};
|
|
21
21
|
const StaticClientAddressNotAvailable = {
|
|
22
22
|
name: "StaticClientAddressNotAvailable",
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "5.5.
|
|
41
|
+
const version = "5.5.6";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -282,7 +282,7 @@ function printHelp({
|
|
|
282
282
|
message.push(
|
|
283
283
|
linebreak(),
|
|
284
284
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
285
|
-
`v${"5.5.
|
|
285
|
+
`v${"5.5.6"}`
|
|
286
286
|
)} ${headline}`
|
|
287
287
|
);
|
|
288
288
|
}
|
|
@@ -238,7 +238,7 @@ class RenderContext {
|
|
|
238
238
|
reroutePayload,
|
|
239
239
|
this.request
|
|
240
240
|
);
|
|
241
|
-
if (this.pipeline.serverLike
|
|
241
|
+
if (this.pipeline.serverLike && !this.routeData.prerender && routeData.prerender) {
|
|
242
242
|
throw new AstroError({
|
|
243
243
|
...ForbiddenRewrite,
|
|
244
244
|
message: ForbiddenRewrite.message(this.pathname, pathname, routeData.component),
|
|
@@ -463,7 +463,10 @@ class RenderContext {
|
|
|
463
463
|
getClientAddress() {
|
|
464
464
|
const { pipeline, request, routeData, clientAddress } = this;
|
|
465
465
|
if (routeData.prerender) {
|
|
466
|
-
throw new AstroError(
|
|
466
|
+
throw new AstroError({
|
|
467
|
+
...AstroErrorData.PrerenderClientAddressNotAvailable,
|
|
468
|
+
message: AstroErrorData.PrerenderClientAddressNotAvailable.message(routeData.component)
|
|
469
|
+
});
|
|
467
470
|
}
|
|
468
471
|
if (clientAddress) {
|
|
469
472
|
return clientAddress;
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ export declare function normalizeTheLocale(locale: string): string;
|
|
|
78
78
|
* Returns an array of only locales, by picking the `code`
|
|
79
79
|
* @param locales
|
|
80
80
|
*/
|
|
81
|
+
export declare function getAllCodes(locales: Locales): string[];
|
|
81
82
|
export declare function toCodes(locales: Locales): string[];
|
|
82
83
|
/**
|
|
83
84
|
* It returns the array of paths
|
package/dist/i18n/index.js
CHANGED
|
@@ -132,6 +132,17 @@ function getLocaleByPath(path, locales) {
|
|
|
132
132
|
function normalizeTheLocale(locale) {
|
|
133
133
|
return locale.replaceAll("_", "-").toLowerCase();
|
|
134
134
|
}
|
|
135
|
+
function getAllCodes(locales) {
|
|
136
|
+
const result = [];
|
|
137
|
+
for (const loopLocale of locales) {
|
|
138
|
+
if (typeof loopLocale === "string") {
|
|
139
|
+
result.push(loopLocale);
|
|
140
|
+
} else {
|
|
141
|
+
result.push(...loopLocale.codes);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
135
146
|
function toCodes(locales) {
|
|
136
147
|
return locales.map((loopLocale) => {
|
|
137
148
|
if (typeof loopLocale === "string") {
|
|
@@ -258,6 +269,7 @@ function createMiddleware(i18nManifest, base, trailingSlash, format) {
|
|
|
258
269
|
}
|
|
259
270
|
export {
|
|
260
271
|
createMiddleware,
|
|
272
|
+
getAllCodes,
|
|
261
273
|
getLocaleAbsoluteUrl,
|
|
262
274
|
getLocaleAbsoluteUrlList,
|
|
263
275
|
getLocaleByPath,
|
package/dist/i18n/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAllCodes, normalizeTheLocale } from "./index.js";
|
|
2
2
|
function parseLocale(header) {
|
|
3
3
|
if (header === "*") {
|
|
4
4
|
return [{ locale: header, qualityValue: void 0 }];
|
|
@@ -35,7 +35,7 @@ function parseLocale(header) {
|
|
|
35
35
|
return result;
|
|
36
36
|
}
|
|
37
37
|
function sortAndFilterLocales(browserLocaleList, locales) {
|
|
38
|
-
const normalizedLocales =
|
|
38
|
+
const normalizedLocales = getAllCodes(locales).map(normalizeTheLocale);
|
|
39
39
|
return browserLocaleList.filter((browserLocale) => {
|
|
40
40
|
if (browserLocale.locale !== "*") {
|
|
41
41
|
return normalizedLocales.includes(normalizeTheLocale(browserLocale.locale));
|
|
@@ -59,11 +59,13 @@ function computePreferredLocale(request, locales) {
|
|
|
59
59
|
if (typeof currentLocale === "string") {
|
|
60
60
|
if (normalizeTheLocale(currentLocale) === normalizeTheLocale(firstResult.locale)) {
|
|
61
61
|
result = currentLocale;
|
|
62
|
+
break;
|
|
62
63
|
}
|
|
63
64
|
} else {
|
|
64
65
|
for (const currentCode of currentLocale.codes) {
|
|
65
66
|
if (normalizeTheLocale(currentCode) === normalizeTheLocale(firstResult.locale)) {
|
|
66
|
-
result =
|
|
67
|
+
result = currentCode;
|
|
68
|
+
break;
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
@@ -78,13 +80,7 @@ function computePreferredLocaleList(request, locales) {
|
|
|
78
80
|
if (acceptHeader) {
|
|
79
81
|
const browserLocaleList = sortAndFilterLocales(parseLocale(acceptHeader), locales);
|
|
80
82
|
if (browserLocaleList.length === 1 && browserLocaleList.at(0).locale === "*") {
|
|
81
|
-
return locales
|
|
82
|
-
if (typeof locale === "string") {
|
|
83
|
-
return locale;
|
|
84
|
-
} else {
|
|
85
|
-
return locale.codes.at(0);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
83
|
+
return getAllCodes(locales);
|
|
88
84
|
} else if (browserLocaleList.length > 0) {
|
|
89
85
|
for (const browserLocale of browserLocaleList) {
|
|
90
86
|
for (const loopLocale of locales) {
|
|
@@ -95,7 +91,7 @@ function computePreferredLocaleList(request, locales) {
|
|
|
95
91
|
} else {
|
|
96
92
|
for (const code of loopLocale.codes) {
|
|
97
93
|
if (code === browserLocale.locale) {
|
|
98
|
-
result.push(
|
|
94
|
+
result.push(code);
|
|
99
95
|
}
|
|
100
96
|
}
|
|
101
97
|
}
|
|
@@ -229,7 +229,7 @@ export interface AstroGlobalPartial {
|
|
|
229
229
|
*/
|
|
230
230
|
generator: string;
|
|
231
231
|
}
|
|
232
|
-
interface AstroSharedContext<Props extends Record<string, any> = Record<string, any>, RouteParams extends Record<string, string | undefined> = Record<string, string | undefined>> {
|
|
232
|
+
export interface AstroSharedContext<Props extends Record<string, any> = Record<string, any>, RouteParams extends Record<string, string | undefined> = Record<string, string | undefined>> {
|
|
233
233
|
/**
|
|
234
234
|
* The address (usually IP address) of the user.
|
|
235
235
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.6",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -136,12 +136,12 @@
|
|
|
136
136
|
"neotraverse": "^0.6.18",
|
|
137
137
|
"p-limit": "^6.2.0",
|
|
138
138
|
"p-queue": "^8.1.0",
|
|
139
|
-
"package-manager-detector": "^1.
|
|
139
|
+
"package-manager-detector": "^1.1.0",
|
|
140
140
|
"picomatch": "^4.0.2",
|
|
141
141
|
"prompts": "^2.4.2",
|
|
142
142
|
"rehype": "^13.0.2",
|
|
143
143
|
"semver": "^7.7.1",
|
|
144
|
-
"shiki": "^3.
|
|
144
|
+
"shiki": "^3.2.1",
|
|
145
145
|
"tinyexec": "^0.3.2",
|
|
146
146
|
"tinyglobby": "^0.2.12",
|
|
147
147
|
"tsconfck": "^3.1.5",
|
|
@@ -149,13 +149,13 @@
|
|
|
149
149
|
"unist-util-visit": "^5.0.0",
|
|
150
150
|
"unstorage": "^1.15.0",
|
|
151
151
|
"vfile": "^6.0.3",
|
|
152
|
-
"vite": "^6.2.
|
|
152
|
+
"vite": "^6.2.4",
|
|
153
153
|
"vitefu": "^1.0.6",
|
|
154
154
|
"xxhash-wasm": "^1.1.0",
|
|
155
155
|
"yargs-parser": "^21.1.1",
|
|
156
156
|
"yocto-spinner": "^0.2.1",
|
|
157
157
|
"zod": "^3.24.2",
|
|
158
|
-
"zod-to-json-schema": "^3.24.
|
|
158
|
+
"zod-to-json-schema": "^3.24.5",
|
|
159
159
|
"zod-to-ts": "^1.2.0",
|
|
160
160
|
"@astrojs/internal-helpers": "0.6.1",
|
|
161
161
|
"@astrojs/markdown-remark": "6.3.1",
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
168
|
"@astrojs/check": "^0.9.4",
|
|
169
|
-
"@playwright/test": "^1.51.
|
|
169
|
+
"@playwright/test": "^1.51.1",
|
|
170
170
|
"@types/aria-query": "^5.0.4",
|
|
171
171
|
"@types/common-ancestor-path": "^1.0.2",
|
|
172
172
|
"@types/cssesc": "^3.0.2",
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"@types/js-yaml": "^4.0.9",
|
|
180
180
|
"@types/picomatch": "^3.0.2",
|
|
181
181
|
"@types/prompts": "^2.4.9",
|
|
182
|
-
"@types/semver": "^7.
|
|
182
|
+
"@types/semver": "^7.7.0",
|
|
183
183
|
"@types/yargs-parser": "^21.0.3",
|
|
184
184
|
"cheerio": "1.0.0",
|
|
185
185
|
"eol": "^0.10.0",
|
|
@@ -194,11 +194,11 @@
|
|
|
194
194
|
"rehype-slug": "^6.0.0",
|
|
195
195
|
"rehype-toc": "^3.0.2",
|
|
196
196
|
"remark-code-titles": "^0.1.2",
|
|
197
|
-
"rollup": "^4.
|
|
198
|
-
"sass": "^1.
|
|
199
|
-
"undici": "^7.
|
|
197
|
+
"rollup": "^4.37.0",
|
|
198
|
+
"sass": "^1.86.0",
|
|
199
|
+
"undici": "^7.5.0",
|
|
200
200
|
"unified": "^11.0.5",
|
|
201
|
-
"vitest": "^3.0.
|
|
201
|
+
"vitest": "^3.0.9",
|
|
202
202
|
"astro-scripts": "0.0.14"
|
|
203
203
|
},
|
|
204
204
|
"engines": {
|