astro 4.4.11 → 4.4.12
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/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.4.
|
|
26
|
+
const currentVersion = "4.4.12";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.4.
|
|
39
|
+
const version = "4.4.12";
|
|
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.4.
|
|
264
|
+
`v${"4.4.12"}`
|
|
265
265
|
)} ${headline}`
|
|
266
266
|
);
|
|
267
267
|
}
|
|
@@ -29,9 +29,15 @@ async function renderSlotToString(result, slotted, fallback) {
|
|
|
29
29
|
let instructions = null;
|
|
30
30
|
const temporaryDestination = {
|
|
31
31
|
write(chunk) {
|
|
32
|
-
if (chunk instanceof
|
|
32
|
+
if (chunk instanceof SlotString) {
|
|
33
|
+
content += chunk;
|
|
34
|
+
if (chunk.instructions) {
|
|
35
|
+
instructions ??= [];
|
|
36
|
+
instructions.push(...chunk.instructions);
|
|
37
|
+
}
|
|
38
|
+
} else if (chunk instanceof Response)
|
|
33
39
|
return;
|
|
34
|
-
if (typeof chunk === "object" && "type" in chunk && typeof chunk.type === "string") {
|
|
40
|
+
else if (typeof chunk === "object" && "type" in chunk && typeof chunk.type === "string") {
|
|
35
41
|
if (instructions === null) {
|
|
36
42
|
instructions = [];
|
|
37
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.12",
|
|
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",
|
|
@@ -164,8 +164,8 @@
|
|
|
164
164
|
"yargs-parser": "^21.1.1",
|
|
165
165
|
"zod": "^3.22.4",
|
|
166
166
|
"@astrojs/internal-helpers": "0.2.1",
|
|
167
|
-
"@astrojs/
|
|
168
|
-
"@astrojs/
|
|
167
|
+
"@astrojs/markdown-remark": "4.2.1",
|
|
168
|
+
"@astrojs/telemetry": "3.0.4"
|
|
169
169
|
},
|
|
170
170
|
"optionalDependencies": {
|
|
171
171
|
"sharp": "^0.32.6"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { APIContext, Locales, Params } from '../../@types/astro.js';
|
|
2
|
-
import { type RoutingStrategies } from '../../i18n/utils.js';
|
|
3
|
-
import type { AstroCookies } from '../cookies/index.js';
|
|
4
|
-
type CreateAPIContext = {
|
|
5
|
-
request: Request;
|
|
6
|
-
params: Params;
|
|
7
|
-
site?: string;
|
|
8
|
-
props: Record<string, any>;
|
|
9
|
-
adapterName?: string;
|
|
10
|
-
locales: Locales | undefined;
|
|
11
|
-
routingStrategy: RoutingStrategies | undefined;
|
|
12
|
-
defaultLocale: string | undefined;
|
|
13
|
-
route: string;
|
|
14
|
-
cookies: AstroCookies;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Creates a context that holds all the information needed to handle an Astro endpoint.
|
|
18
|
-
*
|
|
19
|
-
* @param {CreateAPIContext} payload
|
|
20
|
-
*/
|
|
21
|
-
export declare function createAPIContext({ request, params, site, props, adapterName, locales, routingStrategy, defaultLocale, route, cookies, }: CreateAPIContext): APIContext;
|
|
22
|
-
export {};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computeCurrentLocale,
|
|
3
|
-
computePreferredLocale,
|
|
4
|
-
computePreferredLocaleList
|
|
5
|
-
} from "../../i18n/utils.js";
|
|
6
|
-
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from "../constants.js";
|
|
7
|
-
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
8
|
-
function createAPIContext({
|
|
9
|
-
request,
|
|
10
|
-
params,
|
|
11
|
-
site,
|
|
12
|
-
props,
|
|
13
|
-
adapterName,
|
|
14
|
-
locales,
|
|
15
|
-
routingStrategy,
|
|
16
|
-
defaultLocale,
|
|
17
|
-
route,
|
|
18
|
-
cookies
|
|
19
|
-
}) {
|
|
20
|
-
let preferredLocale = void 0;
|
|
21
|
-
let preferredLocaleList = void 0;
|
|
22
|
-
let currentLocale = void 0;
|
|
23
|
-
const context = {
|
|
24
|
-
cookies,
|
|
25
|
-
request,
|
|
26
|
-
params,
|
|
27
|
-
site: site ? new URL(site) : void 0,
|
|
28
|
-
generator: `Astro v${ASTRO_VERSION}`,
|
|
29
|
-
props,
|
|
30
|
-
redirect(path, status) {
|
|
31
|
-
return new Response(null, {
|
|
32
|
-
status: status || 302,
|
|
33
|
-
headers: {
|
|
34
|
-
Location: path
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
get preferredLocale() {
|
|
39
|
-
if (preferredLocale) {
|
|
40
|
-
return preferredLocale;
|
|
41
|
-
}
|
|
42
|
-
if (locales) {
|
|
43
|
-
preferredLocale = computePreferredLocale(request, locales);
|
|
44
|
-
return preferredLocale;
|
|
45
|
-
}
|
|
46
|
-
return void 0;
|
|
47
|
-
},
|
|
48
|
-
get preferredLocaleList() {
|
|
49
|
-
if (preferredLocaleList) {
|
|
50
|
-
return preferredLocaleList;
|
|
51
|
-
}
|
|
52
|
-
if (locales) {
|
|
53
|
-
preferredLocaleList = computePreferredLocaleList(request, locales);
|
|
54
|
-
return preferredLocaleList;
|
|
55
|
-
}
|
|
56
|
-
return void 0;
|
|
57
|
-
},
|
|
58
|
-
get currentLocale() {
|
|
59
|
-
if (currentLocale) {
|
|
60
|
-
return currentLocale;
|
|
61
|
-
}
|
|
62
|
-
if (locales) {
|
|
63
|
-
currentLocale = computeCurrentLocale(route, locales, routingStrategy, defaultLocale);
|
|
64
|
-
}
|
|
65
|
-
return currentLocale;
|
|
66
|
-
},
|
|
67
|
-
url: new URL(request.url),
|
|
68
|
-
get clientAddress() {
|
|
69
|
-
if (clientAddressSymbol in request) {
|
|
70
|
-
return Reflect.get(request, clientAddressSymbol);
|
|
71
|
-
}
|
|
72
|
-
if (adapterName) {
|
|
73
|
-
throw new AstroError({
|
|
74
|
-
...AstroErrorData.ClientAddressNotAvailable,
|
|
75
|
-
message: AstroErrorData.ClientAddressNotAvailable.message(adapterName)
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
throw new AstroError(AstroErrorData.StaticClientAddressNotAvailable);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
get locals() {
|
|
82
|
-
let locals = Reflect.get(request, clientLocalsSymbol);
|
|
83
|
-
if (locals === void 0) {
|
|
84
|
-
locals = {};
|
|
85
|
-
Reflect.set(request, clientLocalsSymbol, locals);
|
|
86
|
-
}
|
|
87
|
-
if (typeof locals !== "object") {
|
|
88
|
-
throw new AstroError(AstroErrorData.LocalsNotAnObject);
|
|
89
|
-
}
|
|
90
|
-
return locals;
|
|
91
|
-
},
|
|
92
|
-
// We define a custom property, so we can check the value passed to locals
|
|
93
|
-
set locals(val) {
|
|
94
|
-
if (typeof val !== "object") {
|
|
95
|
-
throw new AstroError(AstroErrorData.LocalsNotAnObject);
|
|
96
|
-
} else {
|
|
97
|
-
Reflect.set(request, clientLocalsSymbol, val);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
return context;
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
createAPIContext
|
|
105
|
-
};
|