@sugarat/theme 0.5.0 → 0.5.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/node.js
CHANGED
|
@@ -41,7 +41,7 @@ module.exports = __toCommonJS(node_exports);
|
|
|
41
41
|
// src/utils/node/mdPlugins.ts
|
|
42
42
|
var import_module = require("module");
|
|
43
43
|
|
|
44
|
-
// ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.4.1_@algolia+client-search@4.19.1_@types+node@20.6.
|
|
44
|
+
// ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.4.1_@algolia+client-search@4.19.1_@types+node@20.6.3__4q6ku3o3anoir4jnhobsqtwjza/node_modules/vitepress-plugin-tabs/dist/index.js
|
|
45
45
|
var tabsMarker = "=tabs";
|
|
46
46
|
var tabsMarkerLen = tabsMarker.length;
|
|
47
47
|
var ruleBlockTabs = (state, startLine, endLine, silent) => {
|
|
@@ -675,7 +675,7 @@ function coverImgTransform() {
|
|
|
675
675
|
function providePageData(cfg) {
|
|
676
676
|
return {
|
|
677
677
|
name: "@sugarat/theme-plugin-provide-page-data",
|
|
678
|
-
async config(config) {
|
|
678
|
+
async config(config, env) {
|
|
679
679
|
const vitepressConfig = config.vitepress;
|
|
680
680
|
const pagesData = await getArticles(cfg, vitepressConfig);
|
|
681
681
|
if (vitepressConfig.site.locales && Object.keys(vitepressConfig.site.locales).length > 1) {
|
|
@@ -696,7 +696,9 @@ function providePageData(cfg) {
|
|
|
696
696
|
return route.startsWith(`/${localeKey}`);
|
|
697
697
|
});
|
|
698
698
|
});
|
|
699
|
-
|
|
699
|
+
if (env.mode === "production") {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
700
702
|
}
|
|
701
703
|
vitepressConfig.site.themeConfig.blog.pagesData = pagesData;
|
|
702
704
|
}
|
package/node.mjs
CHANGED
|
@@ -9,7 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
9
|
// src/utils/node/mdPlugins.ts
|
|
10
10
|
import { createRequire } from "module";
|
|
11
11
|
|
|
12
|
-
// ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.4.1_@algolia+client-search@4.19.1_@types+node@20.6.
|
|
12
|
+
// ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.4.1_@algolia+client-search@4.19.1_@types+node@20.6.3__4q6ku3o3anoir4jnhobsqtwjza/node_modules/vitepress-plugin-tabs/dist/index.js
|
|
13
13
|
var tabsMarker = "=tabs";
|
|
14
14
|
var tabsMarkerLen = tabsMarker.length;
|
|
15
15
|
var ruleBlockTabs = (state, startLine, endLine, silent) => {
|
|
@@ -643,7 +643,7 @@ function coverImgTransform() {
|
|
|
643
643
|
function providePageData(cfg) {
|
|
644
644
|
return {
|
|
645
645
|
name: "@sugarat/theme-plugin-provide-page-data",
|
|
646
|
-
async config(config) {
|
|
646
|
+
async config(config, env) {
|
|
647
647
|
const vitepressConfig = config.vitepress;
|
|
648
648
|
const pagesData = await getArticles(cfg, vitepressConfig);
|
|
649
649
|
if (vitepressConfig.site.locales && Object.keys(vitepressConfig.site.locales).length > 1) {
|
|
@@ -664,7 +664,9 @@ function providePageData(cfg) {
|
|
|
664
664
|
return route.startsWith(`/${localeKey}`);
|
|
665
665
|
});
|
|
666
666
|
});
|
|
667
|
-
|
|
667
|
+
if (env.mode === "production") {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
668
670
|
}
|
|
669
671
|
vitepressConfig.site.themeConfig.blog.pagesData = pagesData;
|
|
670
672
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sugarat/theme",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
|
|
5
5
|
"author": "sugar",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
"vitepress-plugin-mermaid": "2.0.13",
|
|
55
55
|
"vitepress-plugin-tabs": "0.2.0",
|
|
56
56
|
"@sugarat/theme-shared": "0.0.3",
|
|
57
|
+
"vitepress-plugin-pagefind": "0.4.10",
|
|
57
58
|
"vitepress-plugin-announcement": "0.1.3",
|
|
58
|
-
"vitepress-plugin-rss": "0.3.0"
|
|
59
|
-
"vitepress-plugin-pagefind": "0.4.10"
|
|
59
|
+
"vitepress-plugin-rss": "0.3.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@element-plus/icons-vue": "^2.3.1",
|
|
63
63
|
"artalk": "^2.8.5",
|
|
64
64
|
"element-plus": "^2.7.2",
|
|
65
|
-
"pagefind": "^1.1.
|
|
65
|
+
"pagefind": "^1.1.1",
|
|
66
66
|
"sass": "^1.77.8",
|
|
67
67
|
"typescript": "^5.4.5",
|
|
68
|
-
"vite": "^5.
|
|
68
|
+
"vite": "^5.4.9",
|
|
69
69
|
"vitepress": "1.4.1",
|
|
70
|
-
"vue": "^3.
|
|
70
|
+
"vue": "^3.5.12",
|
|
71
71
|
"vitepress-plugin-51la": "0.1.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
@@ -33,7 +33,7 @@ const currentWeek = computed(() => {
|
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
const analysis = useHomeAnalysis()
|
|
36
|
-
const titles = computed(() => (frontmatter.value?.blog?.analysis?.articles?.title || analysis?.articles?.title || []))
|
|
36
|
+
const titles = computed(() => (frontmatter.value?.blog?.analysis?.articles?.title || analysis?.value?.articles?.title || []))
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
39
|
<template>
|
|
@@ -30,14 +30,15 @@ function handleSkipDoc() {
|
|
|
30
30
|
router.go(link.value)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const imageStyle = useImageStyle()
|
|
34
|
+
const coverPreview = computed(() => imageStyle.value.coverPreview)
|
|
34
35
|
|
|
35
36
|
const resultCover = computed(() => {
|
|
36
37
|
if (!props.cover) {
|
|
37
38
|
return ''
|
|
38
39
|
}
|
|
39
40
|
const baseCover = withBase(props.cover)
|
|
40
|
-
const coverRule = [coverPreview]
|
|
41
|
+
const coverRule = [coverPreview.value]
|
|
41
42
|
.flat()
|
|
42
43
|
.filter(v => !!v)
|
|
43
44
|
.find((coverRule) => {
|
|
@@ -347,11 +347,13 @@ export function useCleanUrls() {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
export function useImageStyle() {
|
|
350
|
-
|
|
350
|
+
const blogConfig = useBlogConfig()
|
|
351
|
+
return computed<Theme.ImageStyleConfig>(() => blogConfig.value?.imageStyle || {})
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
export function useHomeAnalysis() {
|
|
354
|
-
|
|
355
|
+
const home = useHomeConfig()
|
|
356
|
+
return computed(() => home.value?.analysis)
|
|
355
357
|
}
|
|
356
358
|
|
|
357
359
|
export function useAnalyzeTitles(wordCount: Ref<number>, readTime: ComputedRef<number>) {
|
|
@@ -216,7 +216,7 @@ export function coverImgTransform() {
|
|
|
216
216
|
export function providePageData(cfg: Partial<Theme.BlogConfig>) {
|
|
217
217
|
return {
|
|
218
218
|
name: '@sugarat/theme-plugin-provide-page-data',
|
|
219
|
-
async config(config: any) {
|
|
219
|
+
async config(config: any, env) {
|
|
220
220
|
const vitepressConfig: SiteConfig = config.vitepress
|
|
221
221
|
const pagesData = await getArticles(cfg, vitepressConfig)
|
|
222
222
|
if (vitepressConfig.site.locales && Object.keys(vitepressConfig.site.locales).length > 1) {
|
|
@@ -239,7 +239,9 @@ export function providePageData(cfg: Partial<Theme.BlogConfig>) {
|
|
|
239
239
|
return route.startsWith(`/${localeKey}`)
|
|
240
240
|
})
|
|
241
241
|
})
|
|
242
|
-
|
|
242
|
+
if (env.mode === 'production') {
|
|
243
|
+
return
|
|
244
|
+
}
|
|
243
245
|
}
|
|
244
246
|
vitepressConfig.site.themeConfig.blog.pagesData = pagesData
|
|
245
247
|
},
|