[READ-ONLY] Mirror of https://github.com/flo-bit/shapecraft.
flo-bit.dev/shapecraft/
3.0 kB
98 lines
1// @ts-check
2import { defineConfig } from "astro/config";
3import { resolve } from "path";
4import remarkMath from "remark-math";
5import rehypeMathjax from "rehype-mathjax";
6
7import mdx from "@astrojs/mdx";
8import sitemap from "@astrojs/sitemap";
9import tailwind from "@astrojs/tailwind";
10import svelte from "@astrojs/svelte";
11
12import pagefind from "astro-pagefind";
13import customEmbeds from "./custom-embeds";
14import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
15
16import {
17 transformerMetaHighlight,
18 transformerNotationHighlight,
19} from "@shikijs/transformers";
20
21import LinkCardEmbed from "./src/embeds/link-card/embed";
22import YoutubeEmbed from "./src/embeds/youtube/embed";
23import ExcalidrawEmbed from "./src/embeds/excalidraw/embed";
24import GithubEmbed from "./src/embeds/github/embed";
25import { calloutEmbeds } from "./src/embeds/callouts/embeds";
26
27import react from "@astrojs/react";
28import { config } from "./config.server";
29import fixLinks from "./transform-links";
30
31// https://astro.build/config
32export default defineConfig({
33 vite: {
34 resolve: {
35 alias: [
36 { find: "$components", replacement: resolve("./src/components") },
37 { find: "$layouts", replacement: resolve("./src/layouts") },
38 { find: "$pages", replacement: resolve("./src/pages") },
39 { find: "$assets", replacement: resolve("./src/assets") },
40 { find: "$content", replacement: resolve("./src/content") },
41 { find: "three/examples", replacement: resolve("./node_modules/three/examples") },
42 { find: "three", replacement: resolve("./node_modules/three/build/three.module.js") },
43 { find: "culori", replacement: resolve("./node_modules/culori/src/index.js") },
44 { find: "shapecraft/three", replacement: resolve("../src/three/index.ts") },
45 { find: "shapecraft/noise", replacement: resolve("../src/noise/index.ts") },
46 { find: "shapecraft/color", replacement: resolve("../src/color/index.ts") },
47 { find: "shapecraft", replacement: resolve("../src/index.ts") },
48 ],
49 },
50 define: {
51 __PUBLIC_CONFIG__: JSON.stringify(config),
52 },
53 },
54
55 integrations: [
56 pagefind(),
57 customEmbeds({
58 embeds: [
59 ExcalidrawEmbed,
60 YoutubeEmbed,
61 GithubEmbed,
62 LinkCardEmbed,
63 ...calloutEmbeds,
64 ],
65 }),
66 fixLinks(),
67 mdx(),
68 sitemap(),
69 tailwind(),
70 svelte(),
71 react(),
72 ],
73
74 markdown: {
75 shikiConfig: {
76 themes: {
77 light: "github-light",
78 dark: "github-dark",
79 },
80 defaultColor: false,
81 transformers: [
82 transformerMetaHighlight(),
83 transformerNotationHighlight(),
84 ],
85 wrap: true,
86 },
87
88 remarkPlugins: [remarkGithubAdmonitionsToDirectives, remarkMath],
89 rehypePlugins: [rehypeMathjax],
90 },
91
92 prefetch: {
93 prefetchAll: true,
94 },
95 site: config.SITE ?? undefined,
96 base: config.BASE ?? "/",
97 output: "static",
98});