-
Notifications
You must be signed in to change notification settings - Fork 36
/
svelte.config.js
72 lines (64 loc) · 1.7 KB
/
svelte.config.js
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
import adapter from '@sveltejs/adapter-static'
import { s } from 'hastscript'
import { mdsvex } from 'mdsvex'
import mdsvexamples from 'mdsvexamples'
import link_headings from 'rehype-autolink-headings'
import heading_slugs from 'rehype-slug'
import { sveltePreprocess } from 'svelte-preprocess'
const rehypePlugins = [
heading_slugs,
[
link_headings,
{
behavior: `append`,
test: [`h2`, `h3`, `h4`, `h5`, `h6`], // don't auto-link <h1>
content: s(
`svg`,
{ width: 16, height: 16, viewBox: `0 0 16 16` },
// symbol #octicon-link defined in app.html
s(`use`, { 'xlink:href': `#octicon-link` }),
),
},
],
]
const { default: pkg } = await import(`./package.json`, {
with: { type: `json` },
})
const defaults = {
Wrapper: `svelte-zoo/CodeExample.svelte`,
repo: pkg.repository,
hideStyle: true,
}
const remarkPlugins = [[mdsvexamples, { defaults }]]
/** @type {import('@sveltejs/kit').Config} */
export default {
extensions: [`.svelte`, `.svx`, `.md`],
preprocess: [
sveltePreprocess(),
mdsvex({ rehypePlugins, remarkPlugins, extensions: [`.svx`, `.md`] }),
],
kit: {
adapter: adapter(),
alias: {
$root: `.`,
$site: `./src/site`,
$lib: `svelte-multiselect`,
},
prerender: {
handleMissingId: ({ id }) => {
// list of ok-to-be-missing IDs
if ([`🔣-props`].includes(id)) return
throw `Missing ID: ${id}`
},
},
},
compilerOptions: {
// https://github.com/janosh/svelte-multiselect/issues/196
immutable: true,
// enable direct prop access for vitest unit tests
accessors: Boolean(process.env.TEST),
},
vitePlugin: {
inspector: true,
},
}