@ruan-cat/vitepress-preset-config 0.16.1 → 1.0.0

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/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @ruan-cat/vitepress-preset-config
2
+
3
+ <!-- automd:badges color="yellow" name="@ruan-cat/vitepress-preset-config" -->
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@ruan-cat/vitepress-preset-config?color=yellow)](https://npmjs.com/package/@ruan-cat/vitepress-preset-config)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@ruan-cat/vitepress-preset-config?color=yellow)](https://npm.chart.dev/@ruan-cat/vitepress-preset-config)
7
+
8
+ <!-- /automd -->
9
+
10
+ 用于给大多数的vitepress项目提供一个预设的配置文件。
11
+
12
+ ## 安装
13
+
14
+ ```bash
15
+ npm install @ruan-cat/vitepress-preset-config
16
+ # 或
17
+ yarn add @ruan-cat/vitepress-preset-config
18
+ # 或
19
+ pnpm add @ruan-cat/vitepress-preset-config
20
+ ```
21
+
22
+ ## 使用方法
23
+
24
+ ```typescript
25
+ import { defineConfig } from "vitepress";
26
+ import { config } from "@ruan-cat/vitepress-preset-config";
27
+
28
+ export default defineConfig(config);
29
+ ```
30
+
31
+ ## 许可证
32
+
33
+ MIT
package/dist/config.d.mts CHANGED
@@ -4,17 +4,6 @@ export { defineConfig } from 'vitepress';
4
4
  import { generateSidebar } from 'vitepress-sidebar';
5
5
  export { addChangelog2doc, copyReadmeMd } from '@ruan-cat/utils/node-esm';
6
6
  export { withMermaid } from 'vitepress-plugin-mermaid';
7
- export { default as VitePluginVercel } from 'vite-plugin-vercel';
8
-
9
- /** 阮喵喵针对文档行为的配置 */
10
- interface RuanCatConfig {
11
- plugins?: {
12
- llmstxt?: boolean;
13
- gitChangelog?: boolean;
14
- gitChangelogMarkdownSection?: boolean;
15
- vitePluginVercel?: boolean;
16
- };
17
- }
18
7
 
19
8
  type VitePressSidebarOptions = Parameters<typeof generateSidebar>[0];
20
9
  /**
@@ -23,6 +12,6 @@ type VitePressSidebarOptions = Parameters<typeof generateSidebar>[0];
23
12
  */
24
13
  declare function setGenerateSidebar(options?: VitePressSidebarOptions): vitepress_sidebar_types.Sidebar;
25
14
  /** 设置vitepress主配置 */
26
- declare function setUserConfig(config?: UserConfig<DefaultTheme.Config>, ruanCatConfig?: RuanCatConfig): UserConfig<DefaultTheme.Config>;
15
+ declare function setUserConfig(config?: UserConfig<DefaultTheme.Config>): UserConfig<DefaultTheme.Config>;
27
16
 
28
- export { type RuanCatConfig, setGenerateSidebar, setUserConfig };
17
+ export { setGenerateSidebar, setUserConfig };
package/dist/config.mjs CHANGED
@@ -9,7 +9,41 @@ import { addChangelog2doc, hasChangelogMd, copyReadmeMd } from "@ruan-cat/utils/
9
9
  import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
10
10
  import llmstxt from "vitepress-plugin-llms";
11
11
  import { withMermaid } from "vitepress-plugin-mermaid";
12
- import VitePluginVercel from "vite-plugin-vercel";
12
+ import { defineTeekConfig } from "vitepress-theme-teek/config";
13
+ var teekConfig = defineTeekConfig({
14
+ /** @see https://vp.teek.top/reference/config/global-config.html#sidebartrigger */
15
+ sidebarTrigger: true,
16
+ vitePlugins: {
17
+ /**
18
+ * 关闭 vitepress-plugin-permalink 插件
19
+ * @see https://vp.teek.top/guide/plugins.html#vitepress-plugin-permalink
20
+ */
21
+ permalink: false,
22
+ /**
23
+ * 关闭 vitepress-plugin-sidebar-resolve 插件
24
+ * @see https://vp.teek.top/guide/plugins.html#vitepress-plugin-sidebar-resolve
25
+ */
26
+ sidebar: false,
27
+ /**
28
+ * 关闭 vitepress-plugin-md-h1 插件
29
+ * @see https://vp.teek.top/guide/plugins.html#vitepress-plugin-md-h1
30
+ */
31
+ mdH1: false
32
+ },
33
+ /** @see https://vp.teek.top/reference/article-config.html#articleshare */
34
+ articleShare: {
35
+ enabled: true,
36
+ // 是否开启文章链接分享功能
37
+ text: "\u5206\u4EAB\u6B64\u9875\u9762",
38
+ // 分享按钮文本
39
+ copiedText: "\u94FE\u63A5\u5DF2\u590D\u5236",
40
+ // 复制成功文本
41
+ query: false,
42
+ // 是否包含查询参数
43
+ hash: false
44
+ // 是否包含哈希值
45
+ }
46
+ });
13
47
  var defaultSidebarOptions = {
14
48
  // documentRootPath: "src",
15
49
  // 侧边栏需要折叠
@@ -41,23 +75,8 @@ function getMergeSidebarOptions(options) {
41
75
  function setGenerateSidebar(options) {
42
76
  return generateSidebar(getMergeSidebarOptions(options));
43
77
  }
44
- var defaultLlmstxt = llmstxt();
45
- var defaultGitChangelog = GitChangelog({
46
- // 填写在此处填写您的仓库链接
47
- repoURL: () => "https://github.com/ruan-cat/monorepo",
48
- // 最大日志深度为10, 避免获取过多无意义的历史日志
49
- maxGitLogCount: 10
50
- });
51
- var defaultGitChangelogMarkdownSection = GitChangelogMarkdownSection();
52
- var defaultVitePluginVercel = VitePluginVercel();
53
- var defaultVitePlugins = [
54
- defaultLlmstxt,
55
- defaultGitChangelog,
56
- defaultGitChangelogMarkdownSection,
57
- // @ts-ignore
58
- defaultVitePluginVercel
59
- ];
60
78
  var defaultUserConfig = {
79
+ extends: teekConfig,
61
80
  title: "\u8BF7\u586B\u5199\u6709\u610F\u4E49\u7684\u6807\u9898",
62
81
  description: "\u8BF7\u586B\u5199\u6709\u610F\u4E49\u7684\u63CF\u8FF0",
63
82
  lang: "zh",
@@ -87,23 +106,27 @@ var defaultUserConfig = {
87
106
  server: {
88
107
  open: true
89
108
  },
90
- // @ts-ignore
91
- plugins: defaultVitePlugins,
109
+ plugins: [
110
+ /** @see https://github.com/okineadev/vitepress-plugin-llms */
111
+ // @ts-ignore
112
+ llmstxt(),
113
+ // @ts-ignore
114
+ GitChangelog({
115
+ // 填写在此处填写您的仓库链接
116
+ repoURL: () => "https://github.com/ruan-cat/monorepo",
117
+ // 最大日志深度为10, 避免获取过多无意义的历史日志
118
+ maxGitLogCount: 10
119
+ }),
120
+ // @ts-ignore
121
+ GitChangelogMarkdownSection()
122
+ ],
92
123
  optimizeDeps: {
93
- exclude: [
94
- "@nolebase/vitepress-plugin-breadcrumbs/client",
95
- "@nolebase/vitepress-plugin-enhanced-readabilities/client",
96
- "vitepress",
97
- "@nolebase/ui"
98
- ]
124
+ exclude: ["vitepress", "@nolebase/ui"]
99
125
  },
100
126
  ssr: {
101
127
  noExternal: [
102
128
  // 如果还有别的依赖需要添加的话,并排填写和配置到这里即可
103
- "@nolebase/vitepress-plugin-breadcrumbs",
104
- "@nolebase/vitepress-plugin-enhanced-readabilities",
105
- "@nolebase/ui",
106
- "@nolebase/vitepress-plugin-highlight-targeted-heading"
129
+ "@nolebase/ui"
107
130
  ]
108
131
  }
109
132
  },
@@ -138,40 +161,12 @@ function handleChangeLog(userConfig) {
138
161
  }
139
162
  nav.push({ text: "\u66F4\u65B0\u65E5\u5FD7", link: "/CHANGELOG.md" });
140
163
  }
141
- var defaultRuanCatConfig = {
142
- plugins: {
143
- llmstxt: true,
144
- gitChangelog: true,
145
- gitChangelogMarkdownSection: true,
146
- vitePluginVercel: true
147
- }
148
- };
149
- function handlePlugins(userConfig, ruanCatConfig = defaultRuanCatConfig) {
150
- var _a, _b, _c, _d;
151
- let resPlugins = [];
152
- ruanCatConfig = merge({}, cloneDeep(defaultRuanCatConfig), ruanCatConfig);
153
- if ((_a = ruanCatConfig == null ? void 0 : ruanCatConfig.plugins) == null ? void 0 : _a.llmstxt) {
154
- resPlugins.push(defaultLlmstxt);
155
- }
156
- if ((_b = ruanCatConfig == null ? void 0 : ruanCatConfig.plugins) == null ? void 0 : _b.gitChangelog) {
157
- resPlugins.push(defaultGitChangelog);
158
- }
159
- if ((_c = ruanCatConfig == null ? void 0 : ruanCatConfig.plugins) == null ? void 0 : _c.gitChangelogMarkdownSection) {
160
- resPlugins.push(defaultGitChangelogMarkdownSection);
161
- }
162
- if ((_d = ruanCatConfig == null ? void 0 : ruanCatConfig.plugins) == null ? void 0 : _d.vitePluginVercel) {
163
- resPlugins.push(defaultVitePluginVercel);
164
- }
165
- userConfig.vite.plugins = resPlugins;
166
- }
167
- function setUserConfig(config, ruanCatConfig = defaultRuanCatConfig) {
164
+ function setUserConfig(config) {
168
165
  const resUserConfig = merge({}, cloneDeep(defaultUserConfig), isUndefined(config) ? {} : config);
169
166
  handleChangeLog(resUserConfig);
170
- handlePlugins(resUserConfig, ruanCatConfig);
171
167
  return resUserConfig;
172
168
  }
173
169
  export {
174
- VitePluginVercel,
175
170
  addChangelog2doc,
176
171
  copyReadmeMd,
177
172
  defineConfig,
package/dist/theme.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as vitepress_theme_teek from 'vitepress-theme-teek';
1
2
  import * as vue from 'vue';
2
3
  import { EnhanceAppContext } from 'vitepress';
3
4
 
@@ -14,13 +15,14 @@ interface DefineRuancatPresetThemeParams {
14
15
  }
15
16
  /** 默认主题配置 */
16
17
  declare const defaultTheme: {
17
- extends: {
18
+ extends: Omit<{
18
19
  Layout: vue.DefineComponent;
19
20
  enhanceApp: (ctx: EnhanceAppContext) => void;
21
+ }, "enhanceApp"> & {
22
+ extends: vitepress_theme_teek.DefaultThemeType;
23
+ enhanceApp: (options: EnhanceAppContext) => Promise<void>;
20
24
  };
21
- Layout: () => vue.VNode<vue.RendererNode, vue.RendererElement, {
22
- [key: string]: any;
23
- }>;
25
+ Layout: vue.DefineComponent;
24
26
  enhanceApp({ app, router, siteData }: EnhanceAppContext): void;
25
27
  };
26
28
  /**
@@ -28,14 +30,14 @@ declare const defaultTheme: {
28
30
  */
29
31
  declare function defineRuancatPresetTheme(params?: DefineRuancatPresetThemeParams): {
30
32
  enhanceApp({ app, router, siteData }: EnhanceAppContext): void;
31
- setup(): void;
32
- extends: {
33
+ extends: Omit<{
33
34
  Layout: vue.DefineComponent;
34
35
  enhanceApp: (ctx: EnhanceAppContext) => void;
36
+ }, "enhanceApp"> & {
37
+ extends: vitepress_theme_teek.DefaultThemeType;
38
+ enhanceApp: (options: EnhanceAppContext) => Promise<void>;
35
39
  };
36
- Layout: () => vue.VNode<vue.RendererNode, vue.RendererElement, {
37
- [key: string]: any;
38
- }>;
40
+ Layout: vue.DefineComponent;
39
41
  };
40
42
 
41
43
  export { type DefineRuancatPresetThemeParams, type EnhanceAppCallBack, defaultTheme, defineRuancatPresetTheme };
package/dist/theme.mjs CHANGED
@@ -1,51 +1,17 @@
1
1
  // src/theme.ts
2
- import { h } from "vue";
3
- import DefaultTheme from "vitepress/theme";
4
- import { NolebaseBreadcrumbs } from "@nolebase/vitepress-plugin-breadcrumbs/client";
5
- import {
6
- NolebaseEnhancedReadabilitiesMenu,
7
- NolebaseEnhancedReadabilitiesScreenMenu,
8
- InjectionKey,
9
- LayoutMode
10
- } from "@nolebase/vitepress-plugin-enhanced-readabilities/client";
11
- import "@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css";
12
- import { NolebaseHighlightTargetedHeading } from "@nolebase/vitepress-plugin-highlight-targeted-heading/client";
13
- import "@nolebase/vitepress-plugin-highlight-targeted-heading/client/style.css";
14
2
  import { NolebaseGitChangelogPlugin } from "@nolebase/vitepress-plugin-git-changelog/client";
15
3
  import "@nolebase/vitepress-plugin-git-changelog/client/style.css";
16
4
  import TwoslashFloatingVue from "@shikijs/vitepress-twoslash/client";
17
5
  import "@shikijs/vitepress-twoslash/style.css";
18
- import "viewerjs/dist/viewer.min.css";
19
- import imageViewer from "vitepress-plugin-image-viewer";
20
- import { useRoute } from "vitepress";
21
- var defaultLayoutConfig = {
22
- // https://vitepress.dev/guide/extending-default-theme#layout-slots
23
- "doc-before": () => h(NolebaseBreadcrumbs),
24
- "nav-bar-content-after": () => h(NolebaseEnhancedReadabilitiesMenu),
25
- // 为较窄的屏幕(通常是小于 iPad Mini)添加阅读增强菜单
26
- "nav-screen-content-after": () => h(NolebaseEnhancedReadabilitiesScreenMenu),
27
- "layout-top": () => [h(NolebaseHighlightTargetedHeading)]
28
- };
6
+ import Teek from "vitepress-theme-teek";
7
+ import "vitepress-theme-teek/index.css";
29
8
  function defaultEnhanceAppPreset({ app, router, siteData }) {
30
9
  app.use(NolebaseGitChangelogPlugin);
31
10
  app.use(TwoslashFloatingVue);
32
- app.provide(InjectionKey, {
33
- layoutSwitch: {
34
- defaultMode: LayoutMode["BothWidthAdjustable"],
35
- pageLayoutMaxWidth: {
36
- defaultMaxWidth: 85
37
- },
38
- contentLayoutMaxWidth: {
39
- defaultMaxWidth: 95
40
- }
41
- }
42
- });
43
11
  }
44
12
  var defaultTheme = {
45
- extends: DefaultTheme,
46
- Layout: () => {
47
- return h(DefaultTheme.Layout, null, defaultLayoutConfig);
48
- },
13
+ extends: Teek,
14
+ Layout: Teek.Layout,
49
15
  enhanceApp({ app, router, siteData }) {
50
16
  defaultEnhanceAppPreset({ app, router, siteData });
51
17
  }
@@ -57,11 +23,8 @@ function defineRuancatPresetTheme(params) {
57
23
  var _a;
58
24
  defaultTheme.enhanceApp({ app, router, siteData });
59
25
  (_a = params == null ? void 0 : params.enhanceAppCallBack) == null ? void 0 : _a.call(params, { app, router, siteData });
60
- },
61
- setup() {
62
- const route = useRoute();
63
- imageViewer(route);
64
26
  }
27
+ // setup() {},
65
28
  };
66
29
  }
67
30
  export {
package/package.json CHANGED
@@ -1,34 +1,31 @@
1
1
  {
2
2
  "name": "@ruan-cat/vitepress-preset-config",
3
- "version": "0.16.1",
3
+ "version": "1.0.0",
4
4
  "description": "用于给大多数的vitepress项目提供一个预设的配置文件。",
5
5
  "homepage": "https://vitepress-preset.ruancat6312.top",
6
6
  "types": "./src/config.mts",
7
7
  "main": "./src/config.mts",
8
8
  "dependencies": {
9
- "@nolebase/vitepress-plugin-breadcrumbs": "^2.18.1",
10
- "@nolebase/vitepress-plugin-enhanced-readabilities": "^2.18.1",
11
- "@nolebase/vitepress-plugin-git-changelog": "^2.18.1",
12
- "@nolebase/vitepress-plugin-highlight-targeted-heading": "^2.18.1",
13
- "@shikijs/vitepress-twoslash": "^3.8.1",
9
+ "@nolebase/vitepress-plugin-git-changelog": "^2.18.2",
10
+ "@shikijs/vitepress-twoslash": "^3.9.2",
14
11
  "consola": "^3.4.2",
15
12
  "js-yaml": "^4.1.0",
16
13
  "lodash-es": "^4.17.21",
17
14
  "mermaid": "^11.9.0",
18
- "viewerjs": "^1.11.7",
19
- "vite-plugin-vercel": "^9.0.7",
20
- "vitepress-demo-plugin": "^1.4.5",
21
- "vitepress-plugin-image-viewer": "^1.1.6",
22
- "vitepress-plugin-llms": "^1.7.1",
15
+ "vitepress-demo-plugin": "^1.4.7",
16
+ "vitepress-plugin-llms": "^1.7.3",
23
17
  "vitepress-plugin-mermaid": "^2.0.17",
24
18
  "vitepress-sidebar": "^1.33.0",
19
+ "vitepress-theme-teek": "^1.4.3",
25
20
  "vue": "^3.5.18",
26
- "@ruan-cat/utils": "^4.9.1"
21
+ "@ruan-cat/utils": "^4.9.2"
27
22
  },
28
23
  "devDependencies": {
29
24
  "@types/lodash-es": "^4.17.12",
25
+ "automd": "^0.4.0",
26
+ "element-plus": "^2.10.7",
30
27
  "tsup": "^8.5.0",
31
- "vitepress": "^1.6.3"
28
+ "vitepress": "^1.6.4"
32
29
  },
33
30
  "peerDependencies": {
34
31
  "vitepress": "^1.6.x",
@@ -99,6 +96,7 @@
99
96
  "scripts": {
100
97
  "docs:dev": "vitepress dev src --port 8080",
101
98
  "build:docs": "vitepress build src",
102
- "build": "tsup"
99
+ "build": "tsup",
100
+ "prebuild": "automd"
103
101
  }
104
102
  }
@@ -26,8 +26,10 @@ const thisDocUserConfig = setUserConfig({
26
26
  ],
27
27
  },
28
28
  });
29
+
29
30
  // @ts-ignore
30
31
  thisDocUserConfig.themeConfig.sidebar = setGenerateSidebar({
31
32
  documentRootPath: "./src",
32
33
  });
34
+
33
35
  export default thisDocUserConfig;
@@ -1,6 +1,15 @@
1
1
  import { defineRuancatPresetTheme } from "@ruan-cat/vitepress-preset-config/theme";
2
+ import type { EnhanceAppContext } from "vitepress";
2
3
 
3
4
  // 增加用户自定义样式
4
5
  import "./style.css";
5
6
 
6
- export default defineRuancatPresetTheme();
7
+ // 全局导入element-plus组件 并全局注册
8
+ import ElementPlus from "element-plus";
9
+ import "element-plus/dist/index.css";
10
+
11
+ export default defineRuancatPresetTheme({
12
+ enhanceAppCallBack({ app, router, siteData }) {
13
+ app.use(ElementPlus);
14
+ },
15
+ });
package/src/config.mts CHANGED
@@ -1,10 +1,6 @@
1
- import { type PluginOption } from "vite";
2
1
  import { defineConfig, type DefaultTheme, type UserConfig } from "vitepress";
3
2
  export { defineConfig };
4
- import { generateSidebar, withSidebar } from "vitepress-sidebar";
5
-
6
- import { type RuanCatConfig } from "./type.ts";
7
- export { RuanCatConfig };
3
+ import { generateSidebar } from "vitepress-sidebar";
8
4
 
9
5
  import { GitChangelog, GitChangelogMarkdownSection } from "@nolebase/vitepress-plugin-git-changelog/vite";
10
6
  import { vitepressDemoPlugin } from "vitepress-demo-plugin";
@@ -31,8 +27,43 @@ import { withMermaid } from "vitepress-plugin-mermaid";
31
27
  */
32
28
  export { withMermaid };
33
29
 
34
- import VitePluginVercel from "vite-plugin-vercel";
35
- export { VitePluginVercel };
30
+ // https://vp.teek.top/guide/quickstart.html#teek-引入
31
+ import { defineTeekConfig } from "vitepress-theme-teek/config";
32
+
33
+ /** Teek 主题配置 */
34
+ const teekConfig = defineTeekConfig({
35
+ /** @see https://vp.teek.top/reference/config/global-config.html#sidebartrigger */
36
+ sidebarTrigger: true,
37
+
38
+ vitePlugins: {
39
+ /**
40
+ * 关闭 vitepress-plugin-permalink 插件
41
+ * @see https://vp.teek.top/guide/plugins.html#vitepress-plugin-permalink
42
+ */
43
+ permalink: false,
44
+
45
+ /**
46
+ * 关闭 vitepress-plugin-sidebar-resolve 插件
47
+ * @see https://vp.teek.top/guide/plugins.html#vitepress-plugin-sidebar-resolve
48
+ */
49
+ sidebar: false,
50
+
51
+ /**
52
+ * 关闭 vitepress-plugin-md-h1 插件
53
+ * @see https://vp.teek.top/guide/plugins.html#vitepress-plugin-md-h1
54
+ */
55
+ mdH1: false,
56
+ },
57
+
58
+ /** @see https://vp.teek.top/reference/article-config.html#articleshare */
59
+ articleShare: {
60
+ enabled: true, // 是否开启文章链接分享功能
61
+ text: "分享此页面", // 分享按钮文本
62
+ copiedText: "链接已复制", // 复制成功文本
63
+ query: false, // 是否包含查询参数
64
+ hash: false, // 是否包含哈希值
65
+ },
66
+ });
36
67
 
37
68
  type VitePressSidebarOptions = Parameters<typeof generateSidebar>[0];
38
69
 
@@ -87,31 +118,10 @@ export function setGenerateSidebar(options?: VitePressSidebarOptions) {
87
118
  return generateSidebar(getMergeSidebarOptions(options));
88
119
  }
89
120
 
90
- /** @see https://github.com/okineadev/vitepress-plugin-llms */
91
- const defaultLlmstxt = llmstxt();
92
-
93
- const defaultGitChangelog = GitChangelog({
94
- // 填写在此处填写您的仓库链接
95
- repoURL: () => "https://github.com/ruan-cat/monorepo",
96
- // 最大日志深度为10, 避免获取过多无意义的历史日志
97
- maxGitLogCount: 10,
98
- });
99
-
100
- const defaultGitChangelogMarkdownSection = GitChangelogMarkdownSection();
101
-
102
- const defaultVitePluginVercel = VitePluginVercel();
103
-
104
- /** 默认的vite插件 */
105
- const defaultVitePlugins: PluginOption[] = [
106
- defaultLlmstxt,
107
- defaultGitChangelog,
108
- defaultGitChangelogMarkdownSection,
109
- // @ts-ignore
110
- defaultVitePluginVercel,
111
- ];
112
-
113
121
  /** 默认用户配置 */
114
122
  const defaultUserConfig: UserConfig<DefaultTheme.Config> = {
123
+ extends: teekConfig,
124
+
115
125
  title: "请填写有意义的标题",
116
126
  description: "请填写有意义的描述",
117
127
 
@@ -150,27 +160,31 @@ const defaultUserConfig: UserConfig<DefaultTheme.Config> = {
150
160
  open: true,
151
161
  },
152
162
 
153
- // @ts-ignore
154
- plugins: defaultVitePlugins,
163
+ plugins: [
164
+ /** @see https://github.com/okineadev/vitepress-plugin-llms */
165
+ // @ts-ignore
166
+ llmstxt(),
167
+
168
+ // @ts-ignore
169
+ GitChangelog({
170
+ // 填写在此处填写您的仓库链接
171
+ repoURL: () => "https://github.com/ruan-cat/monorepo",
172
+ // 最大日志深度为10, 避免获取过多无意义的历史日志
173
+ maxGitLogCount: 10,
174
+ }),
175
+
176
+ // @ts-ignore
177
+ GitChangelogMarkdownSection(),
178
+ ],
155
179
 
156
180
  optimizeDeps: {
157
- exclude: [
158
- "@nolebase/vitepress-plugin-breadcrumbs/client",
159
- "@nolebase/vitepress-plugin-enhanced-readabilities/client",
160
- "vitepress",
161
- "@nolebase/ui",
162
- ],
181
+ exclude: ["vitepress", "@nolebase/ui"],
163
182
  },
164
183
 
165
184
  ssr: {
166
185
  noExternal: [
167
186
  // 如果还有别的依赖需要添加的话,并排填写和配置到这里即可
168
- "@nolebase/vitepress-plugin-breadcrumbs",
169
-
170
- "@nolebase/vitepress-plugin-enhanced-readabilities",
171
187
  "@nolebase/ui",
172
-
173
- "@nolebase/vitepress-plugin-highlight-targeted-heading",
174
188
  ],
175
189
  },
176
190
  },
@@ -220,56 +234,13 @@ function handleChangeLog(userConfig: UserConfig<DefaultTheme.Config>) {
220
234
  nav.push({ text: "更新日志", link: "/CHANGELOG.md" });
221
235
  }
222
236
 
223
- const defaultRuanCatConfig: RuanCatConfig = {
224
- plugins: {
225
- llmstxt: true,
226
- gitChangelog: true,
227
- gitChangelogMarkdownSection: true,
228
- vitePluginVercel: true,
229
- },
230
- };
231
-
232
- /** 处理插件配置 */
233
- function handlePlugins(
234
- //
235
- userConfig: UserConfig<DefaultTheme.Config>,
236
- ruanCatConfig: RuanCatConfig = defaultRuanCatConfig,
237
- ) {
238
- let resPlugins: PluginOption[] = [];
239
-
240
- ruanCatConfig = merge({}, cloneDeep(defaultRuanCatConfig), ruanCatConfig);
241
-
242
- if (ruanCatConfig?.plugins?.llmstxt) {
243
- resPlugins.push(defaultLlmstxt);
244
- }
245
- if (ruanCatConfig?.plugins?.gitChangelog) {
246
- resPlugins.push(defaultGitChangelog);
247
- }
248
- if (ruanCatConfig?.plugins?.gitChangelogMarkdownSection) {
249
- resPlugins.push(defaultGitChangelogMarkdownSection);
250
- }
251
- if (ruanCatConfig?.plugins?.vitePluginVercel) {
252
- // @ts-ignore
253
- resPlugins.push(defaultVitePluginVercel);
254
- }
255
-
256
- // @ts-ignore
257
- userConfig.vite.plugins = resPlugins;
258
- }
259
-
260
237
  /** 设置vitepress主配置 */
261
- export function setUserConfig(
262
- config?: UserConfig<DefaultTheme.Config>,
263
- ruanCatConfig: RuanCatConfig = defaultRuanCatConfig,
264
- ): UserConfig<DefaultTheme.Config> {
238
+ export function setUserConfig(config?: UserConfig<DefaultTheme.Config>): UserConfig<DefaultTheme.Config> {
265
239
  /** 最终的用户数据 */
266
240
  const resUserConfig = merge({}, cloneDeep(defaultUserConfig), isUndefined(config) ? {} : config);
267
241
 
268
242
  // 增加导航栏
269
243
  handleChangeLog(resUserConfig);
270
244
 
271
- // 设置插件
272
- handlePlugins(resUserConfig, ruanCatConfig);
273
-
274
245
  return resUserConfig;
275
246
  }
package/src/theme.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  // https://vitepress.dev/guide/custom-theme
2
- import { h } from "vue";
3
2
  import type { Theme, EnhanceAppContext } from "vitepress";
4
- import DefaultTheme from "vitepress/theme";
5
3
 
6
4
  /**
7
5
  * 警告 将全部的样式集中在专门的文件内 在tsup内被打包出去
@@ -9,34 +7,15 @@ import DefaultTheme from "vitepress/theme";
9
7
  */
10
8
  // import "./index.css";
11
9
 
12
- // 警告 放弃内部处理该库 直接使用peer对等依赖 不再考虑包装封装该库
13
- // import { VitepressDemoBox, VitepressDemoPlaceholder } from "@ruan-cat/vitepress-demo-plugin";
14
- // import "@ruan-cat/vitepress-demo-plugin/dist/index.css";
15
-
16
- import { NolebaseBreadcrumbs } from "@nolebase/vitepress-plugin-breadcrumbs/client";
17
-
18
- import {
19
- NolebaseEnhancedReadabilitiesMenu,
20
- NolebaseEnhancedReadabilitiesScreenMenu,
21
- // https://nolebase-integrations.ayaka.io/pages/zh-CN/integrations/vitepress-plugin-enhanced-readabilities/#如何在-vitepress-中进行配置
22
- InjectionKey,
23
- type Options,
24
- LayoutMode,
25
- } from "@nolebase/vitepress-plugin-enhanced-readabilities/client";
26
- import "@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css";
27
-
28
- import { NolebaseHighlightTargetedHeading } from "@nolebase/vitepress-plugin-highlight-targeted-heading/client";
29
- import "@nolebase/vitepress-plugin-highlight-targeted-heading/client/style.css";
30
-
31
10
  import { NolebaseGitChangelogPlugin } from "@nolebase/vitepress-plugin-git-changelog/client";
32
11
  import "@nolebase/vitepress-plugin-git-changelog/client/style.css";
33
12
 
34
13
  import TwoslashFloatingVue from "@shikijs/vitepress-twoslash/client";
35
14
  import "@shikijs/vitepress-twoslash/style.css";
36
15
 
37
- import "viewerjs/dist/viewer.min.css";
38
- import imageViewer from "vitepress-plugin-image-viewer";
39
- import { useRoute } from "vitepress";
16
+ // https://vp.teek.top/guide/quickstart.html#teek-引入
17
+ import Teek from "vitepress-theme-teek";
18
+ import "vitepress-theme-teek/index.css";
40
19
 
41
20
  /**
42
21
  * 一个回调函数 用来暴露变量 实现注册
@@ -51,20 +30,6 @@ export interface DefineRuancatPresetThemeParams {
51
30
  enhanceAppCallBack?: EnhanceAppCallBack;
52
31
  }
53
32
 
54
- /**
55
- * 默认布局配置
56
- * @description
57
- * @private
58
- */
59
- const defaultLayoutConfig = {
60
- // https://vitepress.dev/guide/extending-default-theme#layout-slots
61
- "doc-before": () => h(NolebaseBreadcrumbs),
62
- "nav-bar-content-after": () => h(NolebaseEnhancedReadabilitiesMenu),
63
- // 为较窄的屏幕(通常是小于 iPad Mini)添加阅读增强菜单
64
- "nav-screen-content-after": () => h(NolebaseEnhancedReadabilitiesScreenMenu),
65
- "layout-top": () => [h(NolebaseHighlightTargetedHeading)],
66
- };
67
-
68
33
  /**
69
34
  * 默认 enhanceApp 预设
70
35
  * @description
@@ -74,17 +39,6 @@ const defaultLayoutConfig = {
74
39
  function defaultEnhanceAppPreset({ app, router, siteData }: EnhanceAppContext) {
75
40
  app.use(NolebaseGitChangelogPlugin);
76
41
  app.use(TwoslashFloatingVue);
77
- app.provide(InjectionKey, {
78
- layoutSwitch: {
79
- defaultMode: LayoutMode["BothWidthAdjustable"],
80
- pageLayoutMaxWidth: {
81
- defaultMaxWidth: 85,
82
- },
83
- contentLayoutMaxWidth: {
84
- defaultMaxWidth: 95,
85
- },
86
- },
87
- } as Options);
88
42
  /**
89
43
  * 放弃全局注册demo展示组件
90
44
  * 在生产环境内使用peer对等依赖
@@ -95,10 +49,8 @@ function defaultEnhanceAppPreset({ app, router, siteData }: EnhanceAppContext) {
95
49
 
96
50
  /** 默认主题配置 */
97
51
  export const defaultTheme = {
98
- extends: DefaultTheme,
99
- Layout: () => {
100
- return h(DefaultTheme.Layout, null, defaultLayoutConfig);
101
- },
52
+ extends: Teek,
53
+ Layout: Teek.Layout,
102
54
  enhanceApp({ app, router, siteData }: EnhanceAppContext) {
103
55
  defaultEnhanceAppPreset({ app, router, siteData });
104
56
  },
@@ -116,11 +68,6 @@ export function defineRuancatPresetTheme(params?: DefineRuancatPresetThemeParams
116
68
  // 执行用户传入的回调函数
117
69
  params?.enhanceAppCallBack?.({ app, router, siteData });
118
70
  },
119
- setup() {
120
- // Get route
121
- const route = useRoute();
122
- // Using
123
- imageViewer(route);
124
- },
71
+ // setup() {},
125
72
  } satisfies Theme;
126
73
  }
package/src/type.ts DELETED
@@ -1,9 +0,0 @@
1
- /** 阮喵喵针对文档行为的配置 */
2
- export interface RuanCatConfig {
3
- plugins?: {
4
- llmstxt?: boolean;
5
- gitChangelog?: boolean;
6
- gitChangelogMarkdownSection?: boolean;
7
- vitePluginVercel?: boolean;
8
- };
9
- }