-
Notifications
You must be signed in to change notification settings - Fork 7
/
astro.config.mjs
129 lines (126 loc) · 5.41 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
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
import cloudflare from '@astrojs/cloudflare';
import mdx from '@astrojs/mdx';
import node from '@astrojs/node';
import sitemap from '@astrojs/sitemap';
import svelte from '@astrojs/svelte';
import tailwind from '@astrojs/tailwind';
import AutoImport from 'astro-auto-import';
import { defineConfig } from 'astro/config';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeExternalLinks from 'rehype-external-links';
import rehypeSlug from 'rehype-slug';
import icons from 'unplugin-icons/vite';
import codeHighlight from './plugins/code-highlight';
import codePreviews from './plugins/code-previews';
import codeSnippets from './plugins/code-snippets';
import { calloutAutoImport, mdxCallouts } from './plugins/mdx/components/callouts';
import { codeExamplesAutoImport, mdxCodeExamples } from './plugins/mdx/components/code-examples';
import { codeSnippetAutoImport, mdxCodeSnippets } from './plugins/mdx/components/code-snippet';
import { componentApiAutoImport, mdxComponentAPI } from './plugins/mdx/components/component-api';
import { mdxNo, noAutoImport } from './plugins/mdx/components/no';
import { mdxTable, tableAutoImport } from './plugins/mdx/components/table';
import { mdxYes, yesAutoImport } from './plugins/mdx/components/yes';
import { autolinkConfig } from './plugins/mdx/rehype-autolink-config';
import { externalLinksConfig } from './plugins/mdx/rehype-external-links-config';
import { rehypeOptimizeStatic } from './plugins/mdx/rehype-optimize-static';
const isLocal = !process.env.CLOUDFLARE;
export default defineConfig({
site: 'https://vidstack.io',
output: 'static',
// adapter: isLocal ? node({ mode: 'standalone' }) : cloudflare(),
vite: {
resolve: {
alias: {
'~astro-icons': '~icons',
},
},
// Throwing some annoying type errors for src/snippets directory, just get rid of it for now.
optimizeDeps: { noDiscovery: true, include: [] },
plugins: [codeHighlight(), codeSnippets(), codePreviews(), icons({ compiler: 'svelte' })],
},
experimental: {
contentCollectionCache: true,
},
integrations: [
AutoImport({
imports: [
codeSnippetAutoImport,
codeExamplesAutoImport,
calloutAutoImport,
yesAutoImport,
noAutoImport,
tableAutoImport,
componentApiAutoImport,
],
}),
mdxCodeSnippets(),
mdxCodeExamples(),
mdxCallouts(),
mdxYes(),
mdxNo(),
mdxTable(),
mdxComponentAPI(),
tailwind(),
svelte({ prebundleSvelteLibraries: false }),
sitemap(),
mdx(),
],
markdown: {
syntaxHighlight: false,
rehypePlugins: [
rehypeSlug,
// This adds links to headings
[rehypeAutolinkHeadings, autolinkConfig],
// Add rel and target attrs to external links
[rehypeExternalLinks, externalLinksConfig],
// Collapse static parts of the hast to html
rehypeOptimizeStatic,
],
},
redirects: {
'/player': '/',
'/docs': '/docs/player',
'/docs/react': '/docs/player',
'/docs/wc': '/docs/wc/player',
'/media-icons': '/icons',
...['', 'react/']
.flatMap((lib) => {
const base = `/docs/${lib}player`;
return {
// Old site provider links.
[`${base}/providers/audio`]: '/docs/player/api/providers/audio',
[`${base}/providers/video`]: '/docs/player/api/providers/video',
[`${base}/providers/hls`]: '/docs/player/api/providers/hls',
// Old site styling links.
[`${base}/core-concepts/styling`]: '/docs/player/styling/introduction',
[`${base}/core-concepts/tailwind`]: '/docs/player/styling/tailwind',
[`${base}/core-concepts/skins`]: '/docs/player/styling/responsive-design',
// Old site installation links.
[`${base}/getting-started/installation/audio`]:
'/docs/player/getting-started/installation/web-components?provider=audio',
[`${base}/getting-started/installation/hls`]:
'/docs/player/getting-started/installation/web-components?provider=hls',
[`${base}/getting-started/installation/react/audio`]:
'/docs/player/getting-started/installation/react?provider=audio',
[`${base}/getting-started/installation/react/video`]:
'/docs/player/getting-started/installation/react?provider=video',
[`${base}/getting-started/installation/cdn/audio`]:
'/docs/player/getting-started/installation/cdn?provider=audio',
[`${base}/getting-started/installation/cdn/video`]:
'/docs/player/getting-started/installation/cdn?provider=video',
[`${base}/getting-started/installation/cdn/hls`]:
'/docs/player/getting-started/installation/cdn?provider=hls',
// Old site component links.
[`${base}/components/media/player`]: '/docs/player/components/core/player',
[`${base}/components/media/outlet`]: '/docs/player/components/core/provider',
[`${base}/components/media/gesture`]: '/docs/player/components/display/gesture',
[`${base}/components/layout/controls`]: '/docs/player/components/display/controls',
[`${base}/components/layout/poster`]: '/docs/player/components/display/poster',
[`${base}/components/display/icon`]: '/docs/player/components/display/icons',
[`${base}/components/display/live-indicator`]:
'/docs/player/components/buttons/live-button',
};
})
.reduce((p, c) => ({ ...p, ...c }), {}),
},
});