astro 5.13.11 → 5.14.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/client.d.ts CHANGED
@@ -54,6 +54,9 @@ declare module 'astro:assets' {
54
54
  Image: typeof import('./components/Image.astro').default;
55
55
  Picture: typeof import('./components/Picture.astro').default;
56
56
  Font: typeof import('./components/Font.astro').default;
57
+ getFontData: (
58
+ cssVariable: import('astro:assets').CssVariable,
59
+ ) => Array<import('astro:assets').FontData>;
57
60
  };
58
61
 
59
62
  type ImgAttributes = import('./dist/type-utils.js').WithRequired<
@@ -75,6 +78,7 @@ declare module 'astro:assets' {
75
78
  Picture,
76
79
  Font,
77
80
  inferRemoteSize,
81
+ getFontData,
78
82
  }: AstroAssets;
79
83
  }
80
84
 
@@ -109,9 +113,7 @@ declare module '*.avif' {
109
113
  export default metadata;
110
114
  }
111
115
  declare module '*.svg' {
112
- type Props = astroHTML.JSX.SVGAttributes;
113
-
114
- const Component: ((_props: Props) => any) & ImageMetadata;
116
+ const Component: import('./types').SvgComponent & ImageMetadata;
115
117
  export default Component;
116
118
  }
117
119
 
@@ -3,20 +3,20 @@ import * as mod from 'virtual:astro:assets/fonts/internal';
3
3
  import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
4
4
 
5
5
  // TODO: remove check when fonts are stabilized
6
- const { fontsData } = mod;
7
- if (!fontsData) {
6
+ const { internalConsumableMap } = mod;
7
+ if (!internalConsumableMap) {
8
8
  throw new AstroError(AstroErrorData.ExperimentalFontsNotEnabled);
9
9
  }
10
10
 
11
11
  interface Props {
12
12
  /** The `cssVariable` registered in your Astro configuration. */
13
- cssVariable: import('astro:assets').FontFamily;
13
+ cssVariable: import('astro:assets').CssVariable;
14
14
  /** Whether it should output [preload links](https://web.dev/learn/performance/optimize-web-fonts#preload) or not. */
15
15
  preload?: boolean;
16
16
  }
17
17
 
18
18
  const { cssVariable, preload = false } = Astro.props as Props;
19
- const data = fontsData.get(cssVariable);
19
+ const data = internalConsumableMap.get(cssVariable);
20
20
  if (!data) {
21
21
  throw new AstroError({
22
22
  ...AstroErrorData.FontFamilyNotFound,
@@ -14,10 +14,24 @@ function createDevUrlProxyHashResolver({
14
14
  return {
15
15
  resolve(input) {
16
16
  const { cssVariable, data } = input;
17
- return [cssVariable.slice(2), data.weight, data.style, baseHashResolver.resolve(input)].filter(Boolean).join("-");
17
+ return [
18
+ cssVariable.slice(2),
19
+ formatWeight(data.weight),
20
+ data.style,
21
+ baseHashResolver.resolve(input)
22
+ ].filter(Boolean).join("-");
18
23
  }
19
24
  };
20
25
  }
26
+ function formatWeight(weight) {
27
+ if (Array.isArray(weight)) {
28
+ return weight.join("-");
29
+ }
30
+ if (typeof weight === "number") {
31
+ return weight.toString();
32
+ }
33
+ return weight;
34
+ }
21
35
  export {
22
36
  createBuildUrlProxyHashResolver,
23
37
  createDevUrlProxyHashResolver
@@ -1,7 +1,7 @@
1
1
  import type { Storage } from 'unstorage';
2
2
  import type { Logger } from '../../core/logger/core.js';
3
3
  import type { CssRenderer, FontFileReader, FontMetricsResolver, FontTypeExtractor, Hasher, LocalProviderUrlResolver, RemoteFontProviderResolver, SystemFallbacksProvider, UrlProxy } from './definitions.js';
4
- import type { ConsumableMap, CreateUrlProxyParams, Defaults, FontFamily, FontFileDataMap } from './types.js';
4
+ import type { ConsumableMap, CreateUrlProxyParams, Defaults, FontFamily, FontFileDataMap, InternalConsumableMap } from './types.js';
5
5
  /**
6
6
  * Manages how fonts are resolved:
7
7
  *
@@ -36,5 +36,6 @@ export declare function orchestrate({ families, hasher, remoteFontProviderResolv
36
36
  defaults: Defaults;
37
37
  }): Promise<{
38
38
  fontFileDataMap: FontFileDataMap;
39
+ internalConsumableMap: InternalConsumableMap;
39
40
  consumableMap: ConsumableMap;
40
41
  }>;
@@ -6,7 +6,11 @@ import { normalizeRemoteFontFaces } from "./logic/normalize-remote-font-faces.js
6
6
  import { optimizeFallbacks } from "./logic/optimize-fallbacks.js";
7
7
  import { resolveFamilies } from "./logic/resolve-families.js";
8
8
  import { resolveLocalFont } from "./providers/local.js";
9
- import { pickFontFaceProperty, unifontFontFaceDataToProperties } from "./utils.js";
9
+ import {
10
+ pickFontFaceProperty,
11
+ renderFontWeight,
12
+ unifontFontFaceDataToProperties
13
+ } from "./utils.js";
10
14
  async function orchestrate({
11
15
  families,
12
16
  hasher,
@@ -38,9 +42,11 @@ async function orchestrate({
38
42
  storage
39
43
  });
40
44
  const fontFileDataMap = /* @__PURE__ */ new Map();
45
+ const internalConsumableMap = /* @__PURE__ */ new Map();
41
46
  const consumableMap = /* @__PURE__ */ new Map();
42
47
  for (const family of resolvedFamilies) {
43
48
  const preloadData = [];
49
+ const consumableMapValue = [];
44
50
  let css = "";
45
51
  const collectedFonts = [];
46
52
  const fallbacks = family.fallbacks ?? defaults.fallbacks ?? [];
@@ -110,6 +116,15 @@ async function orchestrate({
110
116
  variationSettings: pickFontFaceProperty("variationSettings", { data, family })
111
117
  })
112
118
  );
119
+ consumableMapValue.push({
120
+ weight: renderFontWeight(data.weight),
121
+ style: data.style,
122
+ src: data.src.filter((src) => "url" in src).map((src) => ({
123
+ url: src.url,
124
+ format: src.format,
125
+ tech: src.tech
126
+ }))
127
+ });
113
128
  }
114
129
  const cssVarValues = [family.nameWithHash];
115
130
  const optimizeFallbacksResult = await optimizeFallbacks({
@@ -127,9 +142,10 @@ async function orchestrate({
127
142
  cssVarValues.push(...fallbacks);
128
143
  }
129
144
  css += cssRenderer.generateCssVariable(family.cssVariable, cssVarValues);
130
- consumableMap.set(family.cssVariable, { preloadData, css });
145
+ internalConsumableMap.set(family.cssVariable, { preloadData, css });
146
+ consumableMap.set(family.cssVariable, consumableMapValue);
131
147
  }
132
- return { fontFileDataMap, consumableMap };
148
+ return { fontFileDataMap, internalConsumableMap, consumableMap };
133
149
  }
134
150
  export {
135
151
  orchestrate
@@ -0,0 +1,4 @@
1
+ import type { ConsumableMap } from './types.js';
2
+ export declare function createGetFontData({ consumableMap }: {
3
+ consumableMap?: ConsumableMap;
4
+ }): (cssVariable: string) => import("./types.js").FontData[];
@@ -0,0 +1,19 @@
1
+ import { AstroError, AstroErrorData } from "../../core/errors/index.js";
2
+ function createGetFontData({ consumableMap }) {
3
+ return function getFontData(cssVariable) {
4
+ if (!consumableMap) {
5
+ throw new AstroError(AstroErrorData.ExperimentalFontsNotEnabled);
6
+ }
7
+ const data = consumableMap.get(cssVariable);
8
+ if (!data) {
9
+ throw new AstroError({
10
+ ...AstroErrorData.FontFamilyNotFound,
11
+ message: AstroErrorData.FontFamilyNotFound.message(cssVariable)
12
+ });
13
+ }
14
+ return data;
15
+ };
16
+ }
17
+ export {
18
+ createGetFontData
19
+ };
@@ -7,7 +7,7 @@ function syncFonts(settings) {
7
7
  filename: FONTS_TYPES_FILE,
8
8
  content: `declare module 'astro:assets' {
9
9
  /** @internal */
10
- export type FontFamily = (${JSON.stringify(settings.config.experimental.fonts.map((family) => family.cssVariable))})[number];
10
+ export type CssVariable = (${JSON.stringify(settings.config.experimental.fonts.map((family) => family.cssVariable))})[number];
11
11
  }
12
12
  `
13
13
  });
@@ -67,11 +67,24 @@ export interface CreateUrlProxyParams {
67
67
  */
68
68
  export type FontFileDataMap = Map<FontFileData['hash'], Pick<FontFileData, 'url' | 'init'>>;
69
69
  /**
70
- * Holds associations of CSS variables and preloadData/css to be passed to the virtual module.
70
+ * Holds associations of CSS variables and preloadData/css to be passed to the internal virtual module.
71
71
  */
72
- export type ConsumableMap = Map<string, {
72
+ export type InternalConsumableMap = Map<string, {
73
73
  preloadData: Array<PreloadData>;
74
74
  css: string;
75
75
  }>;
76
+ export interface FontData {
77
+ src: Array<{
78
+ url: string;
79
+ format?: string;
80
+ tech?: string;
81
+ }>;
82
+ weight?: string;
83
+ style?: string;
84
+ }
85
+ /**
86
+ * Holds associations of CSS variables and font data to be exposed via virtual module.
87
+ */
88
+ export type ConsumableMap = Map<string, Array<FontData>>;
76
89
  export type Style = z.output<typeof styleSchema>;
77
90
  export {};
@@ -6,6 +6,7 @@ import type { FontType, GenericFallbackName, ResolvedFontFamily } from './types.
6
6
  * Turns unifont font face data into generic CSS properties, to be consumed by the CSS renderer.
7
7
  */
8
8
  export declare function unifontFontFaceDataToProperties(font: Partial<unifont.FontFaceData>): CssProperties;
9
+ export declare function renderFontWeight(weight: unifont.FontFaceData['weight']): string | undefined;
9
10
  /**
10
11
  * Turns unifont font face data src into a valid CSS property.
11
12
  * Adapted from https://github.com/nuxt/fonts/blob/main/src/css/render.ts#L68-L81
@@ -6,13 +6,16 @@ function unifontFontFaceDataToProperties(font) {
6
6
  src: font.src ? renderFontSrc(font.src) : void 0,
7
7
  "font-display": font.display ?? "swap",
8
8
  "unicode-range": font.unicodeRange?.length ? font.unicodeRange.join(",") : void 0,
9
- "font-weight": Array.isArray(font.weight) ? font.weight.join(" ") : font.weight?.toString(),
9
+ "font-weight": renderFontWeight(font.weight),
10
10
  "font-style": font.style,
11
11
  "font-stretch": font.stretch,
12
12
  "font-feature-settings": font.featureSettings,
13
13
  "font-variation-settings": font.variationSettings
14
14
  };
15
15
  }
16
+ function renderFontWeight(weight) {
17
+ return Array.isArray(weight) ? weight.join(" ") : weight?.toString();
18
+ }
16
19
  function renderFontSrc(sources) {
17
20
  return sources.map((src) => {
18
21
  if ("name" in src) {
@@ -76,6 +79,7 @@ export {
76
79
  isGenericFontFamily,
77
80
  pickFontFaceProperty,
78
81
  renderFontSrc,
82
+ renderFontWeight,
79
83
  resolveEntrypoint,
80
84
  sortObjectByKey,
81
85
  unifontFontFaceDataToProperties,
@@ -66,11 +66,13 @@ function fontsPlugin({ settings, sync, logger }) {
66
66
  );
67
67
  const baseUrl = joinPaths(settings.config.base, assetsDir);
68
68
  let fontFileDataMap = null;
69
+ let internalConsumableMap = null;
69
70
  let consumableMap = null;
70
71
  let isBuild;
71
72
  let fontFetcher = null;
72
73
  let fontTypeExtractor = null;
73
74
  const cleanup = () => {
75
+ internalConsumableMap = null;
74
76
  consumableMap = null;
75
77
  fontFileDataMap = null;
76
78
  fontFetcher = null;
@@ -137,10 +139,11 @@ function fontsPlugin({ settings, sync, logger }) {
137
139
  defaults: DEFAULTS
138
140
  });
139
141
  fontFileDataMap = res.fontFileDataMap;
142
+ internalConsumableMap = res.internalConsumableMap;
140
143
  consumableMap = res.consumableMap;
141
144
  if (shouldTrackCspHashes(settings.config.experimental.csp)) {
142
145
  const algorithm = getAlgorithm(settings.config.experimental.csp);
143
- for (const { css } of consumableMap.values()) {
146
+ for (const { css } of internalConsumableMap.values()) {
144
147
  settings.injectedCsp.styleHashes.push(await generateCspDigest(css, algorithm));
145
148
  }
146
149
  const resources = urlResolver.getCspResources();
@@ -232,7 +235,10 @@ function fontsPlugin({ settings, sync, logger }) {
232
235
  load(id) {
233
236
  if (id === RESOLVED_VIRTUAL_MODULE_ID) {
234
237
  return {
235
- code: `export const fontsData = new Map(${JSON.stringify(Array.from(consumableMap?.entries() ?? []))})`
238
+ code: `
239
+ export const internalConsumableMap = new Map(${JSON.stringify(Array.from(internalConsumableMap?.entries() ?? []))});
240
+ export const consumableMap = new Map(${JSON.stringify(Array.from(consumableMap?.entries() ?? []))});
241
+ `
236
242
  };
237
243
  }
238
244
  },
@@ -98,9 +98,12 @@ function assets({ fs, settings, sync, logger }) {
98
98
  import { getImage as getImageInternal } from "astro/assets";
99
99
  export { default as Image } from "astro/components/${imageComponentPrefix}Image.astro";
100
100
  export { default as Picture } from "astro/components/${imageComponentPrefix}Picture.astro";
101
- export { default as Font } from "astro/components/Font.astro";
102
101
  export { inferRemoteSize } from "astro/assets/utils/inferRemoteSize.js";
103
102
 
103
+ export { default as Font } from "astro/components/Font.astro";
104
+ import * as fontsMod from 'virtual:astro:assets/fonts/internal';
105
+ import { createGetFontData } from "astro/assets/fonts/runtime";
106
+
104
107
  export const imageConfig = ${JSON.stringify(settings.config.image)};
105
108
  // This is used by the @astrojs/node integration to locate images.
106
109
  // It's unused on other platforms, but on some platforms like Netlify (and presumably also Vercel)
@@ -117,6 +120,8 @@ function assets({ fs, settings, sync, logger }) {
117
120
  settings.config.build.assets
118
121
  )}, outDir);
119
122
  export const getImage = async (options) => await getImageInternal(options, imageConfig);
123
+
124
+ export const getFontData = createGetFontData(fontsMod);
120
125
  `
121
126
  };
122
127
  }
@@ -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.13.11") {
167
+ if (previousAstroVersion && previousAstroVersion !== "5.14.1") {
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.13.11") {
176
- await this.#store.metaStore().set("astro-version", "5.13.11");
175
+ if ("5.14.1") {
176
+ await this.#store.metaStore().set("astro-version", "5.14.1");
177
177
  }
178
178
  if (currentConfigDigest) {
179
179
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -235,11 +235,36 @@ async function getPathsForRoute(route, mod, pipeline, builtPaths) {
235
235
  throw e;
236
236
  }
237
237
  }).filter((staticPath) => {
238
- if (!builtPaths.has(removeTrailingForwardSlash(staticPath))) {
238
+ const normalized = removeTrailingForwardSlash(staticPath);
239
+ if (!builtPaths.has(normalized)) {
239
240
  return true;
240
241
  }
241
242
  const matchedRoute = matchRoute(decodeURI(staticPath), options.routesList);
242
- return matchedRoute === route;
243
+ if (!matchedRoute) {
244
+ return false;
245
+ }
246
+ if (matchedRoute === route) {
247
+ return true;
248
+ }
249
+ if (config.experimental.failOnPrerenderConflict) {
250
+ throw new AstroError({
251
+ ...AstroErrorData.PrerenderRouteConflict,
252
+ message: AstroErrorData.PrerenderRouteConflict.message(
253
+ matchedRoute.route,
254
+ route.route,
255
+ normalized
256
+ ),
257
+ hint: AstroErrorData.PrerenderRouteConflict.hint(matchedRoute.route, route.route)
258
+ });
259
+ } else {
260
+ const msg = AstroErrorData.PrerenderRouteConflict.message(
261
+ matchedRoute.route,
262
+ route.route,
263
+ normalized
264
+ );
265
+ logger.warn("build", msg);
266
+ }
267
+ return false;
243
268
  });
244
269
  for (const staticPath of paths) {
245
270
  builtPaths.add(removeTrailingForwardSlash(staticPath));
@@ -77,6 +77,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
77
77
  csp: false;
78
78
  staticImportMetaEnv: false;
79
79
  chromeDevtoolsWorkspace: false;
80
+ failOnPrerenderConflict: false;
80
81
  };
81
82
  };
82
83
  export declare const AstroConfigSchema: z.ZodObject<{
@@ -979,6 +980,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
979
980
  }>]>>>;
980
981
  staticImportMetaEnv: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
981
982
  chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
983
+ failOnPrerenderConflict: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
982
984
  }, "strict", z.ZodTypeAny, {
983
985
  clientPrerender: boolean;
984
986
  contentIntellisense: boolean;
@@ -1000,6 +1002,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1000
1002
  };
1001
1003
  staticImportMetaEnv: boolean;
1002
1004
  chromeDevtoolsWorkspace: boolean;
1005
+ failOnPrerenderConflict: boolean;
1003
1006
  fonts?: ({
1004
1007
  name: string;
1005
1008
  cssVariable: string;
@@ -1131,6 +1134,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1131
1134
  } | undefined;
1132
1135
  staticImportMetaEnv?: boolean | undefined;
1133
1136
  chromeDevtoolsWorkspace?: boolean | undefined;
1137
+ failOnPrerenderConflict?: boolean | undefined;
1134
1138
  }>>;
1135
1139
  legacy: z.ZodDefault<z.ZodObject<{
1136
1140
  collections: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1292,6 +1296,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1292
1296
  };
1293
1297
  staticImportMetaEnv: boolean;
1294
1298
  chromeDevtoolsWorkspace: boolean;
1299
+ failOnPrerenderConflict: boolean;
1295
1300
  fonts?: ({
1296
1301
  name: string;
1297
1302
  cssVariable: string;
@@ -1622,6 +1627,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
1622
1627
  } | undefined;
1623
1628
  staticImportMetaEnv?: boolean | undefined;
1624
1629
  chromeDevtoolsWorkspace?: boolean | undefined;
1630
+ failOnPrerenderConflict?: boolean | undefined;
1625
1631
  } | undefined;
1626
1632
  legacy?: {
1627
1633
  collections?: boolean | undefined;
@@ -60,7 +60,8 @@ const ASTRO_CONFIG_DEFAULTS = {
60
60
  liveContentCollections: false,
61
61
  csp: false,
62
62
  staticImportMetaEnv: false,
63
- chromeDevtoolsWorkspace: false
63
+ chromeDevtoolsWorkspace: false,
64
+ failOnPrerenderConflict: false
64
65
  }
65
66
  };
66
67
  const highlighterTypesSchema = z.union([z.literal("shiki"), z.literal("prism")]).default(syntaxHighlightDefaults.type);
@@ -287,7 +288,8 @@ const AstroConfigSchema = z.object({
287
288
  })
288
289
  ]).optional().default(ASTRO_CONFIG_DEFAULTS.experimental.csp),
289
290
  staticImportMetaEnv: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.staticImportMetaEnv),
290
- chromeDevtoolsWorkspace: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.chromeDevtoolsWorkspace)
291
+ chromeDevtoolsWorkspace: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.chromeDevtoolsWorkspace),
292
+ failOnPrerenderConflict: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.failOnPrerenderConflict)
291
293
  }).strict(
292
294
  `Invalid or outdated experimental feature.
293
295
  Check for incorrect spelling or outdated Astro version.
@@ -828,6 +828,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
828
828
  }>]>>>;
829
829
  staticImportMetaEnv: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
830
830
  chromeDevtoolsWorkspace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
831
+ failOnPrerenderConflict: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
831
832
  }, "strict", z.ZodTypeAny, {
832
833
  clientPrerender: boolean;
833
834
  contentIntellisense: boolean;
@@ -849,6 +850,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
849
850
  };
850
851
  staticImportMetaEnv: boolean;
851
852
  chromeDevtoolsWorkspace: boolean;
853
+ failOnPrerenderConflict: boolean;
852
854
  fonts?: ({
853
855
  name: string;
854
856
  cssVariable: string;
@@ -980,6 +982,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
980
982
  } | undefined;
981
983
  staticImportMetaEnv?: boolean | undefined;
982
984
  chromeDevtoolsWorkspace?: boolean | undefined;
985
+ failOnPrerenderConflict?: boolean | undefined;
983
986
  }>>;
984
987
  legacy: z.ZodDefault<z.ZodObject<{
985
988
  collections: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1219,6 +1222,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1219
1222
  };
1220
1223
  staticImportMetaEnv: boolean;
1221
1224
  chromeDevtoolsWorkspace: boolean;
1225
+ failOnPrerenderConflict: boolean;
1222
1226
  fonts?: ({
1223
1227
  name: string;
1224
1228
  cssVariable: string;
@@ -1549,6 +1553,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1549
1553
  } | undefined;
1550
1554
  staticImportMetaEnv?: boolean | undefined;
1551
1555
  chromeDevtoolsWorkspace?: boolean | undefined;
1556
+ failOnPrerenderConflict?: boolean | undefined;
1552
1557
  } | undefined;
1553
1558
  legacy?: {
1554
1559
  collections?: boolean | undefined;
@@ -1707,6 +1712,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1707
1712
  };
1708
1713
  staticImportMetaEnv: boolean;
1709
1714
  chromeDevtoolsWorkspace: boolean;
1715
+ failOnPrerenderConflict: boolean;
1710
1716
  fonts?: ({
1711
1717
  name: string;
1712
1718
  cssVariable: string;
@@ -2037,6 +2043,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
2037
2043
  } | undefined;
2038
2044
  staticImportMetaEnv?: boolean | undefined;
2039
2045
  chromeDevtoolsWorkspace?: boolean | undefined;
2046
+ failOnPrerenderConflict?: boolean | undefined;
2040
2047
  } | undefined;
2041
2048
  legacy?: {
2042
2049
  collections?: boolean | undefined;
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.13.11";
1
+ const ASTRO_VERSION = "5.14.1";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
4
4
  const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
@@ -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.13.11";
25
+ const currentVersion = "5.14.1";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -539,6 +539,21 @@ export declare const PrerenderDynamicEndpointPathCollide: {
539
539
  message: (pathname: string) => string;
540
540
  hint: (filename: string) => string;
541
541
  };
542
+ /**
543
+ * @docs
544
+ * @see
545
+ * - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
546
+ * - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
547
+ * @description
548
+ * Two prerendered routes generate the same path, resulting in a collision.
549
+ * A static path can only be generated by one route.
550
+ */
551
+ export declare const PrerenderRouteConflict: {
552
+ name: string;
553
+ title: string;
554
+ message: (winningRoute: string, thisRoute: string, pathname: string) => string;
555
+ hint: (winningRoute: string, thisRoute: string) => string;
556
+ };
542
557
  /**
543
558
  * @docs
544
559
  * @see
@@ -664,8 +679,10 @@ export declare const CouldNotTransformImage: {
664
679
  };
665
680
  /**
666
681
  * @docs
682
+ * @see
683
+ * - [HTML streaming](https://docs.astro.build/en/guides/on-demand-rendering/#html-streaming)
667
684
  * @description
668
- * Making changes to the response, such as setting headers, cookies, and the status code cannot be done outside of page components.
685
+ * Making changes to the response, such as setting headers, cookies, and the status code can only be done in [page components](https://docs.astro.build/en/basics/astro-pages/).
669
686
  */
670
687
  export declare const ResponseSentError: {
671
688
  name: string;
@@ -1222,7 +1239,7 @@ export declare const ExperimentalFontsNotEnabled: {
1222
1239
  * @description
1223
1240
  * Font family not found
1224
1241
  * @message
1225
- * No data was found for the family passed to the Font component.
1242
+ * No data was found for the `cssVariable` passed to the `<Font />` component or to the `getFontData()` function.
1226
1243
  */
1227
1244
  export declare const FontFamilyNotFound: {
1228
1245
  name: string;
@@ -194,6 +194,12 @@ const PrerenderDynamicEndpointPathCollide = {
194
194
  message: (pathname) => `Could not render \`${pathname}\` with an \`undefined\` param as the generated path will collide during prerendering. Prevent passing \`undefined\` as \`params\` for the endpoint's \`getStaticPaths()\` function, or add an additional extension to the endpoint's filename.`,
195
195
  hint: (filename) => `Rename \`${filename}\` to \`${filename.replace(/\.(?:js|ts)/, (m) => `.json` + m)}\``
196
196
  };
197
+ const PrerenderRouteConflict = {
198
+ name: "PrerenderRouteConflict",
199
+ title: "Prerendered route generates the same path as another route.",
200
+ message: (winningRoute, thisRoute, pathname) => `Could not render \`${pathname}\` from route \`${thisRoute}\` as it conflicts with higher priority route \`${winningRoute}\`.`,
201
+ hint: (winningRoute, thisRoute) => `Ensure \`${thisRoute}\` and \`${winningRoute}\` don't generate the same static paths.`
202
+ };
197
203
  const ExpectedImage = {
198
204
  name: "ExpectedImage",
199
205
  title: "Expected src to be an image.",
@@ -462,7 +468,7 @@ const FontFamilyNotFound = {
462
468
  name: "FontFamilyNotFound",
463
469
  title: "Font family not found",
464
470
  message: (family) => `No data was found for the \`"${family}"\` family passed to the \`<Font>\` component.`,
465
- hint: "This is often caused by a typo. Check that your Font component is using a `cssVariable` specified in your config."
471
+ hint: "This is often caused by a typo. Check that the `<Font />` component or `getFontData()` function are using a `cssVariable` specified in your config."
466
472
  };
467
473
  const CspNotEnabled = {
468
474
  name: "CspNotEnabled",
@@ -817,6 +823,7 @@ export {
817
823
  PageNumberParamNotFound,
818
824
  PrerenderClientAddressNotAvailable,
819
825
  PrerenderDynamicEndpointPathCollide,
826
+ PrerenderRouteConflict,
820
827
  RedirectWithNoLocation,
821
828
  RenderUndefinedEntryError,
822
829
  ReservedSlotName,
@@ -37,7 +37,7 @@ function serverStart({
37
37
  host,
38
38
  base
39
39
  }) {
40
- const version = "5.13.11";
40
+ const version = "5.14.1";
41
41
  const localPrefix = `${dim("\u2503")} Local `;
42
42
  const networkPrefix = `${dim("\u2503")} Network `;
43
43
  const emptyPrefix = " ".repeat(11);
@@ -274,7 +274,7 @@ function printHelp({
274
274
  message.push(
275
275
  linebreak(),
276
276
  ` ${bgGreen(black(` ${commandName} `))} ${green(
277
- `v${"5.13.11"}`
277
+ `v${"5.14.1"}`
278
278
  )} ${headline}`
279
279
  );
280
280
  }
@@ -29,7 +29,8 @@ async function callGetStaticPaths({
29
29
  staticPaths = await mod.getStaticPaths({
30
30
  // Q: Why the cast?
31
31
  // A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here
32
- paginate: generatePaginateFunction(route, base)
32
+ paginate: generatePaginateFunction(route, base),
33
+ routePattern: route.route
33
34
  });
34
35
  validateGetStaticPathsResult(staticPaths, logger, route);
35
36
  const keyedStaticPaths = staticPaths;
@@ -8,6 +8,7 @@ import type { APIContext } from './context.js';
8
8
  */
9
9
  export interface GetStaticPathsOptions {
10
10
  paginate: PaginateFunction;
11
+ routePattern: string;
11
12
  }
12
13
  export type GetStaticPathsItem = {
13
14
  params: {
@@ -1966,6 +1966,17 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1966
1966
  * See the [Prefetch Guide](https://docs.astro.build/en/guides/prefetch/) for more `prefetch` options and usage.
1967
1967
  */
1968
1968
  clientPrerender?: boolean;
1969
+ /**
1970
+ *
1971
+ * @name experimental.failOnPrerenderConflict
1972
+ * @type {boolean}
1973
+ * @default `false`
1974
+ * @version 5.x
1975
+ * @description
1976
+ * When two routes generate the same prerendered URL, fail the build instead of skipping one.
1977
+ * If disabled (default), a warning is logged when conflicts occur and the highest-priority route wins.
1978
+ */
1979
+ failOnPrerenderConflict?: boolean;
1969
1980
  /**
1970
1981
  *
1971
1982
  * @name experimental.contentIntellisense
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "5.13.11",
3
+ "version": "5.14.1",
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",
@@ -60,6 +60,7 @@
60
60
  "./assets/services/sharp": "./dist/assets/services/sharp.js",
61
61
  "./assets/services/noop": "./dist/assets/services/noop.js",
62
62
  "./assets/fonts/providers/*": "./dist/assets/fonts/providers/entrypoints/*.js",
63
+ "./assets/fonts/runtime": "./dist/assets/fonts/runtime.js",
63
64
  "./loaders": "./dist/content/loaders/index.js",
64
65
  "./content/config": "./dist/content/config.js",
65
66
  "./content/runtime": "./dist/content/runtime.js",
package/types/fonts.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  declare module 'astro:assets' {
2
2
  /** @internal Run `astro dev` or `astro sync` to generate high fidelity types */
3
- export type FontFamily = string;
3
+ export type CssVariable = string;
4
+
5
+ /** The data returned by `getFontData()` */
6
+ export type FontData = import('../dist/assets/fonts/types.js').FontData;
4
7
  }
package/types.d.ts CHANGED
@@ -30,3 +30,5 @@ export type Polymorphic<P extends { as: HTMLTag }> = PolymorphicAttributes<
30
30
  >;
31
31
 
32
32
  export type ComponentProps<T extends (args: any) => any> = Simplify<Parameters<T>[0]>;
33
+
34
+ export type SvgComponent = (props: astroHTML.JSX.SVGAttributes) => any;