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
package/client/setups.ts
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
import type { Awaitable } from '@antfu/utils'
|
|
2
|
-
import type {
|
|
2
|
+
import type { App } from 'vue'
|
|
3
|
+
import type { Router, RouteRecordRaw } from 'vue-router'
|
|
3
4
|
import type { MermaidOptions } from './types'
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @en
|
|
8
|
+
* SSG context interface — property-compatible with ViteSSGContext so that
|
|
9
|
+
* downstream themes / addons only need to change their import path.
|
|
10
|
+
*
|
|
11
|
+
* @zh
|
|
12
|
+
* SSG 上下文接口 — 属性签名与 ViteSSGContext 完全兼容,下游主题/插件只需更改 import 路径。
|
|
13
|
+
*/
|
|
14
|
+
export interface ValaxySSGContext {
|
|
15
|
+
app: App
|
|
16
|
+
router: Router
|
|
17
|
+
routes: RouteRecordRaw[]
|
|
18
|
+
head: any
|
|
19
|
+
isClient: boolean
|
|
20
|
+
initialState: Record<string, any>
|
|
21
|
+
onSSRAppRendered: (cb: () => void) => void
|
|
22
|
+
triggerOnSSRAppRendered: () => Promise<unknown[]>
|
|
23
|
+
routePath?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
/**
|
|
6
27
|
* @see https://github.com/antfu-collective/vite-ssg
|
|
7
28
|
* @en
|
|
8
29
|
* The context object for the application setup function.
|
|
9
30
|
*
|
|
10
31
|
* @zh
|
|
11
|
-
* 应用 setup
|
|
32
|
+
* 应用 setup 函数的上下文对象。
|
|
12
33
|
*/
|
|
13
|
-
export type AppContext =
|
|
34
|
+
export type AppContext = ValaxySSGContext
|
|
14
35
|
|
|
15
36
|
export type AppSetup = (ctx: AppContext) => Awaitable<void>
|
|
16
37
|
|
package/client/stores/site.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PageDataPayload } from '../../types'
|
|
2
2
|
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
3
3
|
import { computed, ref } from 'vue'
|
|
4
|
-
import {
|
|
4
|
+
import { filterAndSortPosts, usePageList, useRouterStore, useSiteConfig } from '..'
|
|
5
5
|
import { setWindowValaxyProp } from '../utils/dev'
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -14,14 +14,19 @@ export const useSiteStore = defineStore('site', () => {
|
|
|
14
14
|
const routerStore = useRouterStore()
|
|
15
15
|
const router = routerStore.router
|
|
16
16
|
|
|
17
|
+
// Get siteConfig once during store initialization to avoid inject() issues during HMR
|
|
18
|
+
const siteConfig = useSiteConfig()
|
|
19
|
+
const pageList = usePageList()
|
|
20
|
+
|
|
17
21
|
const reload = ref(1)
|
|
18
22
|
// for dev hot reload
|
|
19
23
|
const postList = computed(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
// Touch reload.value to trigger reactivity on HMR
|
|
25
|
+
// eslint-disable-next-line ts/no-unused-expressions
|
|
26
|
+
reload.value
|
|
27
|
+
|
|
28
|
+
// Reuse the same filter and sort logic as usePostList
|
|
29
|
+
return filterAndSortPosts(pageList.value, siteConfig.value)
|
|
25
30
|
})
|
|
26
31
|
|
|
27
32
|
// const postList = usePostList()
|
|
@@ -5,17 +5,12 @@
|
|
|
5
5
|
mix-blend-mode: normal;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
.dark::view-transition-old(root) {
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
}
|
|
8
|
+
::view-transition-old(root),
|
|
12
9
|
.dark::view-transition-new(root) {
|
|
13
10
|
z-index: 1;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
|
-
::view-transition-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
::view-transition-new(root) {
|
|
13
|
+
::view-transition-new(root),
|
|
14
|
+
.dark::view-transition-old(root) {
|
|
20
15
|
z-index: 9999;
|
|
21
|
-
}
|
|
16
|
+
}
|
|
@@ -5,11 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
$c-primary: #0078e7 !default;
|
|
7
7
|
|
|
8
|
-
@use "./palette" with (
|
|
9
|
-
|
|
10
|
-
"primary": $c-primary,
|
|
11
|
-
)
|
|
12
|
-
);
|
|
8
|
+
@use "./palette" with ($colors: ("primary": $c-primary,
|
|
9
|
+
));
|
|
13
10
|
@use './css-vars/borders.css' as *;
|
|
14
11
|
@use './css-vars/palette.css' as *;
|
|
15
12
|
@use './css-vars/function.css' as *;
|
|
@@ -75,6 +72,8 @@ html.dark {
|
|
|
75
72
|
--va-c-bg-soft: #f9f9f9;
|
|
76
73
|
--va-c-bg-alt: #f9f9f9;
|
|
77
74
|
--va-c-bg-mute: #f1f1f1;
|
|
75
|
+
|
|
76
|
+
--va-c-bg-elevated: #f9f9f9;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
html.dark {
|
|
@@ -85,6 +84,8 @@ html.dark {
|
|
|
85
84
|
--va-c-bg-alt: #161618;
|
|
86
85
|
--va-c-bg-soft: #202127;
|
|
87
86
|
--va-c-bg-mute: #2f2f2f;
|
|
87
|
+
|
|
88
|
+
--va-c-bg-elevated: #202127;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
/* code */
|
|
@@ -144,4 +145,4 @@ html.dark {
|
|
|
144
145
|
|
|
145
146
|
:root {
|
|
146
147
|
--va-header-anchor-symbol: '#';
|
|
147
|
-
}
|
|
148
|
+
}
|
package/client/tsconfig.json
CHANGED
package/client/types/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type mermaid from 'mermaid'
|
|
2
|
-
import type {
|
|
2
|
+
import type { ValaxySSGContext } from '../setups'
|
|
3
3
|
|
|
4
|
-
export type UserModule = (ctx:
|
|
4
|
+
export type UserModule = (ctx: ValaxySSGContext) => void
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @see https://mermaid.js.org/config/schema-docs/config.html#mermaid-config-schema
|
package/dist/node/cli/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'node:process';
|
|
2
2
|
import 'yargs';
|
|
3
3
|
import 'yargs/helpers';
|
|
4
|
-
export { c as cli,
|
|
4
|
+
export { c as cli, I as registerDevCommand, W as run, Z as startValaxyDev } from '../../shared/valaxy.CKsfoRMA.mjs';
|
|
5
5
|
import 'node:os';
|
|
6
6
|
import 'node:path';
|
|
7
7
|
import 'consola';
|
|
@@ -29,13 +29,9 @@ import 'feed';
|
|
|
29
29
|
import 'markdown-it';
|
|
30
30
|
import 'table';
|
|
31
31
|
import 'hookable';
|
|
32
|
+
import 'node:child_process';
|
|
33
|
+
import 'node:v8';
|
|
32
34
|
import 'vite-ssg-sitemap';
|
|
33
|
-
import 'vite-ssg/node';
|
|
34
|
-
import '@intlify/unplugin-vue-i18n/vite';
|
|
35
|
-
import '@unhead/addons/vite';
|
|
36
|
-
import 'unplugin-vue-components/vite';
|
|
37
|
-
import 'vite-plugin-vue-layouts';
|
|
38
|
-
import 'vitepress-plugin-group-icons';
|
|
39
35
|
import 'markdown-it-async';
|
|
40
36
|
import '@shikijs/transformers';
|
|
41
37
|
import 'shiki';
|
|
@@ -46,21 +42,30 @@ import 'markdown-it-emoji';
|
|
|
46
42
|
import 'markdown-it-footnote';
|
|
47
43
|
import 'markdown-it-image-figures';
|
|
48
44
|
import 'markdown-it-task-lists';
|
|
45
|
+
import 'vitepress-plugin-group-icons';
|
|
49
46
|
import 'node:url';
|
|
50
47
|
import 'markdown-it-container';
|
|
51
48
|
import 'katex';
|
|
49
|
+
import 'katex/contrib/mhchem';
|
|
52
50
|
import 'unplugin-vue-markdown/vite';
|
|
53
51
|
import 'js-base64';
|
|
52
|
+
import '@intlify/unplugin-vue-i18n/vite';
|
|
53
|
+
import '@unhead/addons/vite';
|
|
54
|
+
import 'unplugin-vue-components/vite';
|
|
55
|
+
import 'vite-plugin-vue-layouts';
|
|
56
|
+
import 'p-map';
|
|
57
|
+
import 'node:buffer';
|
|
58
|
+
import 'minisearch';
|
|
59
|
+
import 'lru-cache';
|
|
54
60
|
import 'node:fs';
|
|
55
61
|
import 'jiti';
|
|
56
62
|
import 'unocss';
|
|
57
63
|
import 'pascalcase';
|
|
58
|
-
import 'lru-cache';
|
|
59
64
|
import 'html-to-text';
|
|
60
|
-
import '
|
|
65
|
+
import 'vue-router/vite';
|
|
66
|
+
import '@unhead/vue/server';
|
|
61
67
|
import '@clack/prompts';
|
|
62
68
|
import 'node:net';
|
|
63
|
-
import 'node:child_process';
|
|
64
69
|
import 'node:readline';
|
|
65
70
|
import 'qrcode';
|
|
66
71
|
import 'ejs';
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { ViteSSGOptions } from 'vite-ssg';
|
|
2
2
|
import * as vite from 'vite';
|
|
3
3
|
import { UserConfig, InlineConfig, ViteDevServer, PluginOption, Plugin } from 'vite';
|
|
4
|
+
import { D as DefaultTheme, R as RuntimeConfig, a as RedirectItem, V as ValaxyConfig, P as PartialDeep, b as ValaxyAddon, S as SiteConfig, U as UserSiteConfig } from '../shared/valaxy.Dgja0_Y0.mjs';
|
|
4
5
|
import Vue from '@vitejs/plugin-vue';
|
|
5
|
-
import { Options as Options$1 } from 'beasties';
|
|
6
6
|
import { Hookable } from 'hookable';
|
|
7
7
|
import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
|
|
8
8
|
import { presetWind4, presetAttributify, presetIcons, presetTypography } from 'unocss';
|
|
9
9
|
import { VitePluginConfig } from 'unocss/vite';
|
|
10
10
|
import Components from 'unplugin-vue-components/vite';
|
|
11
11
|
import Markdown from 'unplugin-vue-markdown/vite';
|
|
12
|
-
import { EditableTreeNode } from 'unplugin-vue-router';
|
|
13
|
-
import Router from 'unplugin-vue-router/vite';
|
|
14
12
|
import Layouts from 'vite-plugin-vue-layouts';
|
|
15
13
|
import { groupIconVitePlugin } from 'vitepress-plugin-group-icons';
|
|
16
|
-
import {
|
|
14
|
+
import { EditableTreeNode } from 'vue-router/unplugin';
|
|
15
|
+
import Router from 'vue-router/vite';
|
|
17
16
|
import { MarkdownEnv } from 'unplugin-vue-markdown/types';
|
|
18
17
|
import { KatexOptions } from 'katex';
|
|
19
18
|
import MarkdownIt from 'markdown-it';
|
|
@@ -23,6 +22,7 @@ import { ThemeRegistration, BuiltinTheme, LanguageInput, ShikiTransformer, Highl
|
|
|
23
22
|
export { cli, registerDevCommand, run, startValaxyDev } from './cli/index.mjs';
|
|
24
23
|
import { Awaitable } from '@antfu/utils';
|
|
25
24
|
import * as defu from 'defu';
|
|
25
|
+
import '@valaxyjs/utils';
|
|
26
26
|
import '@vueuse/integrations/useFuse';
|
|
27
27
|
import 'medium-zoom';
|
|
28
28
|
import 'vanilla-lazyload';
|
|
@@ -402,10 +402,31 @@ interface MarkdownOptions extends Options {
|
|
|
402
402
|
* @see https://katex.org/docs/options.html
|
|
403
403
|
*/
|
|
404
404
|
katex?: KatexOptions;
|
|
405
|
+
/**
|
|
406
|
+
* Options for `markdown-it-mathjax3`
|
|
407
|
+
* @see https://github.com/tani/markdown-it-mathjax3
|
|
408
|
+
*/
|
|
409
|
+
mathjax?: any;
|
|
405
410
|
externalLinks?: Record<string, string>;
|
|
406
411
|
}
|
|
407
412
|
|
|
408
413
|
type HookResult = Promise<void> | void;
|
|
414
|
+
interface MdAfterRenderContext {
|
|
415
|
+
route: EditableTreeNode;
|
|
416
|
+
data: Readonly<Record<string, any>>;
|
|
417
|
+
/**
|
|
418
|
+
* The final excerpt stored in `route.meta.excerpt`.
|
|
419
|
+
* - For `<!-- more -->` or auto-generated excerpts: rendered according to `excerpt_type` (HTML/text/md).
|
|
420
|
+
* - For manual frontmatter `excerpt`: used as-is (raw string, `excerpt_type` does not apply).
|
|
421
|
+
* - Empty string if no excerpt is available.
|
|
422
|
+
*/
|
|
423
|
+
excerpt: string;
|
|
424
|
+
/**
|
|
425
|
+
* Raw markdown content (without frontmatter) from gray-matter.
|
|
426
|
+
*/
|
|
427
|
+
content: string;
|
|
428
|
+
path: string;
|
|
429
|
+
}
|
|
409
430
|
interface ValaxyHooks {
|
|
410
431
|
'options:resolved': () => HookResult;
|
|
411
432
|
'config:init': () => HookResult;
|
|
@@ -414,6 +435,14 @@ interface ValaxyHooks {
|
|
|
414
435
|
*/
|
|
415
436
|
'vue-router:extendRoute': (route: EditableTreeNode) => HookResult;
|
|
416
437
|
'vue-router:beforeWriteFiles': (root: EditableTreeNode) => HookResult;
|
|
438
|
+
/**
|
|
439
|
+
* Called after a markdown page has been loaded and its frontmatter/excerpt resolved.
|
|
440
|
+
* Fires for all `.md` routes (posts, pages, collections, etc.).
|
|
441
|
+
* Provides access to the route, raw markdown content, resolved excerpt, frontmatter data, and file path.
|
|
442
|
+
* Useful for addons that need to inspect or extend page metadata (e.g., auto-generating excerpts).
|
|
443
|
+
* @see valaxy/node/plugins/vueRouter.ts extendRoute
|
|
444
|
+
*/
|
|
445
|
+
'md:afterRender': (ctx: MdAfterRenderContext) => HookResult;
|
|
417
446
|
'build:before': () => HookResult;
|
|
418
447
|
'build:after': () => HookResult;
|
|
419
448
|
}
|
|
@@ -492,6 +521,39 @@ interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
|
|
|
492
521
|
};
|
|
493
522
|
}
|
|
494
523
|
|
|
524
|
+
/**
|
|
525
|
+
* @experimental
|
|
526
|
+
* A module to load from CDN instead of bundling
|
|
527
|
+
*/
|
|
528
|
+
interface CdnModule {
|
|
529
|
+
/**
|
|
530
|
+
* npm package name to externalize
|
|
531
|
+
* @example 'vue'
|
|
532
|
+
*/
|
|
533
|
+
name: string;
|
|
534
|
+
/**
|
|
535
|
+
* Global variable name the library exposes on `window`
|
|
536
|
+
* Used for mapping imports to `window[global]`
|
|
537
|
+
* @example 'Vue'
|
|
538
|
+
*/
|
|
539
|
+
global: string;
|
|
540
|
+
/**
|
|
541
|
+
* Full CDN URL to the UMD/IIFE script
|
|
542
|
+
* @example 'https://cdn.jsdelivr.net/npm/vue@3.5.0/dist/vue.global.prod.js'
|
|
543
|
+
*/
|
|
544
|
+
url: string;
|
|
545
|
+
/**
|
|
546
|
+
* Optional CSS URL if the module requires stylesheet
|
|
547
|
+
* @example 'https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css'
|
|
548
|
+
*/
|
|
549
|
+
css?: string;
|
|
550
|
+
/**
|
|
551
|
+
* Named exports to re-export from the global variable.
|
|
552
|
+
* Required for libraries that use named exports (e.g., `import { ref } from 'vue'`).
|
|
553
|
+
* @example ['ref', 'computed', 'watch', 'createApp']
|
|
554
|
+
*/
|
|
555
|
+
exports?: string[];
|
|
556
|
+
}
|
|
495
557
|
type ValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = ValaxyConfig<ThemeConfig> & ValaxyExtendConfig;
|
|
496
558
|
type UserValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep<ValaxyNodeConfig<ThemeConfig>>;
|
|
497
559
|
/**
|
|
@@ -530,6 +592,34 @@ interface ValaxyExtendConfig {
|
|
|
530
592
|
* @default false
|
|
531
593
|
*/
|
|
532
594
|
ssgForPagination: boolean;
|
|
595
|
+
/**
|
|
596
|
+
* @en FOUC (Flash of Unstyled Content) guard configuration.
|
|
597
|
+
* Prevents layout shift on first paint by hiding the page body until
|
|
598
|
+
* full CSS is loaded. Uses `body { opacity: 0 }` inline, then the
|
|
599
|
+
* main stylesheet sets `body { opacity: 1 }` to reveal content.
|
|
600
|
+
*
|
|
601
|
+
* @zh FOUC(无样式内容闪烁)防护配置。
|
|
602
|
+
* 通过在完整 CSS 加载前隐藏页面内容来防止首屏样式闪烁。
|
|
603
|
+
* 内联 `body { opacity: 0 }`,完整 CSS 加载后通过 `body { opacity: 1 }` 解锁显示。
|
|
604
|
+
*/
|
|
605
|
+
foucGuard?: {
|
|
606
|
+
/**
|
|
607
|
+
* @en Enable FOUC guard. When disabled, no opacity hiding or fallback
|
|
608
|
+
* scripts will be injected.
|
|
609
|
+
* @zh 是否启用 FOUC 防护。禁用后不会注入 opacity 隐藏及兜底脚本。
|
|
610
|
+
* @default true
|
|
611
|
+
*/
|
|
612
|
+
enabled?: boolean;
|
|
613
|
+
/**
|
|
614
|
+
* @en Maximum wait time (ms) before force-showing the page, as a safety
|
|
615
|
+
* fallback in case CSS fails to load. Set to `0` to disable the timeout
|
|
616
|
+
* fallback (only `window.onload` will trigger reveal).
|
|
617
|
+
* @zh 最大等待时间(毫秒),作为 CSS 加载失败时的安全兜底。
|
|
618
|
+
* 设置为 `0` 可禁用超时兜底(仅依赖 `window.onload` 触发显示)。
|
|
619
|
+
* @default 5000
|
|
620
|
+
*/
|
|
621
|
+
maxDuration?: number;
|
|
622
|
+
};
|
|
533
623
|
};
|
|
534
624
|
/**
|
|
535
625
|
* @experimental
|
|
@@ -571,12 +661,30 @@ interface ValaxyExtendConfig {
|
|
|
571
661
|
features: {
|
|
572
662
|
/**
|
|
573
663
|
* enable katex for global
|
|
664
|
+
*
|
|
665
|
+
* - `true` (default): all pages render KaTeX, unless `frontmatter.katex: false`
|
|
666
|
+
* - `false`: no pages render KaTeX by default, but individual pages can opt-in via `frontmatter.katex: true`
|
|
667
|
+
*
|
|
574
668
|
* @see [Example | Valaxy](https://valaxy.site/examples/katex)
|
|
575
669
|
* @see https://katex.org/
|
|
576
670
|
* @default true
|
|
577
671
|
*/
|
|
578
672
|
katex: boolean;
|
|
579
673
|
};
|
|
674
|
+
/**
|
|
675
|
+
* Enable MathJax3 math rendering (aligned with VitePress `markdown.math`).
|
|
676
|
+
*
|
|
677
|
+
* When enabled, MathJax3 will be used via `markdown-it-mathjax3` to render
|
|
678
|
+
* math formulas as self-contained SVG — no external CSS or fonts required.
|
|
679
|
+
*
|
|
680
|
+
* - `features.katex` and `math` are **mutually exclusive**.
|
|
681
|
+
* - When `math` is enabled, `features.katex` is automatically ignored.
|
|
682
|
+
* - `math` requires installing `markdown-it-mathjax3`: `pnpm add markdown-it-mathjax3`
|
|
683
|
+
*
|
|
684
|
+
* @see https://www.mathjax.org/
|
|
685
|
+
* @default false
|
|
686
|
+
*/
|
|
687
|
+
math: boolean;
|
|
580
688
|
/**
|
|
581
689
|
* vite.config.ts options
|
|
582
690
|
* @see https://vite.dev/
|
|
@@ -706,10 +814,19 @@ interface ValaxyExtendConfig {
|
|
|
706
814
|
*/
|
|
707
815
|
hooks?: Partial<ValaxyHooks>;
|
|
708
816
|
/**
|
|
709
|
-
*
|
|
710
|
-
*
|
|
817
|
+
* @experimental
|
|
818
|
+
* CDN externals configuration.
|
|
819
|
+
* Specify modules to load from CDN instead of bundling them.
|
|
820
|
+
* Only takes effect during `valaxy build`, not in dev mode.
|
|
821
|
+
* @see https://github.com/YunYouJun/valaxy/issues/604
|
|
711
822
|
*/
|
|
712
|
-
|
|
823
|
+
cdn?: {
|
|
824
|
+
/**
|
|
825
|
+
* Modules to load from CDN instead of bundling
|
|
826
|
+
* @default []
|
|
827
|
+
*/
|
|
828
|
+
modules?: CdnModule[];
|
|
829
|
+
};
|
|
713
830
|
}
|
|
714
831
|
type ValaxyApp = ReturnType<typeof createValaxyNode>;
|
|
715
832
|
|
|
@@ -729,8 +846,22 @@ type ValaxyAddons = (ValaxyAddon | string)[] | Record<string, ValaxyAddonLike>;
|
|
|
729
846
|
type ValaxyAddonFn<ThemeConfig = DefaultTheme.Config> = (addonOptions: ValaxyAddonResolver, valaxyOptions: ResolvedValaxyOptions<ThemeConfig>) => ValaxyNodeConfig | Promise<ValaxyNodeConfig>;
|
|
730
847
|
type ValaxyAddonExport<ThemeConfig = DefaultTheme.Config> = ValaxyNodeConfig<ThemeConfig> | ValaxyAddonFn<ThemeConfig>;
|
|
731
848
|
|
|
849
|
+
interface ValaxySSGOptions {
|
|
850
|
+
concurrency?: number;
|
|
851
|
+
onBeforePageRender?: (route: string, html: string) => Promise<string | void> | string | void;
|
|
852
|
+
onPageRendered?: (route: string, html: string) => Promise<string | void> | string | void;
|
|
853
|
+
onFinished?: () => Promise<void> | void;
|
|
854
|
+
includedRoutes?: (paths: string[], routes: any[]) => string[] | Promise<string[]>;
|
|
855
|
+
includeAllRoutes?: boolean;
|
|
856
|
+
}
|
|
857
|
+
declare function ssgBuild(valaxyApp: ValaxyNode, viteConfig?: InlineConfig, userSsgOptions?: ValaxySSGOptions): Promise<void>;
|
|
858
|
+
|
|
732
859
|
declare function build(valaxyApp: ValaxyNode, viteConfig?: InlineConfig): Promise<void>;
|
|
733
|
-
|
|
860
|
+
/**
|
|
861
|
+
* Legacy SSG build using vite-ssg (JSDOM-based).
|
|
862
|
+
* Kept as fallback for `--ssg-engine vite-ssg`.
|
|
863
|
+
*/
|
|
864
|
+
declare function ssgBuildLegacy(valaxyApp: ValaxyNode, viteConfig?: InlineConfig): Promise<void>;
|
|
734
865
|
/**
|
|
735
866
|
* post process for ssg fix extra string like `/html>` `ml>` `l>`
|
|
736
867
|
* handle tasks after ssg build
|
|
@@ -812,6 +943,20 @@ declare function defineValaxyTheme<ThemeConfig = DefaultTheme.Config>(theme: Val
|
|
|
812
943
|
declare const defineTheme: typeof defineValaxyTheme;
|
|
813
944
|
|
|
814
945
|
declare const defaultValaxyConfig: ValaxyNodeConfig;
|
|
946
|
+
/**
|
|
947
|
+
* Whether MathJax is enabled (takes priority over KaTeX).
|
|
948
|
+
*/
|
|
949
|
+
declare function isMathJaxEnabled(config?: ValaxyNodeConfig | null): boolean;
|
|
950
|
+
/**
|
|
951
|
+
* Whether KaTeX is enabled (disabled when MathJax is active).
|
|
952
|
+
*/
|
|
953
|
+
declare function isKatexEnabled(config?: ValaxyNodeConfig | null): boolean;
|
|
954
|
+
/**
|
|
955
|
+
* Whether the KaTeX markdown-it plugin should be registered.
|
|
956
|
+
* Always true unless MathJax is active, so that per-page `frontmatter.katex: true`
|
|
957
|
+
* can work even when `features.katex` is globally `false`.
|
|
958
|
+
*/
|
|
959
|
+
declare function isKatexPluginNeeded(config?: ValaxyNodeConfig | null): boolean;
|
|
815
960
|
/**
|
|
816
961
|
* Type helper for valaxy.config.ts
|
|
817
962
|
*/
|
|
@@ -945,5 +1090,5 @@ declare function toAtFS(path: string): string;
|
|
|
945
1090
|
declare function resolveImportPath(importName: string, ensure?: true): Promise<string>;
|
|
946
1091
|
declare function resolveImportPath(importName: string, ensure?: boolean): Promise<string | undefined>;
|
|
947
1092
|
|
|
948
|
-
export { $t, ALL_ROUTE, EXCERPT_SEPARATOR, GLOBAL_STATE, PATHNAME_PROTOCOL_RE, ViteValaxyPlugins, build, createServer, createValaxyPlugin, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, encryptContent, generateClientRedirects, getGitTimestamp, getIndexHtml, getServerInfoText, isExternal, isInstalledGlobally, isPath, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig, resolveImportPath, resolveImportUrl, resolveOptions, resolveSiteConfig, resolveSiteConfigFromRoot, resolveThemeConfigFromRoot, resolveThemeValaxyConfig, resolveUserThemeConfig, resolveValaxyConfig, resolveValaxyConfigFromRoot, ssgBuild, toAtFS, transformObject, version };
|
|
949
|
-
export type { HookResult, LoadConfigFromFileOptions, ResolvedConfig, ResolvedValaxyOptions, UnoSetup, UserInputConfig, UserValaxyNodeConfig, ValaxyAddonExport, ValaxyAddonFn, ValaxyAddonLike, ValaxyAddonResolver, ValaxyAddons, ValaxyApp, ValaxyConfigExport, ValaxyConfigExtendKey, ValaxyConfigFn, ValaxyEntryOptions, ValaxyExtendConfig, ValaxyHooks, ValaxyNode, ValaxyNodeConfig, ValaxyPickConfig, ValaxyServerOptions, ValaxyTheme };
|
|
1093
|
+
export { $t, ALL_ROUTE, EXCERPT_SEPARATOR, GLOBAL_STATE, PATHNAME_PROTOCOL_RE, ViteValaxyPlugins, build, createServer, createValaxyPlugin, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, encryptContent, generateClientRedirects, getGitTimestamp, getIndexHtml, getServerInfoText, isExternal, isInstalledGlobally, isKatexEnabled, isKatexPluginNeeded, isMathJaxEnabled, isPath, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig, resolveImportPath, resolveImportUrl, resolveOptions, resolveSiteConfig, resolveSiteConfigFromRoot, resolveThemeConfigFromRoot, resolveThemeValaxyConfig, resolveUserThemeConfig, resolveValaxyConfig, resolveValaxyConfigFromRoot, ssgBuild, ssgBuildLegacy, toAtFS, transformObject, version };
|
|
1094
|
+
export type { CdnModule, HookResult, LoadConfigFromFileOptions, MdAfterRenderContext, ResolvedConfig, ResolvedValaxyOptions, UnoSetup, UserInputConfig, UserValaxyNodeConfig, ValaxyAddonExport, ValaxyAddonFn, ValaxyAddonLike, ValaxyAddonResolver, ValaxyAddons, ValaxyApp, ValaxyConfigExport, ValaxyConfigExtendKey, ValaxyConfigFn, ValaxyEntryOptions, ValaxyExtendConfig, ValaxyHooks, ValaxyNode, ValaxyNodeConfig, ValaxyPickConfig, ValaxyServerOptions, ValaxyTheme };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, V as ViteValaxyPlugins, b as build, c as cli, a as createServer, d as createValaxyPlugin, e as customElements, f as defaultSiteConfig, g as defaultValaxyConfig, h as defaultViteConfig, i as defineAddon, j as defineConfig, k as defineSiteConfig, l as defineTheme, m as defineValaxyAddon, n as defineValaxyConfig, o as defineValaxyTheme, p as encryptContent, q as generateClientRedirects, r as getGitTimestamp, s as getIndexHtml, t as getServerInfoText, u as isExternal, v as isInstalledGlobally, w as isKatexEnabled, x as isKatexPluginNeeded, y as isMathJaxEnabled, z as isPath, B as loadConfigFromFile, C as mergeValaxyConfig, D as mergeViteConfigs, F as postProcessForSSG, H as processValaxyOptions, I as registerDevCommand, J as resolveAddonsConfig, K as resolveImportPath, L as resolveImportUrl, M as resolveOptions, N as resolveSiteConfig, O as resolveSiteConfigFromRoot, Q as resolveThemeConfigFromRoot, R as resolveThemeValaxyConfig, S as resolveUserThemeConfig, T as resolveValaxyConfig, U as resolveValaxyConfigFromRoot, W as run, X as ssgBuild, Y as ssgBuildLegacy, Z as startValaxyDev, _ as toAtFS, $ as transformObject, a0 as version } from '../shared/valaxy.CKsfoRMA.mjs';
|
|
2
2
|
import 'node:path';
|
|
3
3
|
import 'fs-extra';
|
|
4
4
|
import 'consola/utils';
|
|
@@ -29,13 +29,9 @@ import 'feed';
|
|
|
29
29
|
import 'markdown-it';
|
|
30
30
|
import 'table';
|
|
31
31
|
import 'hookable';
|
|
32
|
+
import 'node:child_process';
|
|
33
|
+
import 'node:v8';
|
|
32
34
|
import 'vite-ssg-sitemap';
|
|
33
|
-
import 'vite-ssg/node';
|
|
34
|
-
import '@intlify/unplugin-vue-i18n/vite';
|
|
35
|
-
import '@unhead/addons/vite';
|
|
36
|
-
import 'unplugin-vue-components/vite';
|
|
37
|
-
import 'vite-plugin-vue-layouts';
|
|
38
|
-
import 'vitepress-plugin-group-icons';
|
|
39
35
|
import 'markdown-it-async';
|
|
40
36
|
import '@shikijs/transformers';
|
|
41
37
|
import 'shiki';
|
|
@@ -46,21 +42,30 @@ import 'markdown-it-emoji';
|
|
|
46
42
|
import 'markdown-it-footnote';
|
|
47
43
|
import 'markdown-it-image-figures';
|
|
48
44
|
import 'markdown-it-task-lists';
|
|
45
|
+
import 'vitepress-plugin-group-icons';
|
|
49
46
|
import 'node:url';
|
|
50
47
|
import 'markdown-it-container';
|
|
51
48
|
import 'katex';
|
|
49
|
+
import 'katex/contrib/mhchem';
|
|
52
50
|
import 'unplugin-vue-markdown/vite';
|
|
53
51
|
import 'js-base64';
|
|
52
|
+
import '@intlify/unplugin-vue-i18n/vite';
|
|
53
|
+
import '@unhead/addons/vite';
|
|
54
|
+
import 'unplugin-vue-components/vite';
|
|
55
|
+
import 'vite-plugin-vue-layouts';
|
|
56
|
+
import 'p-map';
|
|
57
|
+
import 'node:buffer';
|
|
58
|
+
import 'minisearch';
|
|
59
|
+
import 'lru-cache';
|
|
54
60
|
import 'node:fs';
|
|
55
61
|
import 'jiti';
|
|
56
62
|
import 'unocss';
|
|
57
63
|
import 'pascalcase';
|
|
58
|
-
import 'lru-cache';
|
|
59
64
|
import 'html-to-text';
|
|
60
|
-
import '
|
|
65
|
+
import 'vue-router/vite';
|
|
66
|
+
import '@unhead/vue/server';
|
|
61
67
|
import '@clack/prompts';
|
|
62
68
|
import 'node:net';
|
|
63
|
-
import 'node:child_process';
|
|
64
69
|
import 'node:readline';
|
|
65
70
|
import 'qrcode';
|
|
66
71
|
import 'ejs';
|