main
 1import sitemap from "@astrojs/sitemap";
 2import { defineConfig, fontProviders } from "astro/config";
 3import { intlayer } from "astro-intlayer";
 4import { typst } from "astro-typst";
 5
 6import { DEFAULT_LOCALE, SITE_CONFIG, WEBSITE } from "./src/config.ts";
 7
 8import { extractImages } from "./src/integrations/extract-images.ts";
 9import { rehypeCleanEndnotes } from "./src/utils/plugins/clean-endnotes.ts";
10
11// https://astro.build/config
12export default defineConfig({
13  site: `${WEBSITE.protocol}://${WEBSITE.host}`,
14  base: WEBSITE.basePath,
15  i18n: {
16    locales: SITE_CONFIG.locales,
17    defaultLocale: DEFAULT_LOCALE,
18    routing: {
19      prefixDefaultLocale: false,
20    },
21  },
22  image: {
23    // Required by the `constrained` layout that `kp.img` sets by default.
24    responsiveStyles: true,
25    breakpoints: [640, 960, 1280],
26  },
27  integrations: [
28    sitemap({
29      i18n: {
30        defaultLocale: DEFAULT_LOCALE,
31        locales: Object.fromEntries(
32          SITE_CONFIG.locales.map((locale) => [locale, locale] as const),
33        ),
34      },
35    }),
36    intlayer(),
37    typst({
38      options: {
39        remPx: 16,
40      },
41      target: "html",
42    }),
43    extractImages(),
44  ],
45  markdown: {
46    // NOTE: `markdown.rehypePlugins` is deprecated in Astro v7.
47    // But astro-typst only read this entry for it's own hast process
48    // TODO: Replace with `markdown.processor = unified({rehypePlugins: [...]})`
49    // after astro-typst add Astro v7 style config support
50    rehypePlugins: [rehypeCleanEndnotes],
51  },
52  fonts: [
53    {
54      provider: fontProviders.google(),
55      name: "STIX Two Math",
56      cssVariable: "--font-stix-two-math",
57      fallbacks: [],
58      subsets: ["menu"],
59    },
60  ],
61  vite: {
62    ssr: {
63      external: ["@myriaddreamin/typst-ts-node-compiler"],
64    },
65  },
66});