-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
86 lines (85 loc) · 2 KB
/
astro.config.mjs
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
import { defineConfig } from 'astro/config'
import { rehypeExternalLinks } from './.rex-plugins/rehype-links.mjs'
import { remarkModifiedTime } from './.rex-plugins/remark-modified-time.mjs'
import remarkWikilink from 'remark-wiki-link'
import customTheme from '.shiki/vesper.json'
// import compress from 'astro-compress'
import sitemap from '@astrojs/sitemap'
import serviceWorker from 'astrojs-service-worker'
import svelte from '@astrojs/svelte'
import vercel from '@astrojs/vercel/static'
import metaTags from 'astro-meta-tags'
// https://astro.build/config
export default defineConfig({
assets: true,
output: 'static',
adapter: vercel({
imagesConfig: {
sizes: [320, 640, 1280],
domains: []
},
imageService: true,
devImageService: 'sharp',
webAnalytics: { enabled: false }
}),
image: {
domains: ['ibro.xyz']
},
prefetch: {
defaultStrategy: 'hover',
prefetchAll: true
},
site: 'https://ibro.xyz',
markdown: {
shikiConfig: {
theme: customTheme,
themes: {
light: 'rose-pine-dawn',
dark: 'poimandres'
},
wrap: true
},
rehypePlugins: [rehypeExternalLinks],
remarkPlugins: [
[
remarkWikilink,
{
hrefTemplate: (permalink) => `/note/${permalink}`
}
],
remarkModifiedTime
]
},
integrations: [
// compress(), /* munmap_chunk(): invalid pointer */
serviceWorker({
// https://developer.chrome.com/docs/workbox/modules/workbox-build/
workbox: {
cacheId: 'ibro.xyz',
runtimeCaching: [
{
urlPattern: /\/$/,
handler: 'NetworkFirst'
},
{
urlPattern: /\.html$/,
handler: 'StaleWhileRevalidate'
},
{
// we serve stale copies of static assets while they're refreshed
urlPattern: /^.*\.(ico|svg|json)$/,
handler: 'StaleWhileRevalidate'
},
{
// Network wil not be used at all for assets which are unlikely to change
urlPattern: /^.*\.(jpg|png|mp4|gif|webp|woff2)$/,
handler: 'CacheFirst'
}
]
}
}),
sitemap(),
svelte(),
metaTags()
]
})