astro 5.17.0 → 5.17.2
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 +0 -2
- package/dist/assets/fonts/constants.d.ts +0 -2
- package/dist/assets/fonts/constants.js +0 -4
- package/dist/assets/fonts/runtime.d.ts +1 -0
- package/dist/assets/fonts/runtime.js +5 -0
- package/dist/assets/fonts/types.d.ts +0 -3
- package/dist/assets/fonts/vite-plugin-fonts.js +2 -46
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/app/node.js +10 -7
- package/dist/core/app/validate-headers.d.ts +17 -0
- package/dist/core/app/validate-headers.js +80 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +0 -13
- package/dist/core/errors/errors-data.js +0 -7
- package/dist/core/messages.js +2 -2
- package/package.json +7 -8
- package/dist/assets/fonts/core/create-get-font-buffer.d.ts +0 -4
- package/dist/assets/fonts/core/create-get-font-buffer.js +0 -35
- package/dist/assets/fonts/runtime/client.d.ts +0 -2
- package/dist/assets/fonts/runtime/client.js +0 -9
- package/dist/assets/fonts/runtime/server.d.ts +0 -2
- package/dist/assets/fonts/runtime/server.js +0 -8
package/client.d.ts
CHANGED
|
@@ -55,7 +55,6 @@ declare module 'astro:assets' {
|
|
|
55
55
|
Picture: typeof import('./components/Picture.astro').default;
|
|
56
56
|
Font: typeof import('./components/Font.astro').default;
|
|
57
57
|
fontData: Record<import('astro:assets').CssVariable, Array<import('astro:assets').FontData>>;
|
|
58
|
-
getFontBuffer: (url: string) => Promise<Buffer>;
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
type ImgAttributes = import('./dist/type-utils.js').WithRequired<
|
|
@@ -78,7 +77,6 @@ declare module 'astro:assets' {
|
|
|
78
77
|
Font,
|
|
79
78
|
inferRemoteSize,
|
|
80
79
|
fontData,
|
|
81
|
-
getFontBuffer,
|
|
82
80
|
}: AstroAssets;
|
|
83
81
|
}
|
|
84
82
|
|
|
@@ -4,8 +4,6 @@ export declare const VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/internal";
|
|
|
4
4
|
export declare const RESOLVED_VIRTUAL_MODULE_ID: string;
|
|
5
5
|
export declare const RUNTIME_VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/runtime";
|
|
6
6
|
export declare const RESOLVED_RUNTIME_VIRTUAL_MODULE_ID: string;
|
|
7
|
-
export declare const BUFFER_VIRTUAL_MODULE_ID_PREFIX = "virtual:astro:assets/fonts/file/";
|
|
8
|
-
export declare const RESOLVED_BUFFER_VIRTUAL_MODULE_ID_PREFIX: string;
|
|
9
7
|
export declare const ASSETS_DIR = "fonts";
|
|
10
8
|
export declare const CACHE_DIR = "./fonts/";
|
|
11
9
|
export declare const FONT_TYPES: readonly ["woff2", "woff", "otf", "ttf", "eot"];
|
|
@@ -11,8 +11,6 @@ const VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/internal";
|
|
|
11
11
|
const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
|
|
12
12
|
const RUNTIME_VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/runtime";
|
|
13
13
|
const RESOLVED_RUNTIME_VIRTUAL_MODULE_ID = "\0" + RUNTIME_VIRTUAL_MODULE_ID;
|
|
14
|
-
const BUFFER_VIRTUAL_MODULE_ID_PREFIX = "virtual:astro:assets/fonts/file/";
|
|
15
|
-
const RESOLVED_BUFFER_VIRTUAL_MODULE_ID_PREFIX = "\0" + BUFFER_VIRTUAL_MODULE_ID_PREFIX;
|
|
16
14
|
const ASSETS_DIR = "fonts";
|
|
17
15
|
const CACHE_DIR = "./fonts/";
|
|
18
16
|
const FONT_TYPES = ["woff2", "woff", "otf", "ttf", "eot"];
|
|
@@ -41,14 +39,12 @@ const GENERIC_FALLBACK_NAMES = [
|
|
|
41
39
|
const FONTS_TYPES_FILE = "fonts.d.ts";
|
|
42
40
|
export {
|
|
43
41
|
ASSETS_DIR,
|
|
44
|
-
BUFFER_VIRTUAL_MODULE_ID_PREFIX,
|
|
45
42
|
CACHE_DIR,
|
|
46
43
|
DEFAULTS,
|
|
47
44
|
FONTS_TYPES_FILE,
|
|
48
45
|
FONT_FORMATS,
|
|
49
46
|
FONT_TYPES,
|
|
50
47
|
GENERIC_FALLBACK_NAMES,
|
|
51
|
-
RESOLVED_BUFFER_VIRTUAL_MODULE_ID_PREFIX,
|
|
52
48
|
RESOLVED_RUNTIME_VIRTUAL_MODULE_ID,
|
|
53
49
|
RESOLVED_VIRTUAL_MODULE_ID,
|
|
54
50
|
RUNTIME_VIRTUAL_MODULE_ID,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fontData: import("./types.js").FontDataByCssVariable;
|
|
@@ -230,7 +230,4 @@ export interface FontFamilyAssets {
|
|
|
230
230
|
}
|
|
231
231
|
export type FontFamilyAssetsByUniqueKey = Map<string, FontFamilyAssets>;
|
|
232
232
|
export type Collaborator<T extends (input: any) => any, U extends keyof Parameters<T>[0]> = (params: Pick<Parameters<T>[0], U>) => ReturnType<T>;
|
|
233
|
-
export type BufferImports = Record<string, () => Promise<{
|
|
234
|
-
default: Buffer | null;
|
|
235
|
-
}>>;
|
|
236
233
|
export {};
|
|
@@ -11,10 +11,8 @@ import { appendForwardSlash, joinPaths, prependForwardSlash } from "../../core/p
|
|
|
11
11
|
import { getClientOutputDirectory } from "../../prerender/utils.js";
|
|
12
12
|
import {
|
|
13
13
|
ASSETS_DIR,
|
|
14
|
-
BUFFER_VIRTUAL_MODULE_ID_PREFIX,
|
|
15
14
|
CACHE_DIR,
|
|
16
15
|
DEFAULTS,
|
|
17
|
-
RESOLVED_BUFFER_VIRTUAL_MODULE_ID_PREFIX,
|
|
18
16
|
RESOLVED_RUNTIME_VIRTUAL_MODULE_ID,
|
|
19
17
|
RESOLVED_VIRTUAL_MODULE_ID,
|
|
20
18
|
RUNTIME_VIRTUAL_MODULE_ID,
|
|
@@ -53,12 +51,9 @@ function fontsPlugin({ settings, sync, logger }) {
|
|
|
53
51
|
if (id === RUNTIME_VIRTUAL_MODULE_ID) {
|
|
54
52
|
return RESOLVED_RUNTIME_VIRTUAL_MODULE_ID;
|
|
55
53
|
}
|
|
56
|
-
if (id.startsWith(BUFFER_VIRTUAL_MODULE_ID_PREFIX)) {
|
|
57
|
-
return `\0` + id;
|
|
58
|
-
}
|
|
59
54
|
},
|
|
60
55
|
load(id) {
|
|
61
|
-
if (id === RESOLVED_VIRTUAL_MODULE_ID || id === RESOLVED_RUNTIME_VIRTUAL_MODULE_ID
|
|
56
|
+
if (id === RESOLVED_VIRTUAL_MODULE_ID || id === RESOLVED_RUNTIME_VIRTUAL_MODULE_ID) {
|
|
62
57
|
return {
|
|
63
58
|
code: ""
|
|
64
59
|
};
|
|
@@ -249,9 +244,6 @@ function fontsPlugin({ settings, sync, logger }) {
|
|
|
249
244
|
if (id === RUNTIME_VIRTUAL_MODULE_ID) {
|
|
250
245
|
return RESOLVED_RUNTIME_VIRTUAL_MODULE_ID;
|
|
251
246
|
}
|
|
252
|
-
if (id.startsWith(BUFFER_VIRTUAL_MODULE_ID_PREFIX)) {
|
|
253
|
-
return `\0` + id;
|
|
254
|
-
}
|
|
255
247
|
},
|
|
256
248
|
async load(id) {
|
|
257
249
|
if (id === RESOLVED_VIRTUAL_MODULE_ID) {
|
|
@@ -259,50 +251,14 @@ function fontsPlugin({ settings, sync, logger }) {
|
|
|
259
251
|
code: `
|
|
260
252
|
export const componentDataByCssVariable = new Map(${JSON.stringify(Array.from(componentDataByCssVariable?.entries() ?? []))});
|
|
261
253
|
export const fontDataByCssVariable = ${JSON.stringify(fontDataByCssVariable ?? {})}
|
|
262
|
-
export const bufferImports = {${[...fontFileById?.keys() ?? []].map((key) => `"${key}": () => import("${BUFFER_VIRTUAL_MODULE_ID_PREFIX}${key}")`).join(",")}};
|
|
263
254
|
`
|
|
264
255
|
};
|
|
265
256
|
}
|
|
266
257
|
if (id === RESOLVED_RUNTIME_VIRTUAL_MODULE_ID) {
|
|
267
|
-
if (this.environment.name === "client") {
|
|
268
|
-
return {
|
|
269
|
-
code: `export * from 'astro/assets/fonts/runtime/client.js';`
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
258
|
return {
|
|
273
|
-
code: `export * from 'astro/assets/fonts/runtime
|
|
259
|
+
code: `export * from 'astro/assets/fonts/runtime.js';`
|
|
274
260
|
};
|
|
275
261
|
}
|
|
276
|
-
if (id.startsWith(RESOLVED_BUFFER_VIRTUAL_MODULE_ID_PREFIX)) {
|
|
277
|
-
if (!fontFetcher) {
|
|
278
|
-
logger.debug(
|
|
279
|
-
"assets",
|
|
280
|
-
"Fonts dependencies should be initialized by now, skipping dev middleware."
|
|
281
|
-
);
|
|
282
|
-
return { code: `export default null;` };
|
|
283
|
-
}
|
|
284
|
-
const fontId = id.slice(RESOLVED_BUFFER_VIRTUAL_MODULE_ID_PREFIX.length);
|
|
285
|
-
const fontData = fontFileById?.get(fontId);
|
|
286
|
-
if (!fontData) {
|
|
287
|
-
return { code: `export default null;` };
|
|
288
|
-
}
|
|
289
|
-
try {
|
|
290
|
-
const buffer = await fontFetcher.fetch({ id: fontId, ...fontData });
|
|
291
|
-
const bytes = Array.from(buffer);
|
|
292
|
-
return {
|
|
293
|
-
code: `export default Uint8Array.from(${JSON.stringify(bytes)});`
|
|
294
|
-
};
|
|
295
|
-
} catch (err) {
|
|
296
|
-
logger.error("assets", "Cannot download font file");
|
|
297
|
-
if (isAstroError(err)) {
|
|
298
|
-
logger.error(
|
|
299
|
-
"SKIP_FORMAT",
|
|
300
|
-
formatErrorMessage(collectErrorMetadata(err), logger.level() === "debug")
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
return { code: `export default null;` };
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
262
|
},
|
|
307
263
|
async buildEnd() {
|
|
308
264
|
if (sync || settings.config.experimental.fonts.length === 0 || !isBuild) {
|
|
@@ -164,7 +164,7 @@ ${contentConfig.error.message}`);
|
|
|
164
164
|
logger.info("Content config changed");
|
|
165
165
|
shouldClear = true;
|
|
166
166
|
}
|
|
167
|
-
if (previousAstroVersion && previousAstroVersion !== "5.17.
|
|
167
|
+
if (previousAstroVersion && previousAstroVersion !== "5.17.2") {
|
|
168
168
|
logger.info("Astro version changed");
|
|
169
169
|
shouldClear = true;
|
|
170
170
|
}
|
|
@@ -172,8 +172,8 @@ ${contentConfig.error.message}`);
|
|
|
172
172
|
logger.info("Clearing content store");
|
|
173
173
|
this.#store.clearAll();
|
|
174
174
|
}
|
|
175
|
-
if ("5.17.
|
|
176
|
-
await this.#store.metaStore().set("astro-version", "5.17.
|
|
175
|
+
if ("5.17.2") {
|
|
176
|
+
await this.#store.metaStore().set("astro-version", "5.17.2");
|
|
177
177
|
}
|
|
178
178
|
if (currentConfigDigest) {
|
|
179
179
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/app/node.js
CHANGED
|
@@ -4,6 +4,7 @@ import { clientAddressSymbol, nodeRequestAbortControllerCleanupSymbol } from "..
|
|
|
4
4
|
import { deserializeManifest } from "./common.js";
|
|
5
5
|
import { createOutgoingHttpHeaders } from "./createOutgoingHttpHeaders.js";
|
|
6
6
|
import { App } from "./index.js";
|
|
7
|
+
import { validateForwardedHeaders, validateHost } from "./validate-headers.js";
|
|
7
8
|
import { apply } from "../polyfill.js";
|
|
8
9
|
class NodeApp extends App {
|
|
9
10
|
headersMap = void 0;
|
|
@@ -50,26 +51,28 @@ class NodeApp extends App {
|
|
|
50
51
|
return multiValueHeader?.toString()?.split(",").map((e) => e.trim())?.[0];
|
|
51
52
|
};
|
|
52
53
|
const providedProtocol = isEncrypted ? "https" : "http";
|
|
53
|
-
const
|
|
54
|
-
const validated =
|
|
54
|
+
const untrustedHostname = req.headers.host ?? req.headers[":authority"];
|
|
55
|
+
const validated = validateForwardedHeaders(
|
|
55
56
|
getFirstForwardedValue(req.headers["x-forwarded-proto"]),
|
|
56
57
|
getFirstForwardedValue(req.headers["x-forwarded-host"]),
|
|
57
58
|
getFirstForwardedValue(req.headers["x-forwarded-port"]),
|
|
58
59
|
allowedDomains
|
|
59
60
|
);
|
|
60
61
|
const protocol = validated.protocol ?? providedProtocol;
|
|
61
|
-
const
|
|
62
|
-
typeof
|
|
62
|
+
const validatedHostname = validateHost(
|
|
63
|
+
typeof untrustedHostname === "string" ? untrustedHostname : void 0,
|
|
64
|
+
protocol,
|
|
65
|
+
allowedDomains
|
|
63
66
|
);
|
|
64
|
-
const hostname = validated.host ??
|
|
67
|
+
const hostname = validated.host ?? validatedHostname ?? "localhost";
|
|
65
68
|
const port = validated.port;
|
|
66
69
|
let url;
|
|
67
70
|
try {
|
|
68
71
|
const hostnamePort = getHostnamePort(hostname, port);
|
|
69
72
|
url = new URL(`${protocol}://${hostnamePort}${req.url}`);
|
|
70
73
|
} catch {
|
|
71
|
-
const hostnamePort = getHostnamePort(
|
|
72
|
-
url = new URL(`${
|
|
74
|
+
const hostnamePort = getHostnamePort(hostname, port);
|
|
75
|
+
url = new URL(`${protocol}://${hostnamePort}`);
|
|
73
76
|
}
|
|
74
77
|
const options = {
|
|
75
78
|
method: req.method || "GET",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RemotePattern } from '@astrojs/internal-helpers/remote';
|
|
2
|
+
/**
|
|
3
|
+
* Validate a host against allowedDomains.
|
|
4
|
+
* Returns the host only if it matches an allowed pattern, otherwise undefined.
|
|
5
|
+
* This prevents SSRF attacks by ensuring the Host header is trusted.
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateHost(host: string | undefined, protocol: string, allowedDomains?: Partial<RemotePattern>[]): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Validate forwarded headers (proto, host, port) against allowedDomains.
|
|
10
|
+
* Returns validated values or undefined for rejected headers.
|
|
11
|
+
* Uses strict defaults: http/https only for proto, rejects port if not in allowedDomains.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateForwardedHeaders(forwardedProtocol?: string, forwardedHost?: string, forwardedPort?: string, allowedDomains?: Partial<RemotePattern>[]): {
|
|
14
|
+
protocol?: string;
|
|
15
|
+
host?: string;
|
|
16
|
+
port?: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { matchPattern } from "@astrojs/internal-helpers/remote";
|
|
2
|
+
function sanitizeHost(hostname) {
|
|
3
|
+
if (!hostname) return void 0;
|
|
4
|
+
if (/[/\\]/.test(hostname)) return void 0;
|
|
5
|
+
return hostname;
|
|
6
|
+
}
|
|
7
|
+
function parseHost(host) {
|
|
8
|
+
const parts = host.split(":");
|
|
9
|
+
return {
|
|
10
|
+
hostname: parts[0],
|
|
11
|
+
port: parts[1]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function matchesAllowedDomains(hostname, protocol, port, allowedDomains) {
|
|
15
|
+
const hostWithPort = port ? `${hostname}:${port}` : hostname;
|
|
16
|
+
const urlString = `${protocol}://${hostWithPort}`;
|
|
17
|
+
if (!URL.canParse(urlString)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const testUrl = new URL(urlString);
|
|
21
|
+
return allowedDomains.some((pattern) => matchPattern(testUrl, pattern));
|
|
22
|
+
}
|
|
23
|
+
function validateHost(host, protocol, allowedDomains) {
|
|
24
|
+
if (!host || host.length === 0) return void 0;
|
|
25
|
+
if (!allowedDomains || allowedDomains.length === 0) return void 0;
|
|
26
|
+
const sanitized = sanitizeHost(host);
|
|
27
|
+
if (!sanitized) return void 0;
|
|
28
|
+
const { hostname, port } = parseHost(sanitized);
|
|
29
|
+
if (matchesAllowedDomains(hostname, protocol, port, allowedDomains)) {
|
|
30
|
+
return sanitized;
|
|
31
|
+
}
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
function validateForwardedHeaders(forwardedProtocol, forwardedHost, forwardedPort, allowedDomains) {
|
|
35
|
+
const result = {};
|
|
36
|
+
if (forwardedProtocol) {
|
|
37
|
+
if (allowedDomains && allowedDomains.length > 0) {
|
|
38
|
+
const hasProtocolPatterns = allowedDomains.some((pattern) => pattern.protocol !== void 0);
|
|
39
|
+
if (hasProtocolPatterns) {
|
|
40
|
+
try {
|
|
41
|
+
const testUrl = new URL(`${forwardedProtocol}://example.com`);
|
|
42
|
+
const isAllowed = allowedDomains.some((pattern) => matchPattern(testUrl, pattern));
|
|
43
|
+
if (isAllowed) {
|
|
44
|
+
result.protocol = forwardedProtocol;
|
|
45
|
+
}
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
} else if (/^https?$/.test(forwardedProtocol)) {
|
|
49
|
+
result.protocol = forwardedProtocol;
|
|
50
|
+
}
|
|
51
|
+
} else if (/^https?$/.test(forwardedProtocol)) {
|
|
52
|
+
result.protocol = forwardedProtocol;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (forwardedPort && allowedDomains && allowedDomains.length > 0) {
|
|
56
|
+
const hasPortPatterns = allowedDomains.some((pattern) => pattern.port !== void 0);
|
|
57
|
+
if (hasPortPatterns) {
|
|
58
|
+
const isAllowed = allowedDomains.some((pattern) => pattern.port === forwardedPort);
|
|
59
|
+
if (isAllowed) {
|
|
60
|
+
result.port = forwardedPort;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (forwardedHost && forwardedHost.length > 0 && allowedDomains && allowedDomains.length > 0) {
|
|
65
|
+
const protoForValidation = result.protocol || "https";
|
|
66
|
+
const sanitized = sanitizeHost(forwardedHost);
|
|
67
|
+
if (sanitized) {
|
|
68
|
+
const { hostname, port: portFromHost } = parseHost(sanitized);
|
|
69
|
+
const portForValidation = result.port || portFromHost;
|
|
70
|
+
if (matchesAllowedDomains(hostname, protoForValidation, portForValidation, allowedDomains)) {
|
|
71
|
+
result.host = sanitized;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
validateForwardedHeaders,
|
|
79
|
+
validateHost
|
|
80
|
+
};
|
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.17.
|
|
25
|
+
const currentVersion = "5.17.2";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
|
@@ -1247,19 +1247,6 @@ export declare const FontFamilyNotFound: {
|
|
|
1247
1247
|
message: (family: string) => string;
|
|
1248
1248
|
hint: string;
|
|
1249
1249
|
};
|
|
1250
|
-
/**
|
|
1251
|
-
* @docs
|
|
1252
|
-
* @description
|
|
1253
|
-
* Font buffer not found
|
|
1254
|
-
* @message
|
|
1255
|
-
* No buffer was found for the URL passed to the `getFontBuffer()` function.
|
|
1256
|
-
*/
|
|
1257
|
-
export declare const FontBufferNotFound: {
|
|
1258
|
-
name: string;
|
|
1259
|
-
title: string;
|
|
1260
|
-
message: (url: string) => string;
|
|
1261
|
-
hint: string;
|
|
1262
|
-
};
|
|
1263
1250
|
/**
|
|
1264
1251
|
* @docs
|
|
1265
1252
|
* @description
|
|
@@ -470,12 +470,6 @@ const FontFamilyNotFound = {
|
|
|
470
470
|
message: (family) => `No data was found for the \`"${family}"\` family passed to the \`<Font>\` component.`,
|
|
471
471
|
hint: "This is often caused by a typo. Check that the `<Font />` component is using a `cssVariable` specified in your config."
|
|
472
472
|
};
|
|
473
|
-
const FontBufferNotFound = {
|
|
474
|
-
name: "FontBufferNotFound",
|
|
475
|
-
title: "Font buffer not found",
|
|
476
|
-
message: (url) => `No buffer was found for the \`"${url}"\` URL passed to the \`getFontBuffer()\` function.`,
|
|
477
|
-
hint: "Make sure you pass a valid URL, obtained via the `fontData` object."
|
|
478
|
-
};
|
|
479
473
|
const CspNotEnabled = {
|
|
480
474
|
name: "CspNotEnabled",
|
|
481
475
|
title: "CSP feature isn't enabled",
|
|
@@ -784,7 +778,6 @@ export {
|
|
|
784
778
|
FailedToLoadModuleSSR,
|
|
785
779
|
FileGlobNotSupported,
|
|
786
780
|
FileParserNotFound,
|
|
787
|
-
FontBufferNotFound,
|
|
788
781
|
FontFamilyNotFound,
|
|
789
782
|
ForbiddenRewrite,
|
|
790
783
|
GenerateContentTypesError,
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "5.17.
|
|
41
|
+
const version = "5.17.2";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -275,7 +275,7 @@ function printHelp({
|
|
|
275
275
|
message.push(
|
|
276
276
|
linebreak(),
|
|
277
277
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
278
|
-
`v${"5.17.
|
|
278
|
+
`v${"5.17.2"}`
|
|
279
279
|
)} ${headline}`
|
|
280
280
|
);
|
|
281
281
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.17.
|
|
3
|
+
"version": "5.17.2",
|
|
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",
|
|
@@ -63,8 +63,7 @@
|
|
|
63
63
|
"./assets/endpoint/*": "./dist/assets/endpoint/*.js",
|
|
64
64
|
"./assets/services/sharp": "./dist/assets/services/sharp.js",
|
|
65
65
|
"./assets/services/noop": "./dist/assets/services/noop.js",
|
|
66
|
-
"./assets/fonts/runtime
|
|
67
|
-
"./assets/fonts/runtime/client.js": "./dist/assets/fonts/runtime/client.js",
|
|
66
|
+
"./assets/fonts/runtime.js": "./dist/assets/fonts/runtime.js",
|
|
68
67
|
"./loaders": "./dist/content/loaders/index.js",
|
|
69
68
|
"./content/config": "./dist/content/config.js",
|
|
70
69
|
"./content/runtime": "./dist/content/runtime.js",
|
|
@@ -114,7 +113,7 @@
|
|
|
114
113
|
"dlv": "^1.1.3",
|
|
115
114
|
"dset": "^3.1.4",
|
|
116
115
|
"es-module-lexer": "^1.7.0",
|
|
117
|
-
"esbuild": "^0.
|
|
116
|
+
"esbuild": "^0.27.0",
|
|
118
117
|
"estree-walker": "^3.0.3",
|
|
119
118
|
"flattie": "^1.1.1",
|
|
120
119
|
"fontace": "~0.4.0",
|
|
@@ -154,9 +153,9 @@
|
|
|
154
153
|
"zod": "^3.25.76",
|
|
155
154
|
"zod-to-json-schema": "^3.25.1",
|
|
156
155
|
"zod-to-ts": "^1.2.0",
|
|
156
|
+
"@astrojs/internal-helpers": "0.7.5",
|
|
157
157
|
"@astrojs/markdown-remark": "6.3.10",
|
|
158
|
-
"@astrojs/telemetry": "3.3.0"
|
|
159
|
-
"@astrojs/internal-helpers": "0.7.5"
|
|
158
|
+
"@astrojs/telemetry": "3.3.0"
|
|
160
159
|
},
|
|
161
160
|
"optionalDependencies": {
|
|
162
161
|
"sharp": "^0.34.0"
|
|
@@ -194,8 +193,8 @@
|
|
|
194
193
|
"undici": "^6.23.0",
|
|
195
194
|
"unified": "^11.0.5",
|
|
196
195
|
"vitest": "^3.2.4",
|
|
197
|
-
"
|
|
198
|
-
"
|
|
196
|
+
"@astrojs/check": "0.9.6",
|
|
197
|
+
"astro-scripts": "0.0.14"
|
|
199
198
|
},
|
|
200
199
|
"engines": {
|
|
201
200
|
"node": "18.20.8 || ^20.3.0 || >=22.0.0",
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AstroError, AstroErrorData } from "../../../core/errors/index.js";
|
|
2
|
-
function createGetFontBuffer({ bufferImports }) {
|
|
3
|
-
return async function getFontBuffer(url) {
|
|
4
|
-
if (!bufferImports) {
|
|
5
|
-
throw new AstroError(AstroErrorData.ExperimentalFontsNotEnabled);
|
|
6
|
-
}
|
|
7
|
-
const hash = url.split("/").pop() ?? "";
|
|
8
|
-
const fn = bufferImports[hash];
|
|
9
|
-
if (!fn) {
|
|
10
|
-
throw new AstroError({
|
|
11
|
-
...AstroErrorData.FontBufferNotFound,
|
|
12
|
-
message: AstroErrorData.FontBufferNotFound.message(url)
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
let mod;
|
|
16
|
-
try {
|
|
17
|
-
mod = await fn();
|
|
18
|
-
} catch {
|
|
19
|
-
throw new AstroError({
|
|
20
|
-
...AstroErrorData.FontBufferNotFound,
|
|
21
|
-
message: AstroErrorData.FontBufferNotFound.message(url)
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
if (!mod?.default) {
|
|
25
|
-
throw new AstroError({
|
|
26
|
-
...AstroErrorData.FontBufferNotFound,
|
|
27
|
-
message: AstroErrorData.FontBufferNotFound.message(url)
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return mod.default;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
createGetFontBuffer
|
|
35
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as fontsMod from "virtual:astro:assets/fonts/internal";
|
|
2
|
-
const fontData = fontsMod.fontDataByCssVariable ?? {};
|
|
3
|
-
async function getFontBuffer() {
|
|
4
|
-
throw new Error("[astro:assets] `getFontBuffer()` is not available on the client.");
|
|
5
|
-
}
|
|
6
|
-
export {
|
|
7
|
-
fontData,
|
|
8
|
-
getFontBuffer
|
|
9
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as fontsMod from "virtual:astro:assets/fonts/internal";
|
|
2
|
-
import { createGetFontBuffer } from "../core/create-get-font-buffer.js";
|
|
3
|
-
const fontData = fontsMod.fontDataByCssVariable ?? {};
|
|
4
|
-
const getFontBuffer = createGetFontBuffer(fontsMod);
|
|
5
|
-
export {
|
|
6
|
-
fontData,
|
|
7
|
-
getFontBuffer
|
|
8
|
-
};
|