astro 5.7.5 → 5.7.7

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.
Files changed (74) hide show
  1. package/components/image.css +5 -12
  2. package/dist/assets/fonts/config.d.ts +9 -9
  3. package/dist/assets/fonts/config.js +3 -4
  4. package/dist/assets/fonts/constants.d.ts +3 -73
  5. package/dist/assets/fonts/constants.js +16 -68
  6. package/dist/assets/fonts/definitions.d.ts +73 -0
  7. package/dist/assets/fonts/definitions.js +0 -0
  8. package/dist/assets/fonts/implementations/css-renderer.d.ts +9 -0
  9. package/dist/assets/fonts/implementations/css-renderer.js +42 -0
  10. package/dist/assets/fonts/implementations/data-collector.d.ts +3 -0
  11. package/dist/assets/fonts/implementations/data-collector.js +21 -0
  12. package/dist/assets/fonts/implementations/error-handler.d.ts +2 -0
  13. package/dist/assets/fonts/implementations/error-handler.js +33 -0
  14. package/dist/assets/fonts/implementations/font-fetcher.d.ts +8 -0
  15. package/dist/assets/fonts/implementations/font-fetcher.js +34 -0
  16. package/dist/assets/fonts/implementations/font-metrics-resolver.d.ts +5 -0
  17. package/dist/assets/fonts/implementations/font-metrics-resolver.js +60 -0
  18. package/dist/assets/fonts/implementations/font-type-extractor.d.ts +4 -0
  19. package/dist/assets/fonts/implementations/font-type-extractor.js +22 -0
  20. package/dist/assets/fonts/implementations/hasher.d.ts +2 -0
  21. package/dist/assets/fonts/implementations/hasher.js +14 -0
  22. package/dist/assets/fonts/implementations/local-provider-url-resolver.d.ts +5 -0
  23. package/dist/assets/fonts/implementations/local-provider-url-resolver.js +17 -0
  24. package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.d.ts +6 -0
  25. package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.js +20 -0
  26. package/dist/assets/fonts/implementations/remote-font-provider-resolver.d.ts +6 -0
  27. package/dist/assets/fonts/implementations/remote-font-provider-resolver.js +47 -0
  28. package/dist/assets/fonts/implementations/storage.d.ts +4 -0
  29. package/dist/assets/fonts/implementations/storage.js +14 -0
  30. package/dist/assets/fonts/implementations/system-fallbacks-provider.d.ts +11 -0
  31. package/dist/assets/fonts/implementations/system-fallbacks-provider.js +74 -0
  32. package/dist/assets/fonts/implementations/url-proxy-content-resolver.d.ts +5 -0
  33. package/dist/assets/fonts/implementations/url-proxy-content-resolver.js +28 -0
  34. package/dist/assets/fonts/implementations/url-proxy.d.ts +8 -0
  35. package/dist/assets/fonts/implementations/url-proxy.js +26 -0
  36. package/dist/assets/fonts/logic/extract-unifont-providers.d.ts +10 -0
  37. package/dist/assets/fonts/logic/extract-unifont-providers.js +28 -0
  38. package/dist/assets/fonts/logic/normalize-remote-font-faces.d.ts +6 -0
  39. package/dist/assets/fonts/logic/normalize-remote-font-faces.js +36 -0
  40. package/dist/assets/fonts/logic/optimize-fallbacks.d.ts +17 -0
  41. package/dist/assets/fonts/logic/optimize-fallbacks.js +47 -0
  42. package/dist/assets/fonts/logic/resolve-families.d.ts +17 -0
  43. package/dist/assets/fonts/logic/resolve-families.js +67 -0
  44. package/dist/assets/fonts/orchestrate.d.ts +37 -0
  45. package/dist/assets/fonts/orchestrate.js +125 -0
  46. package/dist/assets/fonts/providers/local.d.ts +6 -7
  47. package/dist/assets/fonts/providers/local.js +26 -29
  48. package/dist/assets/fonts/types.d.ts +32 -2
  49. package/dist/assets/fonts/utils.d.ts +17 -87
  50. package/dist/assets/fonts/utils.js +21 -183
  51. package/dist/assets/fonts/vite-plugin-fonts.js +98 -80
  52. package/dist/assets/internal.js +0 -2
  53. package/dist/assets/layout.js +4 -4
  54. package/dist/assets/types.d.ts +4 -4
  55. package/dist/content/content-layer.js +3 -3
  56. package/dist/core/config/schemas/base.d.ts +19 -19
  57. package/dist/core/config/schemas/base.js +1 -1
  58. package/dist/core/config/schemas/relative.d.ts +25 -25
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/dev/dev.js +1 -1
  61. package/dist/core/errors/errors-data.d.ts +2 -1
  62. package/dist/core/errors/errors-data.js +2 -1
  63. package/dist/core/messages.js +2 -2
  64. package/dist/core/routing/manifest/create.js +4 -1
  65. package/dist/types/public/config.d.ts +19 -22
  66. package/dist/vite-plugin-markdown/images.js +4 -4
  67. package/package.json +4 -4
  68. package/types/content.d.ts +11 -4
  69. package/dist/assets/fonts/load.d.ts +0 -20
  70. package/dist/assets/fonts/load.js +0 -162
  71. package/dist/assets/fonts/metrics.d.ts +0 -10
  72. package/dist/assets/fonts/metrics.js +0 -55
  73. package/dist/assets/fonts/providers/utils.d.ts +0 -9
  74. package/dist/assets/fonts/providers/utils.js +0 -37
@@ -165,7 +165,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
165
165
  hostname?: string | undefined;
166
166
  pathname?: string | undefined;
167
167
  }>, "many">>;
168
- experimentalLayout: z.ZodOptional<z.ZodEnum<["responsive", "fixed", "full-width", "none"]>>;
168
+ experimentalLayout: z.ZodOptional<z.ZodEnum<["constrained", "fixed", "full-width", "none"]>>;
169
169
  experimentalObjectFit: z.ZodOptional<z.ZodString>;
170
170
  experimentalObjectPosition: z.ZodOptional<z.ZodString>;
171
171
  experimentalBreakpoints: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
@@ -185,7 +185,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
185
185
  hostname?: string | undefined;
186
186
  pathname?: string | undefined;
187
187
  }[];
188
- experimentalLayout?: "none" | "fixed" | "responsive" | "full-width" | undefined;
188
+ experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
189
189
  experimentalObjectFit?: string | undefined;
190
190
  experimentalObjectPosition?: string | undefined;
191
191
  experimentalBreakpoints?: number[] | undefined;
@@ -205,7 +205,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
205
205
  hostname?: string | undefined;
206
206
  pathname?: string | undefined;
207
207
  }[] | undefined;
208
- experimentalLayout?: "none" | "fixed" | "responsive" | "full-width" | undefined;
208
+ experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
209
209
  experimentalObjectFit?: string | undefined;
210
210
  experimentalObjectPosition?: string | undefined;
211
211
  experimentalBreakpoints?: number[] | undefined;
@@ -653,7 +653,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
653
653
  name: z.ZodString;
654
654
  cssVariable: z.ZodString;
655
655
  }, {
656
- fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
656
+ fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
657
657
  optimizedFallbacks: z.ZodOptional<z.ZodBoolean>;
658
658
  }>, {
659
659
  provider: z.ZodLiteral<"local">;
@@ -742,7 +742,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
742
742
  featureSettings?: string | undefined;
743
743
  variationSettings?: string | undefined;
744
744
  }[]];
745
- fallbacks?: [string, ...string[]] | undefined;
745
+ fallbacks?: string[] | undefined;
746
746
  optimizedFallbacks?: boolean | undefined;
747
747
  }, {
748
748
  name: string;
@@ -779,7 +779,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
779
779
  featureSettings?: string | undefined;
780
780
  variationSettings?: string | undefined;
781
781
  }[]];
782
- fallbacks?: [string, ...string[]] | undefined;
782
+ fallbacks?: string[] | undefined;
783
783
  optimizedFallbacks?: boolean | undefined;
784
784
  }>, z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
785
785
  name: z.ZodString;
@@ -793,7 +793,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
793
793
  featureSettings: z.ZodOptional<z.ZodString>;
794
794
  variationSettings: z.ZodOptional<z.ZodString>;
795
795
  }, "style" | "weight">>, {
796
- fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
796
+ fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
797
797
  optimizedFallbacks: z.ZodOptional<z.ZodBoolean>;
798
798
  }>, {
799
799
  provider: z.ZodObject<{
@@ -816,7 +816,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
816
816
  entrypoint: string | URL;
817
817
  config?: Record<string, any> | undefined;
818
818
  };
819
- fallbacks?: [string, ...string[]] | undefined;
819
+ fallbacks?: string[] | undefined;
820
820
  optimizedFallbacks?: boolean | undefined;
821
821
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
822
822
  unicodeRange?: [string, ...string[]] | undefined;
@@ -833,7 +833,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
833
833
  entrypoint: string | URL;
834
834
  config?: Record<string, any> | undefined;
835
835
  };
836
- fallbacks?: [string, ...string[]] | undefined;
836
+ fallbacks?: string[] | undefined;
837
837
  optimizedFallbacks?: boolean | undefined;
838
838
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
839
839
  unicodeRange?: [string, ...string[]] | undefined;
@@ -885,7 +885,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
885
885
  featureSettings?: string | undefined;
886
886
  variationSettings?: string | undefined;
887
887
  }[]];
888
- fallbacks?: [string, ...string[]] | undefined;
888
+ fallbacks?: string[] | undefined;
889
889
  optimizedFallbacks?: boolean | undefined;
890
890
  } | {
891
891
  name: string;
@@ -894,7 +894,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
894
894
  entrypoint: string | URL;
895
895
  config?: Record<string, any> | undefined;
896
896
  };
897
- fallbacks?: [string, ...string[]] | undefined;
897
+ fallbacks?: string[] | undefined;
898
898
  optimizedFallbacks?: boolean | undefined;
899
899
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
900
900
  unicodeRange?: [string, ...string[]] | undefined;
@@ -946,7 +946,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
946
946
  featureSettings?: string | undefined;
947
947
  variationSettings?: string | undefined;
948
948
  }[]];
949
- fallbacks?: [string, ...string[]] | undefined;
949
+ fallbacks?: string[] | undefined;
950
950
  optimizedFallbacks?: boolean | undefined;
951
951
  } | {
952
952
  name: string;
@@ -955,7 +955,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
955
955
  entrypoint: string | URL;
956
956
  config?: Record<string, any> | undefined;
957
957
  };
958
- fallbacks?: [string, ...string[]] | undefined;
958
+ fallbacks?: string[] | undefined;
959
959
  optimizedFallbacks?: boolean | undefined;
960
960
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
961
961
  unicodeRange?: [string, ...string[]] | undefined;
@@ -1109,7 +1109,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1109
1109
  hostname?: string | undefined;
1110
1110
  pathname?: string | undefined;
1111
1111
  }[];
1112
- experimentalLayout?: "none" | "fixed" | "responsive" | "full-width" | undefined;
1112
+ experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
1113
1113
  experimentalObjectFit?: string | undefined;
1114
1114
  experimentalObjectPosition?: string | undefined;
1115
1115
  experimentalBreakpoints?: number[] | undefined;
@@ -1224,7 +1224,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1224
1224
  featureSettings?: string | undefined;
1225
1225
  variationSettings?: string | undefined;
1226
1226
  }[]];
1227
- fallbacks?: [string, ...string[]] | undefined;
1227
+ fallbacks?: string[] | undefined;
1228
1228
  optimizedFallbacks?: boolean | undefined;
1229
1229
  } | {
1230
1230
  name: string;
@@ -1233,7 +1233,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1233
1233
  entrypoint: string | URL;
1234
1234
  config?: Record<string, any> | undefined;
1235
1235
  };
1236
- fallbacks?: [string, ...string[]] | undefined;
1236
+ fallbacks?: string[] | undefined;
1237
1237
  optimizedFallbacks?: boolean | undefined;
1238
1238
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
1239
1239
  unicodeRange?: [string, ...string[]] | undefined;
@@ -1341,7 +1341,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1341
1341
  hostname?: string | undefined;
1342
1342
  pathname?: string | undefined;
1343
1343
  }[] | undefined;
1344
- experimentalLayout?: "none" | "fixed" | "responsive" | "full-width" | undefined;
1344
+ experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
1345
1345
  experimentalObjectFit?: string | undefined;
1346
1346
  experimentalObjectPosition?: string | undefined;
1347
1347
  experimentalBreakpoints?: number[] | undefined;
@@ -1483,7 +1483,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1483
1483
  featureSettings?: string | undefined;
1484
1484
  variationSettings?: string | undefined;
1485
1485
  }[]];
1486
- fallbacks?: [string, ...string[]] | undefined;
1486
+ fallbacks?: string[] | undefined;
1487
1487
  optimizedFallbacks?: boolean | undefined;
1488
1488
  } | {
1489
1489
  name: string;
@@ -1492,7 +1492,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1492
1492
  entrypoint: string | URL;
1493
1493
  config?: Record<string, any> | undefined;
1494
1494
  };
1495
- fallbacks?: [string, ...string[]] | undefined;
1495
+ fallbacks?: string[] | undefined;
1496
1496
  optimizedFallbacks?: boolean | undefined;
1497
1497
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
1498
1498
  unicodeRange?: [string, ...string[]] | undefined;
@@ -1565,7 +1565,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1565
1565
  hostname?: string | undefined;
1566
1566
  pathname?: string | undefined;
1567
1567
  }[];
1568
- experimentalLayout?: "none" | "fixed" | "responsive" | "full-width" | undefined;
1568
+ experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
1569
1569
  experimentalObjectFit?: string | undefined;
1570
1570
  experimentalObjectPosition?: string | undefined;
1571
1571
  experimentalBreakpoints?: number[] | undefined;
@@ -1680,7 +1680,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1680
1680
  featureSettings?: string | undefined;
1681
1681
  variationSettings?: string | undefined;
1682
1682
  }[]];
1683
- fallbacks?: [string, ...string[]] | undefined;
1683
+ fallbacks?: string[] | undefined;
1684
1684
  optimizedFallbacks?: boolean | undefined;
1685
1685
  } | {
1686
1686
  name: string;
@@ -1689,7 +1689,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1689
1689
  entrypoint: string | URL;
1690
1690
  config?: Record<string, any> | undefined;
1691
1691
  };
1692
- fallbacks?: [string, ...string[]] | undefined;
1692
+ fallbacks?: string[] | undefined;
1693
1693
  optimizedFallbacks?: boolean | undefined;
1694
1694
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
1695
1695
  unicodeRange?: [string, ...string[]] | undefined;
@@ -1797,7 +1797,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1797
1797
  hostname?: string | undefined;
1798
1798
  pathname?: string | undefined;
1799
1799
  }[] | undefined;
1800
- experimentalLayout?: "none" | "fixed" | "responsive" | "full-width" | undefined;
1800
+ experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
1801
1801
  experimentalObjectFit?: string | undefined;
1802
1802
  experimentalObjectPosition?: string | undefined;
1803
1803
  experimentalBreakpoints?: number[] | undefined;
@@ -1939,7 +1939,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1939
1939
  featureSettings?: string | undefined;
1940
1940
  variationSettings?: string | undefined;
1941
1941
  }[]];
1942
- fallbacks?: [string, ...string[]] | undefined;
1942
+ fallbacks?: string[] | undefined;
1943
1943
  optimizedFallbacks?: boolean | undefined;
1944
1944
  } | {
1945
1945
  name: string;
@@ -1948,7 +1948,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1948
1948
  entrypoint: string | URL;
1949
1949
  config?: Record<string, any> | undefined;
1950
1950
  };
1951
- fallbacks?: [string, ...string[]] | undefined;
1951
+ fallbacks?: string[] | undefined;
1952
1952
  optimizedFallbacks?: boolean | undefined;
1953
1953
  display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
1954
1954
  unicodeRange?: [string, ...string[]] | undefined;
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.7.5";
1
+ const ASTRO_VERSION = "5.7.7";
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.7.5";
25
+ const currentVersion = "5.7.7";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -874,7 +874,8 @@ export declare const RedirectWithNoLocation: {
874
874
  export declare const UnsupportedExternalRedirect: {
875
875
  name: string;
876
876
  title: string;
877
- message: string;
877
+ message: (from: string, to: string) => string;
878
+ hint: string;
878
879
  };
879
880
  /**
880
881
  * @docs
@@ -305,7 +305,8 @@ const RedirectWithNoLocation = {
305
305
  const UnsupportedExternalRedirect = {
306
306
  name: "UnsupportedExternalRedirect",
307
307
  title: "Unsupported or malformed URL.",
308
- message: "An external redirect must start with http or https, and must be a valid URL."
308
+ message: (from, to) => `The destination URL in the external redirect from "${from}" to "${to}" is unsupported.`,
309
+ hint: "An external redirect must start with http or https, and must be a valid URL."
309
310
  };
310
311
  const InvalidDynamicRoute = {
311
312
  name: "InvalidDynamicRoute",
@@ -37,7 +37,7 @@ function serverStart({
37
37
  host,
38
38
  base
39
39
  }) {
40
- const version = "5.7.5";
40
+ const version = "5.7.7";
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.7.5"}`
277
+ `v${"5.7.7"}`
278
278
  )} ${headline}`
279
279
  );
280
280
  }
@@ -237,7 +237,10 @@ function createRedirectRoutes({ settings }, routeMap) {
237
237
  destination = to.destination;
238
238
  }
239
239
  if (URL.canParse(destination) && !/^https?:\/\//.test(destination)) {
240
- throw new AstroError(UnsupportedExternalRedirect);
240
+ throw new AstroError({
241
+ ...UnsupportedExternalRedirect,
242
+ message: UnsupportedExternalRedirect.message(from, destination)
243
+ });
241
244
  }
242
245
  routes.push({
243
246
  type: "redirect",
@@ -312,9 +312,9 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
312
312
  * @see output
313
313
  * @description
314
314
  *
315
- * Deploy to your favorite server, serverless, or edge host with build adapters. Import one of our first-party adapters for [Netlify](https://docs.astro.build/en/guides/deploy/netlify/#adapter-for-ssr), [Vercel](https://docs.astro.build/en/guides/deploy/vercel/#adapter-for-ssr), and more to engage Astro SSR.
315
+ * Deploy to your favorite server, serverless, or edge host with build adapters. Import one of our first-party adapters ([Cloudflare](/en/guides/integrations-guide/cloudflare/), [Netlify](/en/guides/integrations-guide/netlify/), [Node.js](/en/guides/integrations-guide/node/), [Vercel](/en/guides/integrations-guide/vercel/)) or explore [community adapters](https://astro.build/integrations/2/?search=&categories%5B%5D=adapters) to enable on-demand rendering in your Astro project.
316
316
  *
317
- * [See our On-demand Rendering guide](https://docs.astro.build/en/guides/on-demand-rendering/) for more on SSR, and [our deployment guides](https://docs.astro.build/en/guides/deploy/) for a complete list of hosts.
317
+ * See our [on-demand rendering guide](/en/guides/on-demand-rendering/) for more on Astro's server rendering options.
318
318
  *
319
319
  * ```js
320
320
  * import netlify from '@astrojs/netlify';
@@ -1246,7 +1246,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1246
1246
  * @description
1247
1247
  * The default layout type for responsive images. Can be overridden by the `layout` prop on the image component.
1248
1248
  * Requires the `experimental.responsiveImages` flag to be enabled.
1249
- * - `responsive` - The image will scale to fit the container, maintaining its aspect ratio, but will not exceed the specified dimensions.
1249
+ * - `constrained` - The image will scale to fit the container, maintaining its aspect ratio, but will not exceed the specified dimensions.
1250
1250
  * - `fixed` - The image will maintain its original dimensions.
1251
1251
  * - `full-width` - The image will scale to fit the container, maintaining its aspect ratio.
1252
1252
  */
@@ -1982,14 +1982,14 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
1982
1982
  * }
1983
1983
  * ```
1984
1984
  *
1985
- * When enabled, you can pass a `layout` props to any `<Image />` or `<Picture />` component to create a responsive image. When a layout is set, images have automatically generated `srcset` and `sizes` attributes based on the image's dimensions and the layout type. Images with `responsive` and `full-width` layouts will have styles applied to ensure they resize according to their container.
1985
+ * When enabled, you can pass a `layout` props to any `<Image />` or `<Picture />` component to create a responsive image. When a layout is set, images have automatically generated `srcset` and `sizes` attributes based on the image's dimensions and the layout type. Images with `constrained` and `full-width` layouts will have styles applied to ensure they resize according to their container.
1986
1986
  *
1987
1987
  * ```astro title=MyComponent.astro
1988
1988
  * ---
1989
1989
  * import { Image, Picture } from 'astro:assets';
1990
1990
  * import myImage from '../assets/my_image.png';
1991
1991
  * ---
1992
- * <Image src={myImage} alt="A description of my image." layout='responsive' width={800} height={600} />
1992
+ * <Image src={myImage} alt="A description of my image." layout='constrained' width={800} height={600} />
1993
1993
  * <Picture src={myImage} alt="A description of my image." layout='full-width' formats={['avif', 'webp', 'jpeg']} />
1994
1994
  * ```
1995
1995
  * This `<Image />` component will generate the following HTML output:
@@ -2011,31 +2011,28 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
2011
2011
  * fetchpriority="auto"
2012
2012
  * width="800"
2013
2013
  * height="600"
2014
- * style="--w: 800; --h: 600; --fit: cover; --pos: center;"
2015
- * data-astro-image="responsive"
2014
+ * style="--fit: cover; --pos: center;"
2015
+ * data-astro-image="constrained"
2016
2016
  * >
2017
2017
  * ```
2018
2018
  *
2019
2019
  * The following styles are applied to ensure the images resize correctly:
2020
2020
  *
2021
2021
  * ```css title="Responsive Image Styles"
2022
- * [data-astro-image] {
2023
- * width: 100%;
2024
- * height: auto;
2025
- * object-fit: var(--fit);
2026
- * object-position: var(--pos);
2027
- * aspect-ratio: var(--w) / var(--h)
2022
+ *
2023
+ * :where([data-astro-image]) {
2024
+ * object-fit: var(--fit);
2025
+ * object-position: var(--pos);
2028
2026
  * }
2029
2027
  *
2030
- * [data-astro-image=responsive] {
2031
- * max-width: calc(var(--w) * 1px);
2032
- * max-height: calc(var(--h) * 1px)
2028
+ * :where([data-astro-image='full-width']) {
2029
+ * width: 100%;
2033
2030
  * }
2034
2031
  *
2035
- * [data-astro-image=fixed] {
2036
- * width: calc(var(--w) * 1px);
2037
- * height: calc(var(--h) * 1px)
2032
+ * :where([data-astro-image='constrained']) {
2033
+ * max-width: 100%;
2038
2034
  * }
2035
+ *
2039
2036
  * ```
2040
2037
  * You can enable responsive images for all `<Image />` and `<Picture />` components by setting `image.experimentalLayout` with a default value. This can be overridden by the `layout` prop on each component.
2041
2038
  *
@@ -2044,7 +2041,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
2044
2041
  * {
2045
2042
  * image: {
2046
2043
  * // Used for all `<Image />` and `<Picture />` components unless overridden
2047
- * experimentalLayout: 'responsive',
2044
+ * experimentalLayout: 'constrained',
2048
2045
  * },
2049
2046
  * experimental: {
2050
2047
  * responsiveImages: true,
@@ -2069,12 +2066,12 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
2069
2066
  *
2070
2067
  * These are additional properties available to the `<Image />` and `<Picture />` components when responsive images are enabled:
2071
2068
  *
2072
- * - `layout`: The layout type for the image. Can be `responsive`, `fixed`, `full-width` or `none`. Defaults to value of `image.experimentalLayout`.
2069
+ * - `layout`: The layout type for the image. Can be `constrained`, `fixed`, `full-width` or `none`. Defaults to value of `image.experimentalLayout`.
2073
2070
  * - `fit`: Defines how the image should be cropped if the aspect ratio is changed. Values match those of CSS `object-fit`. Defaults to `cover`, or the value of `image.experimentalObjectFit` if set.
2074
2071
  * - `position`: Defines the position of the image crop if the aspect ratio is changed. Values match those of CSS `object-position`. Defaults to `center`, or the value of `image.experimentalObjectPosition` if set.
2075
2072
  * - `priority`: If set, eagerly loads the image. Otherwise images will be lazy-loaded. Use this for your largest above-the-fold image. Defaults to `false`.
2076
2073
  *
2077
- * The `widths` and `sizes` attributes are automatically generated based on the image's dimensions and the layout type, and in most cases should not be set manually. The generated `sizes` attribute for `responsive` and `full-width` images
2074
+ * The `widths` and `sizes` attributes are automatically generated based on the image's dimensions and the layout type, and in most cases should not be set manually. The generated `sizes` attribute for `constrained` and `full-width` images
2078
2075
  * is based on the assumption that the image is displayed at close to the full width of the screen when the viewport is smaller than the image's width. If it is significantly different (e.g. if it's in a multi-column layout on small screens) you may need to adjust the `sizes` attribute manually for best results.
2079
2076
  *
2080
2077
  * The `densities` attribute is not compatible with responsive images and will be ignored if set.
@@ -6,7 +6,7 @@ function getMarkdownCodeForImages(localImagePaths, remoteImagePaths, html) {
6
6
  const images = async function(html) {
7
7
  const imageSources = {};
8
8
  ${localImagePaths.map((entry) => {
9
- const rawUrl = JSON.stringify(entry.raw);
9
+ const rawUrl = JSON.stringify(entry.raw).replace(/'/g, "&#x27;");
10
10
  return `{
11
11
  const regex = new RegExp('__ASTRO_IMAGE_="([^"]*' + ${rawUrl.replace(
12
12
  /[.*+?^${}()|[\]\\]/g,
@@ -16,7 +16,7 @@ function getMarkdownCodeForImages(localImagePaths, remoteImagePaths, html) {
16
16
  let occurrenceCounter = 0;
17
17
  while ((match = regex.exec(html)) !== null) {
18
18
  const matchKey = ${rawUrl} + '_' + occurrenceCounter;
19
- const imageProps = JSON.parse(match[1].replace(/&#x22;/g, '"'));
19
+ const imageProps = JSON.parse(match[1].replace(/&#x22;/g, '"').replace(/&#x27;/g, "'"));
20
20
  const { src, ...props } = imageProps;
21
21
  imageSources[matchKey] = await getImage({src: Astro__${entry.safeName}, ...props});
22
22
  occurrenceCounter++;
@@ -24,7 +24,7 @@ function getMarkdownCodeForImages(localImagePaths, remoteImagePaths, html) {
24
24
  }`;
25
25
  }).join("\n")}
26
26
  ${remoteImagePaths.map((raw) => {
27
- const rawUrl = JSON.stringify(raw);
27
+ const rawUrl = JSON.stringify(raw).replace(/'/g, "&#x27;");
28
28
  return `{
29
29
  const regex = new RegExp('__ASTRO_IMAGE_="([^"]*' + ${rawUrl.replace(
30
30
  /[.*+?^${}()|[\]\\]/g,
@@ -34,7 +34,7 @@ function getMarkdownCodeForImages(localImagePaths, remoteImagePaths, html) {
34
34
  let occurrenceCounter = 0;
35
35
  while ((match = regex.exec(html)) !== null) {
36
36
  const matchKey = ${rawUrl} + '_' + occurrenceCounter;
37
- const props = JSON.parse(match[1].replace(/&#x22;/g, '"'));
37
+ const props = JSON.parse(match[1].replace(/&#x22;/g, '"').replace(/&#x27;/g, "'"));
38
38
  imageSources[matchKey] = await getImage(props);
39
39
  occurrenceCounter++;
40
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "5.7.5",
3
+ "version": "5.7.7",
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",
@@ -142,7 +142,7 @@
142
142
  "tinyglobby": "^0.2.12",
143
143
  "tsconfck": "^3.1.5",
144
144
  "ultrahtml": "^1.6.0",
145
- "unifont": "~0.2.0",
145
+ "unifont": "~0.4.0",
146
146
  "unist-util-visit": "^5.0.0",
147
147
  "unstorage": "^1.15.0",
148
148
  "vfile": "^6.0.3",
@@ -155,8 +155,8 @@
155
155
  "zod-to-json-schema": "^3.24.5",
156
156
  "zod-to-ts": "^1.2.0",
157
157
  "@astrojs/internal-helpers": "0.6.1",
158
- "@astrojs/markdown-remark": "6.3.1",
159
- "@astrojs/telemetry": "3.2.1"
158
+ "@astrojs/telemetry": "3.2.1",
159
+ "@astrojs/markdown-remark": "6.3.1"
160
160
  },
161
161
  "optionalDependencies": {
162
162
  "sharp": "^0.33.3"
@@ -45,11 +45,18 @@ declare module 'astro:content' {
45
45
  has: (key: string) => boolean;
46
46
  }
47
47
 
48
+ type BaseAtomicSchema = import('astro/zod').AnyZodObject;
49
+
50
+ type BaseCompositeSchema =
51
+ | import('astro/zod').ZodUnion<[BaseAtomicSchema, ...BaseAtomicSchema[]]>
52
+ | import('astro/zod').ZodDiscriminatedUnion<string, BaseAtomicSchema[]>
53
+ // If we have a union of unions, give up on trying to type-check it all. You're on your own.
54
+ | import('astro/zod').ZodUnion<[import('astro/zod').ZodUnion<z.any>, ...z.any[]]>;
55
+
48
56
  type BaseSchemaWithoutEffects =
49
- | import('astro/zod').AnyZodObject
50
- | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]>
51
- | import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
52
- | import('astro/zod').ZodIntersection<BaseSchemaWithoutEffects, BaseSchemaWithoutEffects>;
57
+ | BaseAtomicSchema
58
+ | BaseCompositeSchema
59
+ | import('astro/zod').ZodIntersection<BaseAtomicSchema, BaseAtomicSchema | BaseCompositeSchema>;
53
60
 
54
61
  export type BaseSchema =
55
62
  | BaseSchemaWithoutEffects
@@ -1,20 +0,0 @@
1
- import type { Storage } from 'unstorage';
2
- import type { generateFallbackFontFace } from './metrics.js';
3
- import type { PreloadData, ResolvedFontFamily } from './types.js';
4
- import { type GetMetricsForFamily } from './utils.js';
5
- interface Options {
6
- base: string;
7
- families: Array<ResolvedFontFamily>;
8
- storage: Storage;
9
- hashToUrlMap: Map<string, string>;
10
- resolvedMap: Map<string, {
11
- preloadData: PreloadData;
12
- css: string;
13
- }>;
14
- hashString: (value: string) => string;
15
- log: (message: string) => void;
16
- generateFallbackFontFace: typeof generateFallbackFontFace;
17
- getMetricsForFamily: GetMetricsForFamily;
18
- }
19
- export declare function loadFonts({ base, families, storage, hashToUrlMap, resolvedMap, hashString, generateFallbackFontFace, getMetricsForFamily, log, }: Options): Promise<void>;
20
- export {};