Repository: withastro/astro
File: packages/astro/src/assets/fonts/config.ts (TypeScript)

Code before:
	 * ```
	 *
	 * If you don't want any fallbacks, use an empty array:
	 *
	 * ```js
	 * fallbacks: []
	 * ```
	 *
	 * If `optimizedFallbacks` is set to `true`, we look for the last fallback and check if it's a [generic family name](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name). If so, we try to generate an [optimized fallback](https://developer.chrome.com/blog/font-fallbacks) using font metrics.
	 */
	fallbacks: z.array(z.string()).nonempty().optional(),
	/**
	 * @default `true`
	 *
	 * Whether or not to enable optimized fallback generation. Enabling this should only be needed if you want full control over the `fallbacks`.
	 */
	optimizedFallbacks: z.boolean().optional(),
});

export const requiredFamilyAttributesSchema = z.object({
	/**
	 * The font family name, as identified by your font provider.
	 */
	name: z.string(),
	/**
	 * A valid [ident](https://developer.mozilla.org/en-US/docs/Web/CSS/ident) in the form of a CSS variable.
	 */
	cssVariable: z.string(),
});

const entrypointSchema = z.union([z.string(), z.instanceof(URL)]);

export const fontProviderSchema = z
	.object({
		/**
		 * URL, path relative to the root or package import.
		 */
		entrypoint: entrypointSchema,
		/**
		 * Optional serializable object passed to the unifont provider.
		 */
		config: z.record(z.string(), z.any()).optional(),
	})
	.strict();

export const localFontFamilySchema = requiredFamilyAttributesSchema
	.merge(fallbacksSchema)
	.merge(
		z.object({
			/**
			 * The source of your font files. Set to `"local"` to use local font files.

Review comment (suggestion):
```suggestion
	 * A valid [ident](https://developer.mozilla.org/en-US/docs/Web/CSS/ident) in the form of a CSS variable (i.e. starting with `--`).
```
I don't know if special formatting for any of those characters is required, but here's where I think it's helpful to explicitly say "start with two dashes"

Code after:
	 * ```
	 *
	 * To disable fallback fonts completely, configure an empty array:
	 *
	 * ```js
	 * fallbacks: []
	 * ```
	 *

	 * If the last font in the `fallbacks` array is a [generic family name](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name), an [optimized fallback](https://developer.chrome.com/blog/font-fallbacks) using font metrics will be generated. To disable this optimization, set `optimizedFallbacks` to false.
	 */
	fallbacks: z.array(z.string()).nonempty().optional(),
	/**
	 * @default `true`
	 *
	 * Whether or not to enable optimized fallback generation. You may disable this default optimization to have full control over `fallbacks`.
	 */
	optimizedFallbacks: z.boolean().optional(),
});

export const requiredFamilyAttributesSchema = z.object({
	/**
	 * The font family name, as identified by your font provider.
	 */
	name: z.string(),
	/**
	 * A valid [ident](https://developer.mozilla.org/en-US/docs/Web/CSS/ident) in the form of a CSS variable (i.e. starting with `--`).
	 */
	cssVariable: z.string(),
});

const entrypointSchema = z.union([z.string(), z.instanceof(URL)]);

export const fontProviderSchema = z
	.object({
		/**
		 * URL, path relative to the root or package import.
		 */
		entrypoint: entrypointSchema,
		/**
		 * Optional serializable object passed to the unifont provider.
		 */
		config: z.record(z.string(), z.any()).optional(),
	})
	.strict();

export const localFontFamilySchema = requiredFamilyAttributesSchema
	.merge(fallbacksSchema)
	.merge(
		z.object({
			/**