forked from solidjs/solid-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
133 lines (130 loc) · 3.91 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import { defineConfig } from "vite";
import solid from "solid-start/vite";
import netlify from "solid-start-netlify";
import node from "solid-start-node";
import mdx from "@mdx-js/rollup";
import WindiCSS from "vite-plugin-windicss";
import rehypeRaw from "rehype-raw";
import { nodeTypes } from "@mdx-js/mdx";
import remarkShikiTwoslash from "remark-shiki-twoslash";
import rehypeSlug from "rehype-slug";
import Icons from "unplugin-icons/vite";
import colors from "windicss/colors";
import remarkGfm from "remark-gfm";
const adapter = process.env.GITHUB_ACTIONS ? node() : netlify();
const colorScheme = colors.neutral;
export default defineConfig({
plugins: [
Icons({
compiler: "solid",
}),
{
...mdx({
jsx: true,
jsxImportSource: "solid-js",
providerImportSource: "solid-mdx",
rehypePlugins: [rehypeSlug, [rehypeRaw, { passThrough: nodeTypes }]],
remarkPlugins: [
remarkGfm,
[
remarkShikiTwoslash.default,
{
disableImplicitReactImport: true,
includeJSDocInHover: true,
// theme: "css-variables",
themes: ["github-light", "github-dark"],
defaultOptions: {
lib: ["dom", "es2015"],
},
defaultCompilerOptions: {
allowSyntheticDefaultImports: true,
esModuleInterop: true,
target: "ESNext",
module: "ESNext",
lib: ["dom", "es2015"],
jsxImportSource: "solid-js",
jsx: "preserve",
types: ["vite/client"],
paths: {
"~/*": ["./src/*"],
},
},
},
],
],
}),
enforce: "pre",
},
{
name: "twoslash-fix-lsp-linebreaks",
transform: (code, id) => {
if (id.endsWith(".md") || id.endsWith(".mdx")) {
return {
code: code.replace(/lsp="([^"]*)"/g, (match, p1) => {
return `lsp={\`${p1.replaceAll("`", `\\\``)}\`}`;
}),
};
}
return { code };
},
enforce: "pre",
},
WindiCSS({
config: {
darkMode: "class",
theme: {
extend: {
fontFamily: {
sans: ["Gordita", "sans-serif"],
mono: [
"Source Code Pro",
"ui-monospace",
"SFMono-Regular",
"Menlo",
],
},
boxShadow: {
lg: "0px 0.8px 2px rgba(0,0,0,0.032),0px 2.7px 6.7px rgba(0,0,0,0.048),0px 12px 30px rgba(0,0,0,0.08)",
},
fontSize: {
xs: "0.75rem",
sm: "0.875rem",
base: "0.9rem",
lg: "1rem",
code: "calc(1em - 20%)",
},
backgroundImage: {
darkgradient: `radial-gradient(87.08% 158.02% at 50% 12.92%, ${colorScheme["800"]} 0%, ${colorScheme["900"]} 100%)`,
lightgradient: `radial-gradient(87.08% 158.02% at 50% 12.92%, #FFFFFF 0%, ${colorScheme["100"]} 100%)`,
},
colors: {
solid: {
dark: colorScheme["900"],
darkbg: colorScheme["800"],
darkitem: colorScheme["700"],
darkaction: colorScheme["500"],
light: "#FFFFFF",
lightbg: colorScheme["100"],
lightitem: colorScheme["200"],
lightaction: colorScheme["400"],
accent: "#2c4f7c",
accentlight: "#85C4FF",
},
},
},
},
},
}),
solid({
adapter,
extensions: [".mdx", ".md"],
routesDir: "../content",
}),
],
optimizeDeps: {
exclude: ["solid-headless"],
},
ssr: {
noExternal: ["solid-headless", "solid-heroicons"],
},
});