valaxy 0.26.13 → 0.28.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/client/app/data.ts +2 -2
- package/client/components/AppLink.vue +4 -0
- package/client/components/ClientOnly.ts +12 -0
- package/client/components/ValaxyDynamicComponent.vue +22 -14
- package/client/composables/common.ts +6 -5
- package/client/composables/dark.ts +18 -11
- package/client/composables/features/copy-markdown.ts +85 -0
- package/client/composables/features/index.ts +1 -0
- package/client/composables/post/index.ts +35 -22
- package/client/config.ts +4 -2
- package/client/entry-ssr.ts +25 -0
- package/client/index.d.ts +2 -8
- package/client/locales/en.yml +8 -0
- package/client/locales/zh-CN.yml +8 -0
- package/client/main.ts +82 -22
- package/client/modules/components.ts +2 -2
- package/client/modules/floating-vue.ts +2 -3
- package/client/modules/valaxy.ts +2 -3
- package/client/setup/main.ts +2 -3
- package/client/setups.ts +24 -3
- package/client/stores/site.ts +11 -6
- package/client/styles/common/view-transition.css +4 -9
- package/client/styles/css-vars.scss +7 -6
- package/client/tsconfig.json +0 -1
- package/client/types/index.ts +2 -2
- package/dist/node/cli/index.mjs +15 -10
- package/dist/node/index.d.mts +155 -10
- package/dist/node/index.mjs +15 -10
- package/dist/shared/{valaxy.CEmGx65r.mjs → valaxy.CKsfoRMA.mjs} +3265 -1908
- package/dist/shared/{valaxy.gqLhCu14.d.mts → valaxy.Dgja0_Y0.d.mts} +165 -58
- package/dist/types/index.d.mts +4 -7
- package/package.json +27 -28
- package/shared/node/i18n.ts +15 -1
- package/types/config.ts +74 -0
- package/types/frontmatter/page.ts +6 -1
- package/types/index.ts +3 -0
- package/types/vue-router.d.ts +29 -0
- package/client/templates/loader.vue +0 -10
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Header } from '@valaxyjs/utils';
|
|
1
2
|
import { FuseOptions } from '@vueuse/integrations/useFuse';
|
|
2
3
|
import { ZoomOptions } from 'medium-zoom';
|
|
3
4
|
import { ILazyLoadOptions } from 'vanilla-lazyload';
|
|
@@ -5,62 +6,6 @@ import { RouteRecordRaw } from 'vue-router';
|
|
|
5
6
|
import { UseDarkOptions } from '@vueuse/core';
|
|
6
7
|
import { NodeRelations, ImageObject } from '@unhead/schema-org';
|
|
7
8
|
|
|
8
|
-
interface ValaxyAddon<AddonOptions = Record<string, any>> {
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* be global component
|
|
12
|
-
*/
|
|
13
|
-
global?: boolean;
|
|
14
|
-
props?: Record<string, any>;
|
|
15
|
-
options?: AddonOptions;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
declare namespace DefaultTheme {
|
|
19
|
-
interface Config {
|
|
20
|
-
valaxyDarkOptions?: {
|
|
21
|
-
/**
|
|
22
|
-
* Options for `useDark`
|
|
23
|
-
* disableTransition default is `true`
|
|
24
|
-
* Its options are not computed, init when loaded.
|
|
25
|
-
* @see https://vueuse.org/core/useDark
|
|
26
|
-
* @url https://paco.me/writing/disable-theme-transitions
|
|
27
|
-
*
|
|
28
|
-
* @zh `useDark` 的选项
|
|
29
|
-
* disableTransition 默认为 `true`,不会进行渐变过渡,这是 VueUse 的默认行为
|
|
30
|
-
*/
|
|
31
|
-
useDarkOptions?: UseDarkOptions;
|
|
32
|
-
/**
|
|
33
|
-
* Enable circle transition when toggling dark mode
|
|
34
|
-
* Then use `toggleDarkWithTransition` instead of `toggleDark`
|
|
35
|
-
* @zh 启用圆形过渡切换暗黑模式
|
|
36
|
-
*/
|
|
37
|
-
circleTransition?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Theme color
|
|
40
|
-
* @zh 主题色
|
|
41
|
-
*/
|
|
42
|
-
themeColor?: {
|
|
43
|
-
/**
|
|
44
|
-
* Theme color for light mode
|
|
45
|
-
* @zh 亮色主题色
|
|
46
|
-
*/
|
|
47
|
-
light?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Theme color for dark mode
|
|
50
|
-
* @zh 暗色主题色
|
|
51
|
-
*/
|
|
52
|
-
dark?: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Custom header levels of outline in the aside component.
|
|
57
|
-
*
|
|
58
|
-
* @default 2
|
|
59
|
-
*/
|
|
60
|
-
outline?: number | [number, number] | 'deep' | false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
9
|
interface CollectionConfig {
|
|
65
10
|
title?: string;
|
|
66
11
|
key?: string;
|
|
@@ -242,7 +187,12 @@ interface PageFrontMatter extends BaseFrontMatter {
|
|
|
242
187
|
*/
|
|
243
188
|
end: boolean;
|
|
244
189
|
/**
|
|
245
|
-
*
|
|
190
|
+
* Enable/disable KaTeX math rendering for this page.
|
|
191
|
+
* Overrides the global `features.katex` setting.
|
|
192
|
+
*
|
|
193
|
+
* - When `features.katex: true` (default), set `katex: false` to disable KaTeX for this page.
|
|
194
|
+
* - When `features.katex: false`, set `katex: true` to enable KaTeX for this page.
|
|
195
|
+
*
|
|
246
196
|
* @url https://katex.org/
|
|
247
197
|
*/
|
|
248
198
|
katex: boolean;
|
|
@@ -407,6 +357,92 @@ interface PostFrontMatter extends PageFrontMatter {
|
|
|
407
357
|
wordCount: string;
|
|
408
358
|
}
|
|
409
359
|
|
|
360
|
+
type Page = Partial<PageFrontMatter>;
|
|
361
|
+
type Post = Partial<PostFrontMatter>;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Extend vue-router's RouteMeta interface
|
|
365
|
+
* @see https://router.vuejs.org/guide/advanced/meta.html#TypeScript
|
|
366
|
+
*/
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
declare module 'vue-router' {
|
|
370
|
+
interface RouteMeta {
|
|
371
|
+
/**
|
|
372
|
+
* Headers extracted from markdown
|
|
373
|
+
*/
|
|
374
|
+
headers: Header[]
|
|
375
|
+
/**
|
|
376
|
+
* Frontmatter data from markdown files
|
|
377
|
+
*/
|
|
378
|
+
frontmatter: Post
|
|
379
|
+
/**
|
|
380
|
+
* Excerpt from markdown content
|
|
381
|
+
*/
|
|
382
|
+
excerpt?: string
|
|
383
|
+
/**
|
|
384
|
+
* Layout name
|
|
385
|
+
*/
|
|
386
|
+
layout?: string
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface ValaxyAddon<AddonOptions = Record<string, any>> {
|
|
391
|
+
name: string;
|
|
392
|
+
/**
|
|
393
|
+
* be global component
|
|
394
|
+
*/
|
|
395
|
+
global?: boolean;
|
|
396
|
+
props?: Record<string, any>;
|
|
397
|
+
options?: AddonOptions;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
declare namespace DefaultTheme {
|
|
401
|
+
interface Config {
|
|
402
|
+
valaxyDarkOptions?: {
|
|
403
|
+
/**
|
|
404
|
+
* Options for `useDark`
|
|
405
|
+
* disableTransition default is `true`
|
|
406
|
+
* Its options are not computed, init when loaded.
|
|
407
|
+
* @see https://vueuse.org/core/useDark
|
|
408
|
+
* @url https://paco.me/writing/disable-theme-transitions
|
|
409
|
+
*
|
|
410
|
+
* @zh `useDark` 的选项
|
|
411
|
+
* disableTransition 默认为 `true`,不会进行渐变过渡,这是 VueUse 的默认行为
|
|
412
|
+
*/
|
|
413
|
+
useDarkOptions?: UseDarkOptions;
|
|
414
|
+
/**
|
|
415
|
+
* Enable circle transition when toggling dark mode
|
|
416
|
+
* Then use `toggleDarkWithTransition` instead of `toggleDark`
|
|
417
|
+
* @zh 启用圆形过渡切换暗黑模式
|
|
418
|
+
*/
|
|
419
|
+
circleTransition?: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* Theme color
|
|
422
|
+
* @zh 主题色
|
|
423
|
+
*/
|
|
424
|
+
themeColor?: {
|
|
425
|
+
/**
|
|
426
|
+
* Theme color for light mode
|
|
427
|
+
* @zh 亮色主题色
|
|
428
|
+
*/
|
|
429
|
+
light?: string;
|
|
430
|
+
/**
|
|
431
|
+
* Theme color for dark mode
|
|
432
|
+
* @zh 暗色主题色
|
|
433
|
+
*/
|
|
434
|
+
dark?: string;
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
/**
|
|
438
|
+
* Custom header levels of outline in the aside component.
|
|
439
|
+
*
|
|
440
|
+
* @default 2
|
|
441
|
+
*/
|
|
442
|
+
outline?: number | [number, number] | 'deep' | false;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
410
446
|
interface FuseListItem extends Record<string, any> {
|
|
411
447
|
title: string | Record<string, string>;
|
|
412
448
|
excerpt?: string;
|
|
@@ -618,6 +654,34 @@ interface SiteConfig {
|
|
|
618
654
|
keys: FuseOptions<FuseListItem>['keys'];
|
|
619
655
|
};
|
|
620
656
|
};
|
|
657
|
+
/**
|
|
658
|
+
* Excerpt configuration
|
|
659
|
+
* @description:en-US Global excerpt settings for posts
|
|
660
|
+
* @description:zh-CN 全局摘要配置
|
|
661
|
+
*/
|
|
662
|
+
excerpt: {
|
|
663
|
+
/**
|
|
664
|
+
* @description:en-US Default excerpt render type for `<!-- more -->` and auto-generated excerpts.
|
|
665
|
+
* Can be overridden per-post via frontmatter `excerpt_type`.
|
|
666
|
+
* Does not apply when frontmatter `excerpt` is set manually (used as-is).
|
|
667
|
+
* @description:zh-CN `<!-- more -->` 及自动摘要的默认渲染类型,可通过 frontmatter `excerpt_type` 逐篇覆盖。
|
|
668
|
+
* 当 frontmatter 手动指定 `excerpt` 时不生效(直接使用原始字符串)。
|
|
669
|
+
* @default 'html'
|
|
670
|
+
*/
|
|
671
|
+
type: ExcerptType;
|
|
672
|
+
/**
|
|
673
|
+
* @description:en-US Auto-generate excerpt from post content when no manual excerpt is provided
|
|
674
|
+
* @description:zh-CN 当没有手动指定摘要时,自动从文章内容截取摘要
|
|
675
|
+
* @default false
|
|
676
|
+
*/
|
|
677
|
+
auto: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* @description:en-US Maximum length of auto-generated excerpt (in characters)
|
|
680
|
+
* @description:zh-CN 自动摘要的最大长度(字符数)
|
|
681
|
+
* @default 200
|
|
682
|
+
*/
|
|
683
|
+
length: number;
|
|
684
|
+
};
|
|
621
685
|
/**
|
|
622
686
|
* set post default frontmatter
|
|
623
687
|
*/
|
|
@@ -776,6 +840,49 @@ interface SiteConfig {
|
|
|
776
840
|
* @description:zh-CN 限制代码块的高度,单位是 px
|
|
777
841
|
*/
|
|
778
842
|
codeHeightLimit?: number;
|
|
843
|
+
/**
|
|
844
|
+
* @zh llms.txt 及原始 Markdown 文件输出
|
|
845
|
+
* @en llms.txt and raw Markdown file output
|
|
846
|
+
* @see https://llmstxt.org/
|
|
847
|
+
*/
|
|
848
|
+
llms: {
|
|
849
|
+
/**
|
|
850
|
+
* @zh 是否开启 llms.txt 和 .md 原始文件输出
|
|
851
|
+
* @en Enable llms.txt and raw .md file output
|
|
852
|
+
* @default false
|
|
853
|
+
*/
|
|
854
|
+
enable: boolean;
|
|
855
|
+
/**
|
|
856
|
+
* @zh 是否生成 llms-full.txt(包含所有文章完整内容)
|
|
857
|
+
* @en Whether to generate llms-full.txt (with all post content inlined)
|
|
858
|
+
* @default true
|
|
859
|
+
*/
|
|
860
|
+
fullText: boolean;
|
|
861
|
+
/**
|
|
862
|
+
* @zh 是否为每篇文章生成独立的 .md 文件(可通过 /posts/xxx.md 访问)
|
|
863
|
+
* @en Whether to generate individual .md files for each post (accessible via /posts/xxx.md)
|
|
864
|
+
* @default true
|
|
865
|
+
*/
|
|
866
|
+
files: boolean;
|
|
867
|
+
/**
|
|
868
|
+
* @zh 自定义提示词(添加到 llms.txt blockquote 部分)
|
|
869
|
+
* @en Custom prompt text (added to the llms.txt blockquote section)
|
|
870
|
+
* @default ''
|
|
871
|
+
*/
|
|
872
|
+
prompt: string;
|
|
873
|
+
/**
|
|
874
|
+
* @zh 要包含的 markdown 文件 glob 模式(相对于 pages/ 目录)。
|
|
875
|
+
* 默认为 `['posts\/**\/*.md']` 仅包含 posts。
|
|
876
|
+
* 设为 `['**\/*.md']` 可包含所有 pages 下的 markdown 文件。
|
|
877
|
+
* 也可以指定多个目录,如 `['posts\/**\/*.md', 'guide\/**\/*.md']`。
|
|
878
|
+
* @en Glob patterns for markdown files to include (relative to pages/ directory).
|
|
879
|
+
* Defaults to `['posts\/**\/*.md']` to only include posts.
|
|
880
|
+
* Set to `['**\/*.md']` to include all markdown files under pages/.
|
|
881
|
+
* You can also specify multiple directories, e.g. `['posts\/**\/*.md', 'guide\/**\/*.md']`.
|
|
882
|
+
* @default ['posts\/**\/*.md']
|
|
883
|
+
*/
|
|
884
|
+
include?: string[];
|
|
885
|
+
};
|
|
779
886
|
/**
|
|
780
887
|
* @description:en-US client redirect rules
|
|
781
888
|
* @description:zh-CN 客户端重定向规则
|
|
@@ -846,4 +953,4 @@ type UserSiteConfig = PartialDeep<SiteConfig>;
|
|
|
846
953
|
type UserValaxyConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep<ValaxyConfig<ThemeConfig>>;
|
|
847
954
|
|
|
848
955
|
export { DefaultTheme as D };
|
|
849
|
-
export type { Album as A, BaseFrontMatter as B, ExcerptType as E, FuseListItem as F, PartialDeep as P, RuntimeConfig as R, SiteConfig as S, UserSiteConfig as U, ValaxyConfig as V, RedirectItem as a, ValaxyAddon as b,
|
|
956
|
+
export type { Album as A, BaseFrontMatter as B, ExcerptType as E, FuseListItem as F, PartialDeep as P, RuntimeConfig as R, SiteConfig as S, UserSiteConfig as U, ValaxyConfig as V, RedirectItem as a, ValaxyAddon as b, Post as c, Page as d, PageFrontMatter as e, Photo as f, Pkg as g, PostFrontMatter as h, RedirectRule as i, SocialLink as j, UserValaxyConfig as k };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
export { A as Album, B as BaseFrontMatter, D as DefaultTheme, E as ExcerptType, F as FuseListItem, P as PartialDeep,
|
|
1
|
+
import { c as Post } from '../shared/valaxy.Dgja0_Y0.mjs';
|
|
2
|
+
export { A as Album, B as BaseFrontMatter, D as DefaultTheme, E as ExcerptType, F as FuseListItem, d as Page, e as PageFrontMatter, P as PartialDeep, f as Photo, g as Pkg, h as PostFrontMatter, a as RedirectItem, i as RedirectRule, R as RuntimeConfig, S as SiteConfig, j as SocialLink, U as UserSiteConfig, k as UserValaxyConfig, b as ValaxyAddon, V as ValaxyConfig } from '../shared/valaxy.Dgja0_Y0.mjs';
|
|
3
3
|
import { Header } from '@valaxyjs/utils';
|
|
4
4
|
import '@vueuse/integrations/useFuse';
|
|
5
5
|
import 'medium-zoom';
|
|
@@ -8,9 +8,6 @@ import 'vue-router';
|
|
|
8
8
|
import '@vueuse/core';
|
|
9
9
|
import '@unhead/schema-org';
|
|
10
10
|
|
|
11
|
-
type Page = Partial<PageFrontMatter>;
|
|
12
|
-
type Post = Partial<PostFrontMatter>;
|
|
13
|
-
|
|
14
11
|
type CleanUrlsMode = 'disabled' | 'without-subfolders' | 'with-subfolders';
|
|
15
12
|
interface PageData {
|
|
16
13
|
relativePath: string;
|
|
@@ -32,5 +29,5 @@ interface PageDataPayload {
|
|
|
32
29
|
}
|
|
33
30
|
type HeadConfig = [string, Record<string, string>] | [string, Record<string, string>, string];
|
|
34
31
|
|
|
35
|
-
export {
|
|
36
|
-
export type { CleanUrlsMode, HeadConfig,
|
|
32
|
+
export { Post };
|
|
33
|
+
export type { CleanUrlsMode, HeadConfig, PageData, PageDataPayload };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.28.0-beta.1",
|
|
5
5
|
"description": "📄 Vite & Vue powered static blog generator.",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "me@yunyoujun.cn",
|
|
@@ -62,18 +62,18 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@antfu/install-pkg": "^1.1.0",
|
|
64
64
|
"@antfu/utils": "^9.3.0",
|
|
65
|
-
"@clack/prompts": "^0.
|
|
66
|
-
"@iconify-json/ri": "^1.2.
|
|
67
|
-
"@intlify/unplugin-vue-i18n": "^11.0.
|
|
68
|
-
"@shikijs/transformers": "^3.
|
|
65
|
+
"@clack/prompts": "^1.0.1",
|
|
66
|
+
"@iconify-json/ri": "^1.2.10",
|
|
67
|
+
"@intlify/unplugin-vue-i18n": "^11.0.7",
|
|
68
|
+
"@shikijs/transformers": "^3.22.0",
|
|
69
69
|
"@types/katex": "^0.16.8",
|
|
70
|
-
"@unhead/addons": "^2.1.
|
|
71
|
-
"@unhead/schema-org": "^2.1.
|
|
72
|
-
"@unhead/vue": "^2.1.
|
|
73
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
70
|
+
"@unhead/addons": "^2.1.6",
|
|
71
|
+
"@unhead/schema-org": "^2.1.6",
|
|
72
|
+
"@unhead/vue": "^2.1.6",
|
|
73
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
74
74
|
"@vue/devtools-api": "7.7.2",
|
|
75
|
-
"@vueuse/core": "^14.1
|
|
76
|
-
"@vueuse/integrations": "^14.1
|
|
75
|
+
"@vueuse/core": "^14.2.1",
|
|
76
|
+
"@vueuse/integrations": "^14.2.1",
|
|
77
77
|
"beasties": "^0.4.1",
|
|
78
78
|
"consola": "^3.4.2",
|
|
79
79
|
"cross-spawn": "^7.0.6",
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
"jiti": "^2.6.1",
|
|
96
96
|
"js-base64": "^3.7.8",
|
|
97
97
|
"js-yaml": "^4.1.1",
|
|
98
|
-
"katex": "^0.16.
|
|
99
|
-
"lru-cache": "^11.2.
|
|
100
|
-
"markdown-it": "^14.1.
|
|
98
|
+
"katex": "^0.16.33",
|
|
99
|
+
"lru-cache": "^11.2.6",
|
|
100
|
+
"markdown-it": "^14.1.1",
|
|
101
101
|
"markdown-it-anchor": "^9.2.0",
|
|
102
102
|
"markdown-it-async": "^2.2.0",
|
|
103
103
|
"markdown-it-attrs": "^4.3.1",
|
|
@@ -108,39 +108,40 @@
|
|
|
108
108
|
"markdown-it-table-of-contents": "^1.1.0",
|
|
109
109
|
"markdown-it-task-lists": "^2.1.1",
|
|
110
110
|
"medium-zoom": "^1.1.0",
|
|
111
|
-
"mermaid": "^11.12.
|
|
111
|
+
"mermaid": "^11.12.3",
|
|
112
|
+
"minisearch": "^7.2.0",
|
|
112
113
|
"mlly": "^1.8.0",
|
|
113
114
|
"nprogress": "^0.2.0",
|
|
114
115
|
"open": "10.1.0",
|
|
115
|
-
"ora": "^9.
|
|
116
|
+
"ora": "^9.3.0",
|
|
117
|
+
"p-map": "^7.0.4",
|
|
116
118
|
"pascalcase": "^2.0.0",
|
|
117
119
|
"pathe": "^2.0.3",
|
|
118
120
|
"pinia": "^3.0.4",
|
|
119
121
|
"qrcode": "^1.5.4",
|
|
120
122
|
"resolve-global": "^2.0.0",
|
|
121
123
|
"sass": "^1.97.3",
|
|
122
|
-
"shiki": "^3.
|
|
124
|
+
"shiki": "^3.22.0",
|
|
123
125
|
"star-markdown-css": "^0.5.3",
|
|
124
126
|
"table": "^6.9.0",
|
|
125
|
-
"unhead": "^2.1.
|
|
127
|
+
"unhead": "^2.1.6",
|
|
126
128
|
"unocss": "66.5.10",
|
|
127
129
|
"unplugin-vue-components": "28.0.0",
|
|
128
130
|
"unplugin-vue-markdown": "^29.2.0",
|
|
129
|
-
"unplugin-vue-router": "^0.19.2",
|
|
130
131
|
"vanilla-lazyload": "^19.1.3",
|
|
131
132
|
"vite": "^7.3.1",
|
|
132
133
|
"vite-dev-rpc": "^1.1.0",
|
|
133
|
-
"vite-plugin-vue-devtools": "^8.0.
|
|
134
|
+
"vite-plugin-vue-devtools": "^8.0.6",
|
|
134
135
|
"vite-plugin-vue-layouts": "^0.11.0",
|
|
135
|
-
"vite-ssg": "^28.
|
|
136
|
+
"vite-ssg": "^28.3.0",
|
|
136
137
|
"vite-ssg-sitemap": "^0.10.0",
|
|
137
138
|
"vitepress-plugin-group-icons": "^1.7.1",
|
|
138
139
|
"vue": "3.5.22",
|
|
139
140
|
"vue-i18n": "^11.2.8",
|
|
140
|
-
"vue-router": "^
|
|
141
|
+
"vue-router": "^5.0.3",
|
|
141
142
|
"yargs": "^18.0.0",
|
|
142
|
-
"@valaxyjs/
|
|
143
|
-
"@valaxyjs/
|
|
143
|
+
"@valaxyjs/utils": "0.28.0-beta.1",
|
|
144
|
+
"@valaxyjs/devtools": "0.28.0-beta.1"
|
|
144
145
|
},
|
|
145
146
|
"devDependencies": {
|
|
146
147
|
"@mdit-vue/plugin-component": "^3.0.2",
|
|
@@ -161,12 +162,10 @@
|
|
|
161
162
|
"@types/pascalcase": "^1.0.3",
|
|
162
163
|
"@types/qrcode": "^1.5.6",
|
|
163
164
|
"@types/yargs": "^17.0.35",
|
|
164
|
-
"cilicili": "^0.1.1",
|
|
165
|
-
"diacritics": "^1.3.0",
|
|
166
165
|
"gh-pages": "^6.3.0",
|
|
167
166
|
"https-localhost": "^4.7.1",
|
|
168
|
-
"
|
|
169
|
-
"rollup-plugin-visualizer": "^
|
|
167
|
+
"nanoid": "^5.1.6",
|
|
168
|
+
"rollup-plugin-visualizer": "^7.0.0",
|
|
170
169
|
"unbuild": "^3.6.1"
|
|
171
170
|
},
|
|
172
171
|
"scripts": {
|
package/shared/node/i18n.ts
CHANGED
|
@@ -11,10 +11,23 @@ export const NODE_I18N: {
|
|
|
11
11
|
locales: {},
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Track which paths have already been loaded to avoid redundant I/O.
|
|
16
|
+
*/
|
|
17
|
+
const _loadedPaths = new Set<string>()
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* 读取翻译 yml 文件
|
|
21
|
+
*
|
|
22
|
+
* Results are cached by resolved path — subsequent calls with the same
|
|
23
|
+
* `localesPath` return the existing `NODE_I18N.locales` without re-reading
|
|
24
|
+
* the filesystem. Pass `force = true` to bypass the cache (e.g. after
|
|
25
|
+
* the user edits a locale file).
|
|
16
26
|
*/
|
|
17
|
-
export function loadLocalesYml(localesPath: string): Record<string, any> {
|
|
27
|
+
export function loadLocalesYml(localesPath: string, force = false): Record<string, any> {
|
|
28
|
+
if (!force && _loadedPaths.has(localesPath))
|
|
29
|
+
return NODE_I18N.locales
|
|
30
|
+
|
|
18
31
|
/**
|
|
19
32
|
* read locales dir *.yml
|
|
20
33
|
*/
|
|
@@ -39,6 +52,7 @@ export function loadLocalesYml(localesPath: string): Record<string, any> {
|
|
|
39
52
|
|
|
40
53
|
// cache
|
|
41
54
|
NODE_I18N.locales = locales
|
|
55
|
+
_loadedPaths.add(localesPath)
|
|
42
56
|
return locales
|
|
43
57
|
}
|
|
44
58
|
|
package/types/config.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { RouteRecordRaw } from 'vue-router'
|
|
|
5
5
|
import type { ValaxyAddon } from './addon'
|
|
6
6
|
import type { DefaultTheme } from './default-theme'
|
|
7
7
|
import type { PostFrontMatter } from './frontmatter'
|
|
8
|
+
import type { ExcerptType } from './frontmatter/post'
|
|
8
9
|
import type { FuseListItem } from './node'
|
|
9
10
|
|
|
10
11
|
import './default-theme'
|
|
@@ -222,6 +223,35 @@ export interface SiteConfig {
|
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Excerpt configuration
|
|
228
|
+
* @description:en-US Global excerpt settings for posts
|
|
229
|
+
* @description:zh-CN 全局摘要配置
|
|
230
|
+
*/
|
|
231
|
+
excerpt: {
|
|
232
|
+
/**
|
|
233
|
+
* @description:en-US Default excerpt render type for `<!-- more -->` and auto-generated excerpts.
|
|
234
|
+
* Can be overridden per-post via frontmatter `excerpt_type`.
|
|
235
|
+
* Does not apply when frontmatter `excerpt` is set manually (used as-is).
|
|
236
|
+
* @description:zh-CN `<!-- more -->` 及自动摘要的默认渲染类型,可通过 frontmatter `excerpt_type` 逐篇覆盖。
|
|
237
|
+
* 当 frontmatter 手动指定 `excerpt` 时不生效(直接使用原始字符串)。
|
|
238
|
+
* @default 'html'
|
|
239
|
+
*/
|
|
240
|
+
type: ExcerptType
|
|
241
|
+
/**
|
|
242
|
+
* @description:en-US Auto-generate excerpt from post content when no manual excerpt is provided
|
|
243
|
+
* @description:zh-CN 当没有手动指定摘要时,自动从文章内容截取摘要
|
|
244
|
+
* @default false
|
|
245
|
+
*/
|
|
246
|
+
auto: boolean
|
|
247
|
+
/**
|
|
248
|
+
* @description:en-US Maximum length of auto-generated excerpt (in characters)
|
|
249
|
+
* @description:zh-CN 自动摘要的最大长度(字符数)
|
|
250
|
+
* @default 200
|
|
251
|
+
*/
|
|
252
|
+
length: number
|
|
253
|
+
}
|
|
254
|
+
|
|
225
255
|
/**
|
|
226
256
|
* set post default frontmatter
|
|
227
257
|
*/
|
|
@@ -396,6 +426,50 @@ export interface SiteConfig {
|
|
|
396
426
|
*/
|
|
397
427
|
codeHeightLimit?: number
|
|
398
428
|
|
|
429
|
+
/**
|
|
430
|
+
* @zh llms.txt 及原始 Markdown 文件输出
|
|
431
|
+
* @en llms.txt and raw Markdown file output
|
|
432
|
+
* @see https://llmstxt.org/
|
|
433
|
+
*/
|
|
434
|
+
llms: {
|
|
435
|
+
/**
|
|
436
|
+
* @zh 是否开启 llms.txt 和 .md 原始文件输出
|
|
437
|
+
* @en Enable llms.txt and raw .md file output
|
|
438
|
+
* @default false
|
|
439
|
+
*/
|
|
440
|
+
enable: boolean
|
|
441
|
+
/**
|
|
442
|
+
* @zh 是否生成 llms-full.txt(包含所有文章完整内容)
|
|
443
|
+
* @en Whether to generate llms-full.txt (with all post content inlined)
|
|
444
|
+
* @default true
|
|
445
|
+
*/
|
|
446
|
+
fullText: boolean
|
|
447
|
+
/**
|
|
448
|
+
* @zh 是否为每篇文章生成独立的 .md 文件(可通过 /posts/xxx.md 访问)
|
|
449
|
+
* @en Whether to generate individual .md files for each post (accessible via /posts/xxx.md)
|
|
450
|
+
* @default true
|
|
451
|
+
*/
|
|
452
|
+
files: boolean
|
|
453
|
+
/**
|
|
454
|
+
* @zh 自定义提示词(添加到 llms.txt blockquote 部分)
|
|
455
|
+
* @en Custom prompt text (added to the llms.txt blockquote section)
|
|
456
|
+
* @default ''
|
|
457
|
+
*/
|
|
458
|
+
prompt: string
|
|
459
|
+
/**
|
|
460
|
+
* @zh 要包含的 markdown 文件 glob 模式(相对于 pages/ 目录)。
|
|
461
|
+
* 默认为 `['posts\/**\/*.md']` 仅包含 posts。
|
|
462
|
+
* 设为 `['**\/*.md']` 可包含所有 pages 下的 markdown 文件。
|
|
463
|
+
* 也可以指定多个目录,如 `['posts\/**\/*.md', 'guide\/**\/*.md']`。
|
|
464
|
+
* @en Glob patterns for markdown files to include (relative to pages/ directory).
|
|
465
|
+
* Defaults to `['posts\/**\/*.md']` to only include posts.
|
|
466
|
+
* Set to `['**\/*.md']` to include all markdown files under pages/.
|
|
467
|
+
* You can also specify multiple directories, e.g. `['posts\/**\/*.md', 'guide\/**\/*.md']`.
|
|
468
|
+
* @default ['posts\/**\/*.md']
|
|
469
|
+
*/
|
|
470
|
+
include?: string[]
|
|
471
|
+
}
|
|
472
|
+
|
|
399
473
|
/**
|
|
400
474
|
* @description:en-US client redirect rules
|
|
401
475
|
* @description:zh-CN 客户端重定向规则
|
|
@@ -159,7 +159,12 @@ export interface PageFrontMatter extends BaseFrontMatter {
|
|
|
159
159
|
end: boolean
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* Enable/disable KaTeX math rendering for this page.
|
|
163
|
+
* Overrides the global `features.katex` setting.
|
|
164
|
+
*
|
|
165
|
+
* - When `features.katex: true` (default), set `katex: false` to disable KaTeX for this page.
|
|
166
|
+
* - When `features.katex: false`, set `katex: true` to enable KaTeX for this page.
|
|
167
|
+
*
|
|
163
168
|
* @url https://katex.org/
|
|
164
169
|
*/
|
|
165
170
|
katex: boolean
|
package/types/index.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extend vue-router's RouteMeta interface
|
|
3
|
+
* @see https://router.vuejs.org/guide/advanced/meta.html#TypeScript
|
|
4
|
+
*/
|
|
5
|
+
import type { Header } from '@valaxyjs/utils'
|
|
6
|
+
import type { Post } from './posts'
|
|
7
|
+
|
|
8
|
+
export {}
|
|
9
|
+
|
|
10
|
+
declare module 'vue-router' {
|
|
11
|
+
interface RouteMeta {
|
|
12
|
+
/**
|
|
13
|
+
* Headers extracted from markdown
|
|
14
|
+
*/
|
|
15
|
+
headers: Header[]
|
|
16
|
+
/**
|
|
17
|
+
* Frontmatter data from markdown files
|
|
18
|
+
*/
|
|
19
|
+
frontmatter: Post
|
|
20
|
+
/**
|
|
21
|
+
* Excerpt from markdown content
|
|
22
|
+
*/
|
|
23
|
+
excerpt?: string
|
|
24
|
+
/**
|
|
25
|
+
* Layout name
|
|
26
|
+
*/
|
|
27
|
+
layout?: string
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { defineBasicLoader } from 'unplugin-vue-router/data-loaders/basic'
|
|
3
|
-
|
|
4
|
-
export const usePageData = defineBasicLoader('/relativePath', async (_to) => {
|
|
5
|
-
// custom basic loader
|
|
6
|
-
}, {
|
|
7
|
-
// @see https://uvr.esm.is/data-loaders/defining-loaders.html#non-blocking-loaders-with-lazy
|
|
8
|
-
lazy: (to, from) => to.name === from.name,
|
|
9
|
-
})
|
|
10
|
-
</script>
|