-
Notifications
You must be signed in to change notification settings - Fork 206
/
svelte.config.js
70 lines (67 loc) · 2.46 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
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { preprocessMeltUI, sequence } from '@melt-ui/pp';
import { markdoc } from 'svelte-markdoc-preprocess';
import nodeAdapter from '@sveltejs/adapter-node';
/** @type {import('@sveltejs/kit').Config}*/
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: sequence([
vitePreprocess(),
markdoc({
generateSchema: true,
nodes: absolute('./src/markdoc/nodes/_Module.svelte'),
tags: absolute('./src/markdoc/tags/_Module.svelte'),
partials: absolute('./src/partials'),
layouts: {
default: absolute('./src/markdoc/layouts/Article.svelte'),
article: absolute('./src/markdoc/layouts/Article.svelte'),
tutorial: absolute('./src/markdoc/layouts/Tutorial.svelte'),
post: absolute('./src/markdoc/layouts/Post.svelte'),
author: absolute('./src/markdoc/layouts/Author.svelte'),
category: absolute('./src/markdoc/layouts/Category.svelte'),
policy: absolute('./src/markdoc/layouts/Policy.svelte'),
changelog: absolute('./src/markdoc/layouts/Changelog.svelte'),
integration: absolute('./src/markdoc/layouts/Integration.svelte')
}
}),
preprocessMeltUI()
]),
extensions: ['.markdoc', '.svelte', '.md'],
kit: {
adapter: nodeAdapter(),
version: {
pollInterval: 60 * 1000
},
alias: {
$routes: './src/routes',
$scss: './src/scss',
$icons: './src/icons',
$appwrite: './node_modules/@appwrite.io/repo',
$markdoc: './src/markdoc'
},
prerender: {
concurrency: 32,
/**
* @type {import('@sveltejs/kit').PrerenderMissingIdHandler}
*/
handleMissingId: ({ path, message }) => {
if (path.startsWith('/docs/references/')) {
console.warn(message);
return;
}
throw new Error(message);
}
}
}
};
export default config;
/**
* @param {string} path
* @returns {string}
*/
function absolute(path) {
return join(dirname(fileURLToPath(import.meta.url)), path);
}