Commit d3d8ac5cd8
Unregistered key
Layout: unified · split
docs/.vitepress/configs/index.ts +68 −71
| @@ -5,104 +5,101 @@ | ||
| 5 | 5 | * |
| 6 | 6 | * All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder. |
| 7 | 7 | */ |
| 8 | import type { DefaultTheme, Plugin, UserConfig } from "vitepress"; | |
| 9 | import { generateImages, generateMeta } from "./hooks"; | |
| 10 | import { defs, movePlugin, aliases } from "./markdown/emoji"; | |
| 8 | import type { DefaultTheme, Plugin, UserConfig } from 'vitepress' | |
| 9 | import { generateImages, generateMeta } from './hooks' | |
| 10 | import { defs, movePlugin, aliases } from './markdown/emoji' | |
| 11 | 11 | import { |
| 12 | 12 | PageProperties, |
| 13 | PagePropertiesMarkdownSection, | |
| 14 | } from "@nolebase/vitepress-plugin-page-properties/vite"; | |
| 13 | PagePropertiesMarkdownSection | |
| 14 | } from '@nolebase/vitepress-plugin-page-properties/vite' | |
| 15 | 15 | import { |
| 16 | 16 | GitChangelog, |
| 17 | GitChangelogMarkdownSection, | |
| 18 | } from "@nolebase/vitepress-plugin-git-changelog/vite"; | |
| 19 | import { fileURLToPath, URL } from "node:url"; | |
| 20 | import UnoCSS from "unocss/vite"; | |
| 21 | import Devtools from "vite-plugin-vue-devtools"; | |
| 22 | import { configureMarkdown } from "./markdown"; | |
| 23 | import { GIT_COMMIT, hostname, nav, sidebar, siteConfig } from "./constants"; | |
| 17 | GitChangelogMarkdownSection | |
| 18 | } from '@nolebase/vitepress-plugin-git-changelog/vite' | |
| 19 | import { fileURLToPath, URL } from 'node:url' | |
| 20 | import UnoCSS from 'unocss/vite' | |
| 21 | import Devtools from 'vite-plugin-vue-devtools' | |
| 22 | import { configureMarkdown } from './markdown' | |
| 23 | import { GIT_COMMIT, hostname, nav, sidebar, siteConfig } from './constants' | |
| 24 | 24 | |
| 25 | 25 | export const shared: UserConfig<DefaultTheme.Config> = { |
| 26 | 26 | ...siteConfig, |
| 27 | 27 | transformHead: async (context) => generateMeta(context, hostname), |
| 28 | 28 | buildEnd: async (context) => { |
| 29 | generateImages(context); | |
| 29 | generateImages(context) | |
| 30 | 30 | }, |
| 31 | 31 | markdown: { |
| 32 | 32 | emoji: { defs, shortcuts: aliases }, |
| 33 | 33 | config(md) { |
| 34 | configureMarkdown(md); | |
| 35 | }, | |
| 34 | configureMarkdown(md) | |
| 35 | } | |
| 36 | 36 | }, |
| 37 | 37 | themeConfig: { |
| 38 | 38 | search: { |
| 39 | 39 | options: { |
| 40 | 40 | miniSearch: { |
| 41 | 41 | searchOptions: { |
| 42 | combineWith: "AND", | |
| 42 | combineWith: 'AND', | |
| 43 | 43 | fuzzy: false, |
| 44 | 44 | // @ts-ignore |
| 45 | 45 | boostDocument: ( |
| 46 | 46 | _, |
| 47 | 47 | term, |
| 48 | storedFields: Record<string, string | string[]>, | |
| 48 | storedFields: Record<string, string | string[]> | |
| 49 | 49 | ) => { |
| 50 | 50 | const titles = (storedFields?.titles as string[]) |
| 51 | 51 | .filter((t) => Boolean(t)) |
| 52 | .map((t) => t.toLowerCase()); | |
| 52 | .map((t) => t.toLowerCase()) | |
| 53 | 53 | // Uprate if term appears in titles. Add bonus for higher levels (i.e. lower index) |
| 54 | 54 | const titleIndex = |
| 55 | 55 | titles |
| 56 | 56 | .map((t, i) => (t?.includes(term) ? i : -1)) |
| 57 | .find((i) => i >= 0) ?? -1; | |
| 58 | if (titleIndex >= 0) return 10000 - titleIndex; | |
| 57 | .find((i) => i >= 0) ?? -1 | |
| 58 | if (titleIndex >= 0) return 10000 - titleIndex | |
| 59 | 59 | |
| 60 | return 1; | |
| 61 | }, | |
| 62 | }, | |
| 60 | return 1 | |
| 61 | } | |
| 62 | } | |
| 63 | 63 | }, |
| 64 | detailedView: true, | |
| 64 | detailedView: true | |
| 65 | 65 | }, |
| 66 | provider: "local", | |
| 66 | provider: 'local' | |
| 67 | 67 | }, |
| 68 | logo: { src: "/asset/fav.png" }, | |
| 68 | logo: { src: '/asset/fav.png' }, | |
| 69 | 69 | sidebar, |
| 70 | 70 | nav, |
| 71 | 71 | socialLinks: [ |
| 72 | { icon: "github", link: "https://github.com/wotakumoe/Wotaku" }, | |
| 73 | { icon: "discord", link: "https://discord.gg/vShRGx8ZBC" }, | |
| 72 | { icon: 'github', link: 'https://github.com/wotakumoe/Wotaku' }, | |
| 73 | { icon: 'discord', link: 'https://discord.gg/vShRGx8ZBC' }, | |
| 74 | 74 | { |
| 75 | icon: "bluesky", | |
| 76 | link: "https://bsky.app/profile/wotaku.wiki", | |
| 77 | }, | |
| 75 | icon: 'bluesky', | |
| 76 | link: 'https://bsky.app/profile/wotaku.wiki' | |
| 77 | } | |
| 78 | 78 | ], |
| 79 | 79 | footer: { |
| 80 | 80 | message: `<a href="https://github.com/wotakumoe">The Wotaku Team</a> <span class="divider">|</span> <a href="https://github.com/wotakumoe/Wotaku/commit/${GIT_COMMIT}">${GIT_COMMIT.slice( |
| 81 | 81 | 0, |
| 82 | 7, | |
| 82 | 7 | |
| 83 | 83 | )}</a>`, |
| 84 | copyright: "made with love and eepy energy", | |
| 85 | }, | |
| 84 | copyright: 'made with love and eepy energy' | |
| 85 | } | |
| 86 | 86 | }, |
| 87 | 87 | vite: { |
| 88 | experimental: { | |
| 89 | enableNativePlugin: true, | |
| 90 | }, | |
| 91 | 88 | optimizeDeps: { |
| 92 | 89 | exclude: [ |
| 93 | "@nolebase/vitepress-plugin-enhanced-readabilities/client", | |
| 94 | "@nolebase/vitepress-plugin-git-changelog/client", | |
| 95 | "@nolebase/vitepress-plugin-page-properties/client", | |
| 96 | ], | |
| 90 | '@nolebase/vitepress-plugin-enhanced-readabilities/client', | |
| 91 | '@nolebase/vitepress-plugin-git-changelog/client', | |
| 92 | '@nolebase/vitepress-plugin-page-properties/client' | |
| 93 | ] | |
| 97 | 94 | }, |
| 98 | 95 | ssr: { |
| 99 | 96 | noExternal: [ |
| 100 | "@nolebase/vitepress-plugin-enhanced-readabilities", | |
| 101 | "@nolebase/vitepress-plugin-page-properties", | |
| 102 | "@nolebase/vitepress-plugin-git-changelog", | |
| 103 | "@nolebase/ui", | |
| 104 | "@fmhy/components", | |
| 105 | ], | |
| 97 | '@nolebase/vitepress-plugin-enhanced-readabilities', | |
| 98 | '@nolebase/vitepress-plugin-page-properties', | |
| 99 | '@nolebase/vitepress-plugin-git-changelog', | |
| 100 | '@nolebase/ui', | |
| 101 | '@fmhy/components' | |
| 102 | ] | |
| 106 | 103 | }, |
| 107 | 104 | plugins: [ |
| 108 | 105 | Devtools(), |
| @@ -110,48 +107,48 @@ export const shared: UserConfig<DefaultTheme.Config> = { | ||
| 110 | 107 | PagePropertiesMarkdownSection(), |
| 111 | 108 | GitChangelog({ |
| 112 | 109 | maxGitLogCount: 20, |
| 113 | repoURL: "https://github.com/wotakumoe/Wotaku", | |
| 110 | repoURL: 'https://github.com/wotakumoe/Wotaku' | |
| 114 | 111 | }), |
| 115 | 112 | GitChangelogMarkdownSection({ sections: { disableContributors: true } }), |
| 116 | 113 | UnoCSS({ |
| 117 | configFile: "../unocss.config.ts", | |
| 114 | configFile: '../unocss.config.ts' | |
| 118 | 115 | }), |
| 119 | 116 | { |
| 120 | name: "custom:adjust-order", | |
| 117 | name: 'custom:adjust-order', | |
| 121 | 118 | configResolved(c) { |
| 122 | 119 | movePlugin( |
| 123 | 120 | c.plugins as unknown as Plugin[], |
| 124 | "vitepress", | |
| 125 | "before", | |
| 126 | "unocss:transformers:pre", | |
| 127 | ); | |
| 121 | 'vitepress', | |
| 122 | 'before', | |
| 123 | 'unocss:transformers:pre' | |
| 124 | ) | |
| 128 | 125 | movePlugin( |
| 129 | 126 | c.plugins as unknown as Plugin[], |
| 130 | "custom:tooltip-loader", | |
| 131 | "before", | |
| 132 | "vitepress", | |
| 133 | ); | |
| 134 | }, | |
| 135 | }, | |
| 127 | 'custom:tooltip-loader', | |
| 128 | 'before', | |
| 129 | 'vitepress' | |
| 130 | ) | |
| 131 | } | |
| 132 | } | |
| 136 | 133 | ], |
| 137 | 134 | resolve: { |
| 138 | 135 | alias: [ |
| 139 | 136 | { |
| 140 | 137 | find: /^.*\/VPBadge\.vue$/, |
| 141 | 138 | replacement: fileURLToPath( |
| 142 | new URL("../theme/components/Badge.vue", import.meta.url), | |
| 143 | ), | |
| 139 | new URL('../theme/components/Badge.vue', import.meta.url) | |
| 140 | ) | |
| 144 | 141 | }, |
| 145 | 142 | { |
| 146 | 143 | find: /^.*VPSwitchAppearance\.vue$/, |
| 147 | 144 | replacement: fileURLToPath( |
| 148 | 145 | new URL( |
| 149 | "../theme/components/VPSwitchAppearance.vue", | |
| 150 | import.meta.url, | |
| 151 | ), | |
| 152 | ), | |
| 153 | }, | |
| 154 | ], | |
| 155 | }, | |
| 156 | }, | |
| 157 | }; | |
| 146 | '../theme/components/VPSwitchAppearance.vue', | |
| 147 | import.meta.url | |
| 148 | ) | |
| 149 | ) | |
| 150 | } | |
| 151 | ] | |
| 152 | } | |
| 153 | } | |
| 154 | } | |
package.json −3
| @@ -76,9 +76,6 @@ | ||
| 76 | 76 | "wrangler": "^4.40.2" |
| 77 | 77 | }, |
| 78 | 78 | "pnpm": { |
| 79 | "overrides": { | |
| 80 | "vite": "npm:rolldown-vite@latest" | |
| 81 | }, | |
| 82 | 79 | "peerDependencyRules": { |
| 83 | 80 | "ignoreMissing": [ |
| 84 | 81 | "@algolia/client-search", |