svedocs-cli 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +5 -0
- package/README.md +26 -0
- package/dist/chunk-QD6TB2KV.js +751 -0
- package/dist/create-svedocs.d.ts +1 -0
- package/dist/create-svedocs.js +12 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +12 -0
- package/dist/svedocs.d.ts +1 -0
- package/dist/svedocs.js +12 -0
- package/package.json +48 -0
- package/templates/cloudflare/.dev.vars.example +14 -0
- package/templates/cloudflare/README.md +13 -0
- package/templates/cloudflare/content/docs/index.md +20 -0
- package/templates/cloudflare/content/pages/index.md +9 -0
- package/templates/cloudflare/package.json +35 -0
- package/templates/cloudflare/src/app.cloudflare.d.ts +21 -0
- package/templates/cloudflare/src/app.d.ts +35 -0
- package/templates/cloudflare/src/app.html +12 -0
- package/templates/cloudflare/src/lib/server/env.ts +3 -0
- package/templates/cloudflare/src/routes/+layout.svelte +5 -0
- package/templates/cloudflare/src/routes/+layout.ts +3 -0
- package/templates/cloudflare/src/routes/+page.svelte +8 -0
- package/templates/cloudflare/src/routes/+page.ts +12 -0
- package/templates/cloudflare/src/routes/[...path]/+page.svelte +8 -0
- package/templates/cloudflare/src/routes/[...path]/+page.ts +22 -0
- package/templates/cloudflare/src/routes/api/ask/+server.ts +15 -0
- package/templates/cloudflare/src/routes/api/search/+server.ts +13 -0
- package/templates/cloudflare/src/routes/og/[...path]/+server.ts +26 -0
- package/templates/cloudflare/src/routes/robots.txt/+server.ts +12 -0
- package/templates/cloudflare/src/routes/sitemap.xml/+server.ts +13 -0
- package/templates/cloudflare/static/favicon.svg +6 -0
- package/templates/cloudflare/svedocs.config.ts +26 -0
- package/templates/cloudflare/svelte.config.js +18 -0
- package/templates/cloudflare/tsconfig.json +7 -0
- package/templates/cloudflare/vite.config.ts +9 -0
- package/templates/cloudflare/wrangler.toml +7 -0
- package/templates/docs/README.md +12 -0
- package/templates/docs/content/docs/index.md +14 -0
- package/templates/docs/content/pages/index.md +9 -0
- package/templates/docs/package.json +32 -0
- package/templates/docs/src/app.d.ts +35 -0
- package/templates/docs/src/app.html +12 -0
- package/templates/docs/src/lib/server/env.ts +3 -0
- package/templates/docs/src/routes/+layout.svelte +5 -0
- package/templates/docs/src/routes/+layout.ts +3 -0
- package/templates/docs/src/routes/+page.svelte +8 -0
- package/templates/docs/src/routes/+page.ts +12 -0
- package/templates/docs/src/routes/[...path]/+page.svelte +8 -0
- package/templates/docs/src/routes/[...path]/+page.ts +22 -0
- package/templates/docs/src/routes/api/ask/+server.ts +16 -0
- package/templates/docs/src/routes/api/search/+server.ts +13 -0
- package/templates/docs/src/routes/og/[...path]/+server.ts +26 -0
- package/templates/docs/src/routes/robots.txt/+server.ts +12 -0
- package/templates/docs/src/routes/sitemap.xml/+server.ts +13 -0
- package/templates/docs/static/favicon.svg +6 -0
- package/templates/docs/svedocs.config.ts +12 -0
- package/templates/docs/svelte.config.js +18 -0
- package/templates/docs/tsconfig.json +7 -0
- package/templates/docs/vite.config.ts +9 -0
- package/templates/minimal/README.md +12 -0
- package/templates/minimal/content/docs/index.md +8 -0
- package/templates/minimal/content/pages/index.md +9 -0
- package/templates/minimal/package.json +32 -0
- package/templates/minimal/src/app.d.ts +35 -0
- package/templates/minimal/src/app.html +12 -0
- package/templates/minimal/src/routes/+layout.svelte +5 -0
- package/templates/minimal/src/routes/+layout.ts +3 -0
- package/templates/minimal/src/routes/+page.svelte +8 -0
- package/templates/minimal/src/routes/+page.ts +12 -0
- package/templates/minimal/src/routes/[...path]/+page.svelte +8 -0
- package/templates/minimal/src/routes/[...path]/+page.ts +22 -0
- package/templates/minimal/static/favicon.svg +6 -0
- package/templates/minimal/svedocs.config.ts +10 -0
- package/templates/minimal/svelte.config.js +18 -0
- package/templates/minimal/tsconfig.json +7 -0
- package/templates/minimal/vite.config.ts +9 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DocsApp } from 'svedocs/theme';
|
|
3
|
+
import components from 'virtual:svedocs/components';
|
|
4
|
+
import layouts from 'virtual:svedocs/layouts';
|
|
5
|
+
export let data;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<DocsApp page={data.page} pages={data.pages} tree={data.tree} search={data.search} config={data.config} {components} {layouts} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import pages from 'virtual:svedocs/pages';
|
|
2
|
+
import search from 'virtual:svedocs/search';
|
|
3
|
+
import tree from 'virtual:svedocs/tree';
|
|
4
|
+
import config from 'virtual:svedocs/config';
|
|
5
|
+
import { svedocsPagePrerender } from 'svedocs/cloudflare';
|
|
6
|
+
import type { PageLoad } from './$types';
|
|
7
|
+
|
|
8
|
+
export const prerender = svedocsPagePrerender();
|
|
9
|
+
|
|
10
|
+
export const load: PageLoad = () => {
|
|
11
|
+
return { page: pages.find((page) => page.routePath === '/'), pages, search, tree, config };
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DocsApp } from 'svedocs/theme';
|
|
3
|
+
import components from 'virtual:svedocs/components';
|
|
4
|
+
import layouts from 'virtual:svedocs/layouts';
|
|
5
|
+
export let data;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<DocsApp page={data.page} pages={data.pages} tree={data.tree} search={data.search} config={data.config} {components} {layouts} />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { error } from '@sveltejs/kit';
|
|
2
|
+
import pages from 'virtual:svedocs/pages';
|
|
3
|
+
import search from 'virtual:svedocs/search';
|
|
4
|
+
import tree from 'virtual:svedocs/tree';
|
|
5
|
+
import config from 'virtual:svedocs/config';
|
|
6
|
+
import { svedocsPagePrerender } from 'svedocs/cloudflare';
|
|
7
|
+
import type { PageLoad } from './$types';
|
|
8
|
+
|
|
9
|
+
export const prerender = svedocsPagePrerender();
|
|
10
|
+
|
|
11
|
+
export function entries() {
|
|
12
|
+
return pages
|
|
13
|
+
.filter((page) => page.routePath !== '/')
|
|
14
|
+
.map((page) => ({ path: page.routePath.replace(/^\//, '') }));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const load: PageLoad = ({ params }) => {
|
|
18
|
+
const routePath = `/${params.path ?? ''}`.replace(/\/$/, '') || '/';
|
|
19
|
+
const page = pages.find((item) => item.routePath === routePath);
|
|
20
|
+
if (!page) error(404, `No page found for ${routePath}`);
|
|
21
|
+
return { page, pages, search, tree, config };
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createConfiguredAskResponse, createMemoryRateLimiter } from 'svedocs/ai';
|
|
2
|
+
import { getRuntimeEnv } from '$lib/server/env';
|
|
3
|
+
import config from 'virtual:svedocs/config';
|
|
4
|
+
import records from 'virtual:svedocs/search';
|
|
5
|
+
import type { RequestHandler } from './$types';
|
|
6
|
+
|
|
7
|
+
export const prerender = false;
|
|
8
|
+
|
|
9
|
+
const rateLimiter = createMemoryRateLimiter({ windowMs: 60_000, max: 30 });
|
|
10
|
+
|
|
11
|
+
export const POST: RequestHandler = ({ request }) => {
|
|
12
|
+
return createConfiguredAskResponse(config, records, request, {
|
|
13
|
+
env: getRuntimeEnv(),
|
|
14
|
+
rateLimiter
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createConfiguredSearchResponse } from 'svedocs/search';
|
|
2
|
+
import { getRuntimeEnv } from '$lib/server/env';
|
|
3
|
+
import config from 'virtual:svedocs/config';
|
|
4
|
+
import records from 'virtual:svedocs/search';
|
|
5
|
+
import type { RequestHandler } from './$types';
|
|
6
|
+
|
|
7
|
+
export const prerender = false;
|
|
8
|
+
|
|
9
|
+
export const GET: RequestHandler = ({ request }) => {
|
|
10
|
+
return createConfiguredSearchResponse(config, records, request, {
|
|
11
|
+
env: getRuntimeEnv()
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { error } from '@sveltejs/kit';
|
|
2
|
+
import { createConfiguredOgImageFormat, createConfiguredOgImageRenderer, createPageOgImageEntries, createPageOgImagePath, createPageOgImageResponse } from 'svedocs/og';
|
|
3
|
+
import config from 'virtual:svedocs/config';
|
|
4
|
+
import pages from 'virtual:svedocs/pages';
|
|
5
|
+
import type { RequestHandler } from './$types';
|
|
6
|
+
|
|
7
|
+
export const prerender = true;
|
|
8
|
+
|
|
9
|
+
const format = createConfiguredOgImageFormat(config);
|
|
10
|
+
|
|
11
|
+
export function entries() {
|
|
12
|
+
return createPageOgImageEntries(pages, format);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const GET: RequestHandler = async ({ params }) => {
|
|
16
|
+
const requestPath = `/og/${params.path}`;
|
|
17
|
+
const page = pages.find((candidate) => createPageOgImagePath(candidate, format) === requestPath);
|
|
18
|
+
if (!page) error(404, `No OG image found for ${requestPath}`);
|
|
19
|
+
return createPageOgImageResponse(config, page, {
|
|
20
|
+
format,
|
|
21
|
+
renderer: createConfiguredOgImageRenderer(config),
|
|
22
|
+
...(config.seo.ogImage !== false && typeof config.seo.ogImage.template === 'function'
|
|
23
|
+
? { template: config.seo.ogImage.template }
|
|
24
|
+
: {})
|
|
25
|
+
});
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRobotsTxt } from 'svedocs/og';
|
|
2
|
+
import config from 'virtual:svedocs/config';
|
|
3
|
+
|
|
4
|
+
export const prerender = true;
|
|
5
|
+
|
|
6
|
+
export function GET() {
|
|
7
|
+
return new Response(createRobotsTxt(config), {
|
|
8
|
+
headers: {
|
|
9
|
+
'content-type': 'text/plain; charset=utf-8'
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createSitemapXml } from 'svedocs/og';
|
|
2
|
+
import config from 'virtual:svedocs/config';
|
|
3
|
+
import pages from 'virtual:svedocs/pages';
|
|
4
|
+
|
|
5
|
+
export const prerender = true;
|
|
6
|
+
|
|
7
|
+
export function GET() {
|
|
8
|
+
return new Response(createSitemapXml(config, pages), {
|
|
9
|
+
headers: {
|
|
10
|
+
'content-type': 'application/xml; charset=utf-8'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
|
|
2
|
+
<rect width="64" height="64" fill="#11130f"/>
|
|
3
|
+
<rect x="12" y="12" width="16" height="16" fill="#50d6b3"/>
|
|
4
|
+
<rect x="28" y="28" width="16" height="16" fill="#ff8a66"/>
|
|
5
|
+
<rect x="12" y="44" width="16" height="8" fill="#f4f1e8"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from 'svedocs/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
site: {
|
|
5
|
+
name: 'My docs',
|
|
6
|
+
title: 'My docs',
|
|
7
|
+
description: 'Documentation built with svedocs'
|
|
8
|
+
},
|
|
9
|
+
source: {
|
|
10
|
+
editBaseUrl: 'https://github.com/acme/my-docs/edit/main'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import adapterCloudflare from '@sveltejs/adapter-cloudflare';
|
|
2
|
+
import adapterStatic from '@sveltejs/adapter-static';
|
|
3
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
4
|
+
import { svedocsPreprocess, svedocsSvelteExtensions } from 'svedocs/svelte';
|
|
5
|
+
|
|
6
|
+
const mode = process.env.SVEDOCS_BUILD_MODE ?? 'edge';
|
|
7
|
+
const adapter =
|
|
8
|
+
mode === 'edge'
|
|
9
|
+
? adapterCloudflare({ platformProxy: { remoteBindings: false } })
|
|
10
|
+
: adapterStatic(mode === 'spa' ? { fallback: '200.html' } : { strict: false });
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
extensions: svedocsSvelteExtensions,
|
|
14
|
+
preprocess: [vitePreprocess(), svedocsPreprocess()],
|
|
15
|
+
kit: {
|
|
16
|
+
adapter
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
2
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
import { svedocs } from 'svedocs/vite';
|
|
5
|
+
import svedocsConfig from './svedocs.config';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [svedocs({ config: svedocsConfig }), tailwindcss(), sveltekit()]
|
|
9
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# svedocs minimal
|
|
2
|
+
|
|
3
|
+
Small SvelteKit docs app powered by svedocs.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm install
|
|
7
|
+
pnpm dev
|
|
8
|
+
pnpm build
|
|
9
|
+
pnpm build:ssg
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`pnpm build` uses Cloudflare edge SSR by default with local remote bindings disabled, so builds do not require a Cloudflare account. Use `pnpm build:ssg` for static output or `pnpm build:spa` for prerendered pages plus a static fallback.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "svedocs-minimal",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "svedocs dev",
|
|
8
|
+
"build": "svedocs build",
|
|
9
|
+
"build:edge": "svedocs build --mode edge",
|
|
10
|
+
"build:static": "svedocs build --mode static",
|
|
11
|
+
"build:ssg": "svedocs ssg",
|
|
12
|
+
"build:spa": "svedocs build --mode spa",
|
|
13
|
+
"preview": "svedocs preview",
|
|
14
|
+
"check": "svedocs check"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@sveltejs/adapter-cloudflare": "^7.2.8",
|
|
18
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
19
|
+
"@sveltejs/kit": "^2.60.1",
|
|
20
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
21
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
22
|
+
"svelte": "^5.55.7",
|
|
23
|
+
"svedocs": "latest",
|
|
24
|
+
"tailwindcss": "^4.3.0",
|
|
25
|
+
"vite": "^8.0.13"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"svedocs-cli": "latest",
|
|
29
|
+
"@types/node": "^25.8.0",
|
|
30
|
+
"typescript": "^6.0.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare module 'virtual:svedocs/config' {
|
|
2
|
+
import type { SvedocsResolvedConfig } from 'svedocs/core';
|
|
3
|
+
const config: SvedocsResolvedConfig;
|
|
4
|
+
export default config;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module 'virtual:svedocs/pages' {
|
|
8
|
+
import type { SvedocsPage } from 'svedocs/core';
|
|
9
|
+
const pages: SvedocsPage[];
|
|
10
|
+
export default pages;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module 'virtual:svedocs/tree' {
|
|
14
|
+
import type { SvedocsTreeItem } from 'svedocs/core';
|
|
15
|
+
const tree: SvedocsTreeItem[];
|
|
16
|
+
export default tree;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module 'virtual:svedocs/search' {
|
|
20
|
+
import type { SvedocsSearchRecord } from 'svedocs/core';
|
|
21
|
+
const records: SvedocsSearchRecord[];
|
|
22
|
+
export default records;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare module 'virtual:svedocs/components' {
|
|
26
|
+
import type { Component } from 'svelte';
|
|
27
|
+
const components: Record<string, Component>;
|
|
28
|
+
export default components;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare module 'virtual:svedocs/layouts' {
|
|
32
|
+
import type { Component } from 'svelte';
|
|
33
|
+
const layouts: Record<string, Component>;
|
|
34
|
+
export default layouts;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="/favicon.svg" />
|
|
7
|
+
%sveltekit.head%
|
|
8
|
+
</head>
|
|
9
|
+
<body data-sveltekit-preload-data="hover">
|
|
10
|
+
<div style="display: contents">%sveltekit.body%</div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DocsApp } from 'svedocs/theme';
|
|
3
|
+
import components from 'virtual:svedocs/components';
|
|
4
|
+
import layouts from 'virtual:svedocs/layouts';
|
|
5
|
+
export let data;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<DocsApp page={data.page} pages={data.pages} tree={data.tree} search={data.search} config={data.config} {components} {layouts} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import config from 'virtual:svedocs/config';
|
|
2
|
+
import pages from 'virtual:svedocs/pages';
|
|
3
|
+
import search from 'virtual:svedocs/search';
|
|
4
|
+
import tree from 'virtual:svedocs/tree';
|
|
5
|
+
import { svedocsPagePrerender } from 'svedocs/cloudflare';
|
|
6
|
+
import type { PageLoad } from './$types';
|
|
7
|
+
|
|
8
|
+
export const prerender = svedocsPagePrerender();
|
|
9
|
+
|
|
10
|
+
export const load: PageLoad = () => {
|
|
11
|
+
return { page: pages.find((page) => page.routePath === '/'), pages, search, tree, config };
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DocsApp } from 'svedocs/theme';
|
|
3
|
+
import components from 'virtual:svedocs/components';
|
|
4
|
+
import layouts from 'virtual:svedocs/layouts';
|
|
5
|
+
export let data;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<DocsApp page={data.page} pages={data.pages} tree={data.tree} search={data.search} config={data.config} {components} {layouts} />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { error } from '@sveltejs/kit';
|
|
2
|
+
import config from 'virtual:svedocs/config';
|
|
3
|
+
import pages from 'virtual:svedocs/pages';
|
|
4
|
+
import search from 'virtual:svedocs/search';
|
|
5
|
+
import tree from 'virtual:svedocs/tree';
|
|
6
|
+
import { svedocsPagePrerender } from 'svedocs/cloudflare';
|
|
7
|
+
import type { PageLoad } from './$types';
|
|
8
|
+
|
|
9
|
+
export const prerender = svedocsPagePrerender();
|
|
10
|
+
|
|
11
|
+
export function entries() {
|
|
12
|
+
return pages
|
|
13
|
+
.filter((page) => page.routePath !== '/')
|
|
14
|
+
.map((page) => ({ path: page.routePath.replace(/^\//, '') }));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const load: PageLoad = ({ params }) => {
|
|
18
|
+
const routePath = `/${params.path ?? ''}`.replace(/\/$/, '') || '/';
|
|
19
|
+
const page = pages.find((item) => item.routePath === routePath);
|
|
20
|
+
if (!page) error(404, `No page found for ${routePath}`);
|
|
21
|
+
return { page, pages, search, tree, config };
|
|
22
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
|
|
2
|
+
<rect width="64" height="64" fill="#11130f"/>
|
|
3
|
+
<rect x="12" y="12" width="16" height="16" fill="#50d6b3"/>
|
|
4
|
+
<rect x="28" y="28" width="16" height="16" fill="#ff8a66"/>
|
|
5
|
+
<rect x="12" y="44" width="16" height="8" fill="#f4f1e8"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import adapterCloudflare from '@sveltejs/adapter-cloudflare';
|
|
2
|
+
import adapterStatic from '@sveltejs/adapter-static';
|
|
3
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
4
|
+
import { svedocsPreprocess, svedocsSvelteExtensions } from 'svedocs/svelte';
|
|
5
|
+
|
|
6
|
+
const mode = process.env.SVEDOCS_BUILD_MODE ?? 'edge';
|
|
7
|
+
const adapter =
|
|
8
|
+
mode === 'edge'
|
|
9
|
+
? adapterCloudflare({ platformProxy: { remoteBindings: false } })
|
|
10
|
+
: adapterStatic(mode === 'spa' ? { fallback: '200.html' } : { strict: false });
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
extensions: svedocsSvelteExtensions,
|
|
14
|
+
preprocess: [vitePreprocess(), svedocsPreprocess()],
|
|
15
|
+
kit: {
|
|
16
|
+
adapter
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
2
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
import { svedocs } from 'svedocs/vite';
|
|
5
|
+
import svedocsConfig from './svedocs.config';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [svedocs({ config: svedocsConfig }), tailwindcss(), sveltekit()]
|
|
9
|
+
});
|