valaxy 0.17.2 → 0.17.4

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.
@@ -1,6 +1,7 @@
1
1
  import { ZoomOptions } from 'medium-zoom';
2
2
  import { FuseOptions } from '@vueuse/integrations/useFuse';
3
3
  import { ILazyLoadOptions } from 'vanilla-lazyload';
4
+ import { RouteRecordRaw } from 'vue-router';
4
5
  import { NodeRelations, ImageObject } from '@unhead/schema-org';
5
6
 
6
7
  interface ValaxyAddon<AddonOptions = Record<string, any>> {
@@ -185,6 +186,11 @@ interface PageFrontMatter extends Record<string, any> {
185
186
  * @description:zh-CN 限制代码块的高度,单位是 px
186
187
  */
187
188
  codeHeightLimit?: number;
189
+ /**
190
+ * @description:en-US Source path for client redirection
191
+ * @description:zh-CN 客户端重定向的源路径
192
+ */
193
+ from?: string | string[];
188
194
  }
189
195
  interface PostFrontMatter extends PageFrontMatter {
190
196
  /**
@@ -279,6 +285,10 @@ interface RedirectRule {
279
285
  to: string;
280
286
  from: string | string[];
281
287
  }
288
+ interface RedirectItem {
289
+ from: string;
290
+ to: string;
291
+ }
282
292
  interface SiteConfig {
283
293
  /**
284
294
  * enable auto (light/dark mode)
@@ -552,7 +562,10 @@ interface SiteConfig {
552
562
  * @description:en-US client redirect rules
553
563
  * @description:zh-CN 客户端重定向规则
554
564
  */
555
- redirects?: RedirectRule[];
565
+ redirects?: {
566
+ useVueRouter?: boolean;
567
+ rules?: RedirectRule[];
568
+ };
556
569
  }
557
570
  type PartialDeep<T> = {
558
571
  [P in keyof T]?: T[P] extends object ? PartialDeep<T[P]> : T[P];
@@ -562,6 +575,10 @@ type PartialDeep<T> = {
562
575
  */
563
576
  interface RuntimeConfig {
564
577
  addons: Record<string, ValaxyAddon>;
578
+ redirects: {
579
+ useVueRouter: boolean;
580
+ redirectRoutes: RouteRecordRaw[];
581
+ };
565
582
  }
566
583
  interface Pkg {
567
584
  name: string;
@@ -604,4 +621,4 @@ type UserSiteConfig = PartialDeep<SiteConfig>;
604
621
  */
605
622
  type UserValaxyConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep<ValaxyConfig<ThemeConfig>>;
606
623
 
607
- export { type Album as A, DefaultTheme as D, type ExcerptType as E, type FuseListItem as F, type PartialDeep as P, type RedirectRule as R, type SocialLink as S, type UserSiteConfig as U, type ValaxyAddon as V, type Post as a, type SiteConfig as b, type RuntimeConfig as c, type Pkg as d, type ValaxyConfig as e, type UserValaxyConfig as f, type Photo as g, type PageFrontMatter as h, type PostFrontMatter as i, type Page as j };
624
+ export { type Album as A, DefaultTheme as D, type ExcerptType as E, type FuseListItem as F, type PartialDeep as P, type RedirectRule as R, type SocialLink as S, type UserSiteConfig as U, type ValaxyAddon as V, type Post as a, type RedirectItem as b, type SiteConfig as c, type RuntimeConfig as d, type Pkg as e, type ValaxyConfig as f, type UserValaxyConfig as g, type Photo as h, type PageFrontMatter as i, type PostFrontMatter as j, type Page as k };
@@ -1,6 +1,7 @@
1
1
  import { ZoomOptions } from 'medium-zoom';
2
2
  import { FuseOptions } from '@vueuse/integrations/useFuse';
3
3
  import { ILazyLoadOptions } from 'vanilla-lazyload';
4
+ import { RouteRecordRaw } from 'vue-router';
4
5
  import { NodeRelations, ImageObject } from '@unhead/schema-org';
5
6
 
6
7
  interface ValaxyAddon<AddonOptions = Record<string, any>> {
@@ -185,6 +186,11 @@ interface PageFrontMatter extends Record<string, any> {
185
186
  * @description:zh-CN 限制代码块的高度,单位是 px
186
187
  */
187
188
  codeHeightLimit?: number;
189
+ /**
190
+ * @description:en-US Source path for client redirection
191
+ * @description:zh-CN 客户端重定向的源路径
192
+ */
193
+ from?: string | string[];
188
194
  }
189
195
  interface PostFrontMatter extends PageFrontMatter {
190
196
  /**
@@ -279,6 +285,10 @@ interface RedirectRule {
279
285
  to: string;
280
286
  from: string | string[];
281
287
  }
288
+ interface RedirectItem {
289
+ from: string;
290
+ to: string;
291
+ }
282
292
  interface SiteConfig {
283
293
  /**
284
294
  * enable auto (light/dark mode)
@@ -552,7 +562,10 @@ interface SiteConfig {
552
562
  * @description:en-US client redirect rules
553
563
  * @description:zh-CN 客户端重定向规则
554
564
  */
555
- redirects?: RedirectRule[];
565
+ redirects?: {
566
+ useVueRouter?: boolean;
567
+ rules?: RedirectRule[];
568
+ };
556
569
  }
557
570
  type PartialDeep<T> = {
558
571
  [P in keyof T]?: T[P] extends object ? PartialDeep<T[P]> : T[P];
@@ -562,6 +575,10 @@ type PartialDeep<T> = {
562
575
  */
563
576
  interface RuntimeConfig {
564
577
  addons: Record<string, ValaxyAddon>;
578
+ redirects: {
579
+ useVueRouter: boolean;
580
+ redirectRoutes: RouteRecordRaw[];
581
+ };
565
582
  }
566
583
  interface Pkg {
567
584
  name: string;
@@ -604,4 +621,4 @@ type UserSiteConfig = PartialDeep<SiteConfig>;
604
621
  */
605
622
  type UserValaxyConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep<ValaxyConfig<ThemeConfig>>;
606
623
 
607
- export { type Album as A, DefaultTheme as D, type ExcerptType as E, type FuseListItem as F, type PartialDeep as P, type RedirectRule as R, type SocialLink as S, type UserSiteConfig as U, type ValaxyAddon as V, type Post as a, type SiteConfig as b, type RuntimeConfig as c, type Pkg as d, type ValaxyConfig as e, type UserValaxyConfig as f, type Photo as g, type PageFrontMatter as h, type PostFrontMatter as i, type Page as j };
624
+ export { type Album as A, DefaultTheme as D, type ExcerptType as E, type FuseListItem as F, type PartialDeep as P, type RedirectRule as R, type SocialLink as S, type UserSiteConfig as U, type ValaxyAddon as V, type Post as a, type RedirectItem as b, type SiteConfig as c, type RuntimeConfig as d, type Pkg as e, type ValaxyConfig as f, type UserValaxyConfig as g, type Photo as h, type PageFrontMatter as i, type PostFrontMatter as j, type Page as k };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIMEGZXRPcjs = require('../../chunk-IMEGZXRP.cjs');require('../../chunk-TEOGEXZQ.cjs');exports.cli = _chunkIMEGZXRPcjs.M; exports.run = _chunkIMEGZXRPcjs.N;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVJXQXPVCcjs = require('../../chunk-VJXQXPVC.cjs');require('../../chunk-FNMRWIFM.cjs');exports.cli = _chunkVJXQXPVCcjs.M; exports.run = _chunkVJXQXPVCcjs.N;
@@ -1,2 +1,2 @@
1
1
  import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
2
- import{M as a,N as b}from"../../chunk-U4OPXBYO.mjs";import"../../chunk-ZO24WTQL.mjs";export{a as cli,b as run};
2
+ import{M as a,N as b}from"../../chunk-UTVJER4P.mjs";import"../../chunk-R4WV6S3O.mjs";export{a as cli,b as run};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIMEGZXRPcjs = require('../chunk-IMEGZXRP.cjs');require('../chunk-TEOGEXZQ.cjs');exports.build = _chunkIMEGZXRPcjs.H; exports.cli = _chunkIMEGZXRPcjs.M; exports.createServer = _chunkIMEGZXRPcjs.L; exports.defaultSiteConfig = _chunkIMEGZXRPcjs.k; exports.defaultValaxyConfig = _chunkIMEGZXRPcjs.o; exports.defineAddon = _chunkIMEGZXRPcjs.v; exports.defineConfig = _chunkIMEGZXRPcjs.q; exports.defineSiteConfig = _chunkIMEGZXRPcjs.l; exports.defineTheme = _chunkIMEGZXRPcjs.A; exports.defineUnoSetup = _chunkIMEGZXRPcjs.B; exports.defineValaxyAddon = _chunkIMEGZXRPcjs.u; exports.defineValaxyConfig = _chunkIMEGZXRPcjs.p; exports.defineValaxyTheme = _chunkIMEGZXRPcjs.z; exports.ensurePrefix = _chunkIMEGZXRPcjs.e; exports.generateClientRedirects = _chunkIMEGZXRPcjs.K; exports.getGitTimestamp = _chunkIMEGZXRPcjs.a; exports.getIndexHtml = _chunkIMEGZXRPcjs.G; exports.isExternal = _chunkIMEGZXRPcjs.c; exports.isPath = _chunkIMEGZXRPcjs.g; exports.loadConfig = _chunkIMEGZXRPcjs.i; exports.loadConfigFromFile = _chunkIMEGZXRPcjs.j; exports.mergeValaxyConfig = _chunkIMEGZXRPcjs.s; exports.mergeViteConfigs = _chunkIMEGZXRPcjs.F; exports.postProcessForSSG = _chunkIMEGZXRPcjs.J; exports.processValaxyOptions = _chunkIMEGZXRPcjs.C; exports.resolveAddonConfig = _chunkIMEGZXRPcjs.w; exports.resolveImportPath = _chunkIMEGZXRPcjs.b; exports.resolveOptions = _chunkIMEGZXRPcjs.D; exports.resolveSiteConfig = _chunkIMEGZXRPcjs.n; exports.resolveSiteConfigFromRoot = _chunkIMEGZXRPcjs.m; exports.resolveThemeConfigFromRoot = _chunkIMEGZXRPcjs.x; exports.resolveThemeValaxyConfig = _chunkIMEGZXRPcjs.E; exports.resolveUserThemeConfig = _chunkIMEGZXRPcjs.y; exports.resolveValaxyConfig = _chunkIMEGZXRPcjs.t; exports.resolveValaxyConfigFromRoot = _chunkIMEGZXRPcjs.r; exports.run = _chunkIMEGZXRPcjs.N; exports.slash = _chunkIMEGZXRPcjs.d; exports.ssgBuild = _chunkIMEGZXRPcjs.I; exports.toAtFS = _chunkIMEGZXRPcjs.f; exports.transformObject = _chunkIMEGZXRPcjs.h;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVJXQXPVCcjs = require('../chunk-VJXQXPVC.cjs');require('../chunk-FNMRWIFM.cjs');exports.build = _chunkVJXQXPVCcjs.H; exports.cli = _chunkVJXQXPVCcjs.M; exports.createServer = _chunkVJXQXPVCcjs.L; exports.defaultSiteConfig = _chunkVJXQXPVCcjs.k; exports.defaultValaxyConfig = _chunkVJXQXPVCcjs.o; exports.defineAddon = _chunkVJXQXPVCcjs.v; exports.defineConfig = _chunkVJXQXPVCcjs.q; exports.defineSiteConfig = _chunkVJXQXPVCcjs.l; exports.defineTheme = _chunkVJXQXPVCcjs.A; exports.defineUnoSetup = _chunkVJXQXPVCcjs.B; exports.defineValaxyAddon = _chunkVJXQXPVCcjs.u; exports.defineValaxyConfig = _chunkVJXQXPVCcjs.p; exports.defineValaxyTheme = _chunkVJXQXPVCcjs.z; exports.ensurePrefix = _chunkVJXQXPVCcjs.e; exports.generateClientRedirects = _chunkVJXQXPVCcjs.K; exports.getGitTimestamp = _chunkVJXQXPVCcjs.a; exports.getIndexHtml = _chunkVJXQXPVCcjs.G; exports.isExternal = _chunkVJXQXPVCcjs.c; exports.isPath = _chunkVJXQXPVCcjs.g; exports.loadConfig = _chunkVJXQXPVCcjs.i; exports.loadConfigFromFile = _chunkVJXQXPVCcjs.j; exports.mergeValaxyConfig = _chunkVJXQXPVCcjs.s; exports.mergeViteConfigs = _chunkVJXQXPVCcjs.F; exports.postProcessForSSG = _chunkVJXQXPVCcjs.J; exports.processValaxyOptions = _chunkVJXQXPVCcjs.C; exports.resolveAddonConfig = _chunkVJXQXPVCcjs.w; exports.resolveImportPath = _chunkVJXQXPVCcjs.b; exports.resolveOptions = _chunkVJXQXPVCcjs.D; exports.resolveSiteConfig = _chunkVJXQXPVCcjs.n; exports.resolveSiteConfigFromRoot = _chunkVJXQXPVCcjs.m; exports.resolveThemeConfigFromRoot = _chunkVJXQXPVCcjs.x; exports.resolveThemeValaxyConfig = _chunkVJXQXPVCcjs.E; exports.resolveUserThemeConfig = _chunkVJXQXPVCcjs.y; exports.resolveValaxyConfig = _chunkVJXQXPVCcjs.t; exports.resolveValaxyConfigFromRoot = _chunkVJXQXPVCcjs.r; exports.run = _chunkVJXQXPVCcjs.N; exports.slash = _chunkVJXQXPVCcjs.d; exports.ssgBuild = _chunkVJXQXPVCcjs.I; exports.toAtFS = _chunkVJXQXPVCcjs.f; exports.transformObject = _chunkVJXQXPVCcjs.h;
@@ -3,7 +3,7 @@ export { cli, run } from './cli/index.cjs';
3
3
  import * as vite from 'vite';
4
4
  import { UserConfig, InlineConfig } from 'vite';
5
5
  import * as valaxy_types from 'valaxy/types';
6
- import { DefaultTheme, ValaxyConfig, PartialDeep, ValaxyAddon, RuntimeConfig, SiteConfig, UserSiteConfig } from 'valaxy/types';
6
+ import { DefaultTheme, ValaxyConfig, PartialDeep, ValaxyAddon, RuntimeConfig, RedirectItem, SiteConfig, UserSiteConfig } from 'valaxy/types';
7
7
  import Vue from '@vitejs/plugin-vue';
8
8
  import Components from 'unplugin-vue-components/vite';
9
9
  import Layouts from 'vite-plugin-vue-layouts';
@@ -13,7 +13,7 @@ import { EditableTreeNode } from 'unplugin-vue-router';
13
13
  import { presetUno, presetAttributify, presetIcons, presetTypography } from 'unocss';
14
14
  import { Hookable } from 'hookable';
15
15
  import MarkdownIt from 'markdown-it';
16
- import { ILanguageRegistration, IThemeRegistration } from 'shiki';
16
+ import { LanguageInput, ShikijiTransformer, Highlighter, ThemeRegistration, BuiltinTheme } from 'shikiji';
17
17
  import anchorPlugin from 'markdown-it-anchor';
18
18
  import { KatexOptions } from 'katex';
19
19
  import { FrontmatterPluginOptions } from '@mdit-vue/plugin-frontmatter';
@@ -23,11 +23,12 @@ import { TocPluginOptions } from '@mdit-vue/plugin-toc';
23
23
  import { ComponentPluginOptions } from '@mdit-vue/plugin-component';
24
24
  import { Awaitable } from '@antfu/utils';
25
25
  import * as defu from 'defu';
26
- import { P as PartialDeep$1 } from '../config-hKSeaczj.cjs';
26
+ import { P as PartialDeep$1 } from '../config-hM2lXH4J.cjs';
27
27
  import 'yargs';
28
28
  import 'medium-zoom';
29
29
  import '@vueuse/integrations/useFuse';
30
30
  import 'vanilla-lazyload';
31
+ import 'vue-router';
31
32
  import '@unhead/schema-org';
32
33
 
33
34
  declare module 'vite' {
@@ -55,9 +56,9 @@ interface Blocks {
55
56
  details?: BlockItem;
56
57
  }
57
58
 
58
- type ThemeOptions = IThemeRegistration | {
59
- light: IThemeRegistration;
60
- dark: IThemeRegistration;
59
+ type ThemeOptions = ThemeRegistration | BuiltinTheme | {
60
+ light: ThemeRegistration | BuiltinTheme;
61
+ dark: ThemeRegistration | BuiltinTheme;
61
62
  };
62
63
  interface MarkdownOptions {
63
64
  /**
@@ -79,7 +80,50 @@ interface MarkdownOptions {
79
80
  allowedAttributes?: string[];
80
81
  disable?: boolean;
81
82
  };
83
+ /**
84
+ * Custom theme for syntax highlighting.
85
+ *
86
+ * You can also pass an object with `light` and `dark` themes to support dual themes.
87
+ *
88
+ * @example { theme: 'github-dark' }
89
+ * @example { theme: { light: 'github-light', dark: 'github-dark' } }
90
+ *
91
+ * You can use an existing theme.
92
+ * @see https://github.com/antfu/shikiji/blob/main/docs/themes.md#all-themes
93
+ * Or add your own theme.
94
+ * @see https://github.com/antfu/shikiji/blob/main/docs/themes.md#load-custom-themes
95
+ */
96
+ theme?: ThemeOptions;
97
+ /**
98
+ * Languages for syntax highlighting.
99
+ * @see https://github.com/antfu/shikiji/blob/main/docs/languages.md#all-themes
100
+ */
101
+ languages?: LanguageInput[];
102
+ /**
103
+ * Custom language aliases.
104
+ *
105
+ * @example { 'my-lang': 'js' }
106
+ * @see https://github.com/antfu/shikiji/tree/main#custom-language-aliases
107
+ */
108
+ languageAlias?: Record<string, string>;
109
+ /**
110
+ * Show line numbers in code blocks
111
+ * @default false
112
+ */
113
+ lineNumbers?: boolean;
114
+ /**
115
+ * Fallback language when the specified language is not available.
116
+ */
82
117
  defaultHighlightLang?: string;
118
+ /**
119
+ * Transformers applied to code blocks
120
+ * @see https://github.com/antfu/shikiji#hast-transformers
121
+ */
122
+ codeTransformers?: ShikijiTransformer[];
123
+ /**
124
+ * Setup Shikiji instance
125
+ */
126
+ shikijiSetup?: (shikiji: Highlighter) => void | Promise<void>;
83
127
  frontmatter?: FrontmatterPluginOptions;
84
128
  headers?: HeadersPluginOptions;
85
129
  sfc?: SfcPluginOptions;
@@ -98,16 +142,10 @@ interface MarkdownOptions {
98
142
  async: boolean;
99
143
  classes: string;
100
144
  };
101
- lineNumbers?: boolean;
102
145
  /**
103
146
  * @see https://katex.org/docs/options.html
104
147
  */
105
148
  katex?: KatexOptions;
106
- /**
107
- * shiki
108
- */
109
- theme?: ThemeOptions;
110
- languages?: ILanguageRegistration[];
111
149
  /**
112
150
  * Custom block configurations
113
151
  */
@@ -161,6 +199,10 @@ interface ValaxyExtendConfig {
161
199
  katex: boolean;
162
200
  };
163
201
  vite?: UserConfig;
202
+ /**
203
+ * @vitejs/plugin-vue options
204
+ * @see https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/README.md
205
+ */
164
206
  vue?: Parameters<typeof Vue>[0];
165
207
  components?: Parameters<typeof Components>[0];
166
208
  layouts?: Parameters<typeof Layouts>[0];
@@ -224,6 +266,11 @@ interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
224
266
  * package.json root
225
267
  */
226
268
  pkgRoot: string;
269
+ /**
270
+ * temp dir, store d.ts and other temp files
271
+ * .valaxy
272
+ */
273
+ tempDir: string;
227
274
  /**
228
275
  * Client root path
229
276
  * @default 'valaxy/client'
@@ -268,6 +315,10 @@ interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
268
315
  * Record<package-name, OptionResolver>
269
316
  */
270
317
  addons: ValaxyAddonResolver[];
318
+ /**
319
+ * Collect redirect rule
320
+ */
321
+ redirects: RedirectItem[];
271
322
  }
272
323
  interface ValaxyServerOptions {
273
324
  onConfigReload?: (newConfig: ValaxyNodeConfig, config: ValaxyNodeConfig, force?: boolean) => void;
@@ -3,7 +3,7 @@ export { cli, run } from './cli/index.js';
3
3
  import * as vite from 'vite';
4
4
  import { UserConfig, InlineConfig } from 'vite';
5
5
  import * as valaxy_types from 'valaxy/types';
6
- import { DefaultTheme, ValaxyConfig, PartialDeep, ValaxyAddon, RuntimeConfig, SiteConfig, UserSiteConfig } from 'valaxy/types';
6
+ import { DefaultTheme, ValaxyConfig, PartialDeep, ValaxyAddon, RuntimeConfig, RedirectItem, SiteConfig, UserSiteConfig } from 'valaxy/types';
7
7
  import Vue from '@vitejs/plugin-vue';
8
8
  import Components from 'unplugin-vue-components/vite';
9
9
  import Layouts from 'vite-plugin-vue-layouts';
@@ -13,7 +13,7 @@ import { EditableTreeNode } from 'unplugin-vue-router';
13
13
  import { presetUno, presetAttributify, presetIcons, presetTypography } from 'unocss';
14
14
  import { Hookable } from 'hookable';
15
15
  import MarkdownIt from 'markdown-it';
16
- import { ILanguageRegistration, IThemeRegistration } from 'shiki';
16
+ import { LanguageInput, ShikijiTransformer, Highlighter, ThemeRegistration, BuiltinTheme } from 'shikiji';
17
17
  import anchorPlugin from 'markdown-it-anchor';
18
18
  import { KatexOptions } from 'katex';
19
19
  import { FrontmatterPluginOptions } from '@mdit-vue/plugin-frontmatter';
@@ -23,11 +23,12 @@ import { TocPluginOptions } from '@mdit-vue/plugin-toc';
23
23
  import { ComponentPluginOptions } from '@mdit-vue/plugin-component';
24
24
  import { Awaitable } from '@antfu/utils';
25
25
  import * as defu from 'defu';
26
- import { P as PartialDeep$1 } from '../config-hKSeaczj.js';
26
+ import { P as PartialDeep$1 } from '../config-hM2lXH4J.js';
27
27
  import 'yargs';
28
28
  import 'medium-zoom';
29
29
  import '@vueuse/integrations/useFuse';
30
30
  import 'vanilla-lazyload';
31
+ import 'vue-router';
31
32
  import '@unhead/schema-org';
32
33
 
33
34
  declare module 'vite' {
@@ -55,9 +56,9 @@ interface Blocks {
55
56
  details?: BlockItem;
56
57
  }
57
58
 
58
- type ThemeOptions = IThemeRegistration | {
59
- light: IThemeRegistration;
60
- dark: IThemeRegistration;
59
+ type ThemeOptions = ThemeRegistration | BuiltinTheme | {
60
+ light: ThemeRegistration | BuiltinTheme;
61
+ dark: ThemeRegistration | BuiltinTheme;
61
62
  };
62
63
  interface MarkdownOptions {
63
64
  /**
@@ -79,7 +80,50 @@ interface MarkdownOptions {
79
80
  allowedAttributes?: string[];
80
81
  disable?: boolean;
81
82
  };
83
+ /**
84
+ * Custom theme for syntax highlighting.
85
+ *
86
+ * You can also pass an object with `light` and `dark` themes to support dual themes.
87
+ *
88
+ * @example { theme: 'github-dark' }
89
+ * @example { theme: { light: 'github-light', dark: 'github-dark' } }
90
+ *
91
+ * You can use an existing theme.
92
+ * @see https://github.com/antfu/shikiji/blob/main/docs/themes.md#all-themes
93
+ * Or add your own theme.
94
+ * @see https://github.com/antfu/shikiji/blob/main/docs/themes.md#load-custom-themes
95
+ */
96
+ theme?: ThemeOptions;
97
+ /**
98
+ * Languages for syntax highlighting.
99
+ * @see https://github.com/antfu/shikiji/blob/main/docs/languages.md#all-themes
100
+ */
101
+ languages?: LanguageInput[];
102
+ /**
103
+ * Custom language aliases.
104
+ *
105
+ * @example { 'my-lang': 'js' }
106
+ * @see https://github.com/antfu/shikiji/tree/main#custom-language-aliases
107
+ */
108
+ languageAlias?: Record<string, string>;
109
+ /**
110
+ * Show line numbers in code blocks
111
+ * @default false
112
+ */
113
+ lineNumbers?: boolean;
114
+ /**
115
+ * Fallback language when the specified language is not available.
116
+ */
82
117
  defaultHighlightLang?: string;
118
+ /**
119
+ * Transformers applied to code blocks
120
+ * @see https://github.com/antfu/shikiji#hast-transformers
121
+ */
122
+ codeTransformers?: ShikijiTransformer[];
123
+ /**
124
+ * Setup Shikiji instance
125
+ */
126
+ shikijiSetup?: (shikiji: Highlighter) => void | Promise<void>;
83
127
  frontmatter?: FrontmatterPluginOptions;
84
128
  headers?: HeadersPluginOptions;
85
129
  sfc?: SfcPluginOptions;
@@ -98,16 +142,10 @@ interface MarkdownOptions {
98
142
  async: boolean;
99
143
  classes: string;
100
144
  };
101
- lineNumbers?: boolean;
102
145
  /**
103
146
  * @see https://katex.org/docs/options.html
104
147
  */
105
148
  katex?: KatexOptions;
106
- /**
107
- * shiki
108
- */
109
- theme?: ThemeOptions;
110
- languages?: ILanguageRegistration[];
111
149
  /**
112
150
  * Custom block configurations
113
151
  */
@@ -161,6 +199,10 @@ interface ValaxyExtendConfig {
161
199
  katex: boolean;
162
200
  };
163
201
  vite?: UserConfig;
202
+ /**
203
+ * @vitejs/plugin-vue options
204
+ * @see https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/README.md
205
+ */
164
206
  vue?: Parameters<typeof Vue>[0];
165
207
  components?: Parameters<typeof Components>[0];
166
208
  layouts?: Parameters<typeof Layouts>[0];
@@ -224,6 +266,11 @@ interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
224
266
  * package.json root
225
267
  */
226
268
  pkgRoot: string;
269
+ /**
270
+ * temp dir, store d.ts and other temp files
271
+ * .valaxy
272
+ */
273
+ tempDir: string;
227
274
  /**
228
275
  * Client root path
229
276
  * @default 'valaxy/client'
@@ -268,6 +315,10 @@ interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
268
315
  * Record<package-name, OptionResolver>
269
316
  */
270
317
  addons: ValaxyAddonResolver[];
318
+ /**
319
+ * Collect redirect rule
320
+ */
321
+ redirects: RedirectItem[];
271
322
  }
272
323
  interface ValaxyServerOptions {
273
324
  onConfigReload?: (newConfig: ValaxyNodeConfig, config: ValaxyNodeConfig, force?: boolean) => void;
@@ -1,2 +1,2 @@
1
1
  import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
2
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-U4OPXBYO.mjs";import"../chunk-ZO24WTQL.mjs";export{H as build,M as cli,L as createServer,k as defaultSiteConfig,o as defaultValaxyConfig,v as defineAddon,q as defineConfig,l as defineSiteConfig,A as defineTheme,B as defineUnoSetup,u as defineValaxyAddon,p as defineValaxyConfig,z as defineValaxyTheme,e as ensurePrefix,K as generateClientRedirects,a as getGitTimestamp,G as getIndexHtml,c as isExternal,g as isPath,i as loadConfig,j as loadConfigFromFile,s as mergeValaxyConfig,F as mergeViteConfigs,J as postProcessForSSG,C as processValaxyOptions,w as resolveAddonConfig,b as resolveImportPath,D as resolveOptions,n as resolveSiteConfig,m as resolveSiteConfigFromRoot,x as resolveThemeConfigFromRoot,E as resolveThemeValaxyConfig,y as resolveUserThemeConfig,t as resolveValaxyConfig,r as resolveValaxyConfigFromRoot,N as run,d as slash,I as ssgBuild,f as toAtFS,h as transformObject};
2
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-UTVJER4P.mjs";import"../chunk-R4WV6S3O.mjs";export{H as build,M as cli,L as createServer,k as defaultSiteConfig,o as defaultValaxyConfig,v as defineAddon,q as defineConfig,l as defineSiteConfig,A as defineTheme,B as defineUnoSetup,u as defineValaxyAddon,p as defineValaxyConfig,z as defineValaxyTheme,e as ensurePrefix,K as generateClientRedirects,a as getGitTimestamp,G as getIndexHtml,c as isExternal,g as isPath,i as loadConfig,j as loadConfigFromFile,s as mergeValaxyConfig,F as mergeViteConfigs,J as postProcessForSSG,C as processValaxyOptions,w as resolveAddonConfig,b as resolveImportPath,D as resolveOptions,n as resolveSiteConfig,m as resolveSiteConfigFromRoot,x as resolveThemeConfigFromRoot,E as resolveThemeValaxyConfig,y as resolveUserThemeConfig,t as resolveValaxyConfig,r as resolveValaxyConfigFromRoot,N as run,d as slash,I as ssgBuild,f as toAtFS,h as transformObject};
@@ -1 +1 @@
1
- "use strict";var _chunkTEOGEXZQcjs = require('../chunk-TEOGEXZQ.cjs');_chunkTEOGEXZQcjs.e.call(void 0, );_chunkTEOGEXZQcjs.e.call(void 0, );_chunkTEOGEXZQcjs.e.call(void 0, );_chunkTEOGEXZQcjs.e.call(void 0, );_chunkTEOGEXZQcjs.e.call(void 0, );_chunkTEOGEXZQcjs.e.call(void 0, );_chunkTEOGEXZQcjs.e.call(void 0, );
1
+ "use strict";var _chunkFNMRWIFMcjs = require('../chunk-FNMRWIFM.cjs');_chunkFNMRWIFMcjs.e.call(void 0, );_chunkFNMRWIFMcjs.e.call(void 0, );_chunkFNMRWIFMcjs.e.call(void 0, );_chunkFNMRWIFMcjs.e.call(void 0, );_chunkFNMRWIFMcjs.e.call(void 0, );_chunkFNMRWIFMcjs.e.call(void 0, );_chunkFNMRWIFMcjs.e.call(void 0, );
@@ -1,8 +1,9 @@
1
- import { a as Post } from '../config-hKSeaczj.cjs';
2
- export { A as Album, D as DefaultTheme, E as ExcerptType, F as FuseListItem, j as Page, h as PageFrontMatter, P as PartialDeep, g as Photo, d as Pkg, i as PostFrontMatter, R as RedirectRule, c as RuntimeConfig, b as SiteConfig, S as SocialLink, U as UserSiteConfig, f as UserValaxyConfig, V as ValaxyAddon, e as ValaxyConfig } from '../config-hKSeaczj.cjs';
1
+ import { a as Post } from '../config-hM2lXH4J.cjs';
2
+ export { A as Album, D as DefaultTheme, E as ExcerptType, F as FuseListItem, k as Page, i as PageFrontMatter, P as PartialDeep, h as Photo, e as Pkg, j as PostFrontMatter, b as RedirectItem, R as RedirectRule, d as RuntimeConfig, c as SiteConfig, S as SocialLink, U as UserSiteConfig, g as UserValaxyConfig, V as ValaxyAddon, f as ValaxyConfig } from '../config-hM2lXH4J.cjs';
3
3
  import 'medium-zoom';
4
4
  import '@vueuse/integrations/useFuse';
5
5
  import 'vanilla-lazyload';
6
+ import 'vue-router';
6
7
  import '@unhead/schema-org';
7
8
 
8
9
  type CleanUrlsMode = 'disabled' | 'without-subfolders' | 'with-subfolders';
@@ -1,8 +1,9 @@
1
- import { a as Post } from '../config-hKSeaczj.js';
2
- export { A as Album, D as DefaultTheme, E as ExcerptType, F as FuseListItem, j as Page, h as PageFrontMatter, P as PartialDeep, g as Photo, d as Pkg, i as PostFrontMatter, R as RedirectRule, c as RuntimeConfig, b as SiteConfig, S as SocialLink, U as UserSiteConfig, f as UserValaxyConfig, V as ValaxyAddon, e as ValaxyConfig } from '../config-hKSeaczj.js';
1
+ import { a as Post } from '../config-hM2lXH4J.js';
2
+ export { A as Album, D as DefaultTheme, E as ExcerptType, F as FuseListItem, k as Page, i as PageFrontMatter, P as PartialDeep, h as Photo, e as Pkg, j as PostFrontMatter, b as RedirectItem, R as RedirectRule, d as RuntimeConfig, c as SiteConfig, S as SocialLink, U as UserSiteConfig, g as UserValaxyConfig, V as ValaxyAddon, f as ValaxyConfig } from '../config-hM2lXH4J.js';
3
3
  import 'medium-zoom';
4
4
  import '@vueuse/integrations/useFuse';
5
5
  import 'vanilla-lazyload';
6
+ import 'vue-router';
6
7
  import '@unhead/schema-org';
7
8
 
8
9
  type CleanUrlsMode = 'disabled' | 'without-subfolders' | 'with-subfolders';
@@ -1,2 +1,2 @@
1
1
  import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
2
- import{d as e}from"../chunk-ZO24WTQL.mjs";e();e();e();e();e();e();e();
2
+ import{d as e}from"../chunk-R4WV6S3O.mjs";e();e();e();e();e();e();e();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy",
3
3
  "type": "module",
4
- "version": "0.17.2",
4
+ "version": "0.17.4",
5
5
  "description": "📄 Vite & Vue powered static blog generator.",
6
6
  "author": {
7
7
  "email": "me@yunyoujun.cn",
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "@antfu/utils": "^0.7.7",
61
61
  "@ctrl/tinycolor": "^4.0.3",
62
- "@iconify-json/carbon": "^1.1.27",
62
+ "@iconify-json/carbon": "^1.1.28",
63
63
  "@iconify-json/ri": "^1.1.19",
64
64
  "@intlify/unplugin-vue-i18n": "^2.0.0",
65
65
  "@types/body-scroll-lock": "^3.1.2",
@@ -68,7 +68,7 @@
68
68
  "@unhead/schema-org": "^1.8.10",
69
69
  "@unhead/vue": "^1.8.10",
70
70
  "@vitejs/plugin-vue": "^5.0.3",
71
- "@vue/devtools-api": "^7.0.11",
71
+ "@vue/devtools-api": "^7.0.14",
72
72
  "@vueuse/core": "^10.7.2",
73
73
  "@vueuse/integrations": "^10.7.2",
74
74
  "body-scroll-lock": "4.0.0-beta.0",
@@ -89,8 +89,7 @@
89
89
  "is-installed-globally": "^1.0.0",
90
90
  "jiti": "^1.21.0",
91
91
  "katex": "^0.16.9",
92
- "kolorist": "^1.8.0",
93
- "lru-cache": "^10.1.0",
92
+ "lru-cache": "^10.2.0",
94
93
  "markdown-it": "^14.0.0",
95
94
  "markdown-it-anchor": "^8.6.7",
96
95
  "markdown-it-attrs": "^4.1.6",
@@ -107,22 +106,24 @@
107
106
  "pinia": "^2.1.7",
108
107
  "qrcode": "^1.5.3",
109
108
  "sass": "^1.70.0",
110
- "shiki": "^0.14.7",
109
+ "shikiji": "0.9.7",
110
+ "shikiji-transformers": "0.9.7",
111
111
  "star-markdown-css": "^0.4.2",
112
112
  "unconfig": "^0.3.11",
113
- "unocss": "^0.58.3",
113
+ "unocss": "^0.58.4",
114
114
  "unplugin-vue-components": "^0.26.0",
115
115
  "unplugin-vue-router": "^0.7.0",
116
116
  "vanilla-lazyload": "^17.8.5",
117
117
  "vite": "^5.0.12",
118
- "vite-plugin-vue-devtools": "^7.0.11",
118
+ "vite-plugin-vue-devtools": "^7.0.14",
119
119
  "vite-plugin-vue-layouts": "0.11.0",
120
120
  "vite-ssg": "0.23.6",
121
121
  "vite-ssg-sitemap": "0.6.1",
122
122
  "vue": "^3.4.15",
123
- "vue-i18n": "^9.9.0",
123
+ "vue-i18n": "^9.9.1",
124
124
  "vue-router": "^4.2.5",
125
- "yargs": "^17.7.2"
125
+ "yargs": "^17.7.2",
126
+ "@valaxyjs/devtools": "0.0.1"
126
127
  },
127
128
  "devDependencies": {
128
129
  "@mdit-vue/plugin-component": "^2.0.0",
@@ -143,8 +144,7 @@
143
144
  "debug": "^4.3.4",
144
145
  "diacritics": "^1.3.0",
145
146
  "https-localhost": "^4.7.1",
146
- "markdown-it-image-figures": "^2.1.1",
147
- "shiki-processor": "^0.1.3"
147
+ "markdown-it-image-figures": "^2.1.1"
148
148
  },
149
149
  "scripts": {
150
150
  "build": "rimraf dist && tsup --splitting",
package/shims.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'vue-router'
2
2
 
3
- import './client/typed-router'
3
+ // import './client/typed-router'
4
4
 
5
5
  import type { Post } from './types'
6
6
  import type { Header } from './node/markdown'
@@ -60,3 +60,11 @@ declare module 'vue-router' {
60
60
  frontmatter: Post
61
61
  }
62
62
  }
63
+
64
+ declare module '/@valaxyjs/redirects' {
65
+ import type { RouteRecordRaw } from 'vue-router'
66
+
67
+ export const redirectRoutes: RouteRecordRaw[]
68
+
69
+ export const useVueRouter: boolean
70
+ }
package/types/config.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { ZoomOptions } from 'medium-zoom'
2
2
  import type { FuseOptions } from '@vueuse/integrations/useFuse'
3
3
  import type { ILazyLoadOptions } from 'vanilla-lazyload'
4
+ import type { RouteRecordRaw } from 'vue-router'
4
5
  import type { ValaxyAddon } from '../types'
5
6
  import type { DefaultTheme } from './default-theme'
6
7
  import type { PostFrontMatter } from './posts'
@@ -27,6 +28,11 @@ export interface RedirectRule {
27
28
  from: string | string[]
28
29
  }
29
30
 
31
+ export interface RedirectItem {
32
+ from: string
33
+ to: string
34
+ }
35
+
30
36
  // shared with valaxy node and client
31
37
  export interface SiteConfig {
32
38
  /**
@@ -323,7 +329,10 @@ export interface SiteConfig {
323
329
  * @description:en-US client redirect rules
324
330
  * @description:zh-CN 客户端重定向规则
325
331
  */
326
- redirects?: RedirectRule[]
332
+ redirects?: {
333
+ useVueRouter?: boolean
334
+ rules?: RedirectRule[]
335
+ }
327
336
  }
328
337
 
329
338
  export type PartialDeep<T> = {
@@ -335,6 +344,10 @@ export type PartialDeep<T> = {
335
344
  */
336
345
  export interface RuntimeConfig {
337
346
  addons: Record<string, ValaxyAddon>
347
+ redirects: {
348
+ useVueRouter: boolean
349
+ redirectRoutes: RouteRecordRaw[]
350
+ }
338
351
  }
339
352
 
340
353
  export interface Pkg {
package/types/posts.ts CHANGED
@@ -176,6 +176,11 @@ export interface PageFrontMatter extends Record<string, any> {
176
176
  * @description:zh-CN 限制代码块的高度,单位是 px
177
177
  */
178
178
  codeHeightLimit?: number
179
+ /**
180
+ * @description:en-US Source path for client redirection
181
+ * @description:zh-CN 客户端重定向的源路径
182
+ */
183
+ from?: string | string[]
179
184
  }
180
185
 
181
186
  export interface PostFrontMatter extends PageFrontMatter {