valaxy 1.2.2 → 1.3.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/bin/valaxy.mjs +1 -5
- package/client/components/ValaxyDecrypt.vue +6 -25
- package/client/components/ValaxyDynamicComponent.vue +13 -34
- package/client/components/ValaxyFootnoteTooltip.vue +140 -11
- package/client/composables/app/index.ts +1 -0
- package/client/composables/app/usePageSeo.ts +40 -0
- package/client/composables/app/useValaxyApp.ts +24 -23
- package/client/composables/app/useValaxyHead.ts +5 -12
- package/client/composables/dark.ts +8 -1
- package/client/composables/post/filter.ts +1 -1
- package/client/composables/post/index.ts +4 -4
- package/client/composables/search/index.ts +2 -0
- package/client/composables/search/package.json +4 -0
- package/client/composables/search/useFuseSearch.ts +1 -1
- package/client/composables/widgets/backToTop.ts +30 -6
- package/client/main.ts +6 -6
- package/client/runtime/ValaxyRuntimeTemplate.vue +26 -0
- package/client/setup/main.ts +0 -2
- package/client/shims.d.ts +4 -0
- package/client/stores/router.ts +12 -0
- package/client/stores/site.ts +5 -50
- package/client/utils/index.ts +1 -0
- package/client/utils/seo.ts +79 -0
- package/client/utils/time.ts +7 -4
- package/dist/node/cli/index.mjs +2 -3
- package/dist/node/index.d.mts +295 -48
- package/dist/node/index.mjs +2 -3
- package/dist/shared/{valaxy.BTmQYjWn.mjs → valaxy.Dpywjeor.mjs} +1266 -218
- package/dist/shared/{valaxy.EzGcrVef.d.mts → valaxy.Jqi53gnQ.d.mts} +42 -15
- package/dist/types/index.d.mts +2 -2
- package/package.json +4 -5
- package/shared/index.ts +2 -0
- package/shared/page-policy.ts +123 -0
- package/shared/seo.ts +182 -0
- package/types/config.ts +39 -17
- package/types/vue-router.d.ts +4 -0
- package/vendor/README.md +4 -4
- package/client/components/footnote/FootnotePopover.vue +0 -146
- package/client/components/footnote/LegacyFootnoteTooltip.vue +0 -25
- package/client/modules/floating-vue.ts +0 -11
- package/vendor/ensure-gray-matter.d.ts +0 -1
- package/vendor/ensure-gray-matter.mjs +0 -23
- package/vendor/redirect-gray-matter.mjs +0 -30
package/client/setup/main.ts
CHANGED
|
@@ -9,7 +9,6 @@ import type { ValaxySSGContext } from '../setups'
|
|
|
9
9
|
|
|
10
10
|
import { consola } from 'consola'
|
|
11
11
|
import { registerGlobalComponents } from '../modules/components'
|
|
12
|
-
import { install as installFloatingVue } from '../modules/floating-vue'
|
|
13
12
|
import { install as installNprogress } from '../modules/nprogress'
|
|
14
13
|
import { install as installPinia } from '../modules/pinia'
|
|
15
14
|
import { install as installUnhead } from '../modules/unhead'
|
|
@@ -25,7 +24,6 @@ export default function setupMain(ctx: ValaxySSGContext, config: ComputedRef<Val
|
|
|
25
24
|
installUnhead(ctx)
|
|
26
25
|
installPinia(ctx)
|
|
27
26
|
installNprogress(ctx)
|
|
28
|
-
installFloatingVue(ctx, config)
|
|
29
27
|
|
|
30
28
|
if (import.meta.env.DEV && ctx.isClient && config.value.devtools) {
|
|
31
29
|
import('../modules/devtools').then(({ install: installDevtools }) => {
|
package/client/shims.d.ts
CHANGED
package/client/stores/router.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { defineStore } from 'pinia'
|
|
2
|
+
import { computed, shallowRef } from 'vue'
|
|
2
3
|
import { useRouter } from 'vue-router'
|
|
3
4
|
|
|
4
5
|
export const useRouterStore = defineStore('routerStore', () => {
|
|
5
6
|
const router = useRouter()
|
|
7
|
+
// Vue Router's matcher is not reactive. Publish a new snapshot only after
|
|
8
|
+
// the complete, layout-resolved route table has been replaced by HMR.
|
|
9
|
+
const routeRecords = shallowRef(router.getRoutes())
|
|
10
|
+
|
|
11
|
+
function refreshRoutes() {
|
|
12
|
+
routeRecords.value = router.getRoutes()
|
|
13
|
+
}
|
|
6
14
|
|
|
7
15
|
return {
|
|
8
16
|
router,
|
|
17
|
+
// A getter keeps runtime components/route records out of serialized Pinia
|
|
18
|
+
// state; each SSR app and hydration pass reads its own router instead.
|
|
19
|
+
routes: computed(() => routeRecords.value),
|
|
20
|
+
refreshRoutes,
|
|
9
21
|
}
|
|
10
22
|
})
|
package/client/stores/site.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { PageDataPayload } from '../../types'
|
|
2
1
|
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
3
|
-
import { computed
|
|
4
|
-
import { filterAndSortPosts, usePageList,
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { filterAndSortPosts, usePageList, useSiteConfig } from '..'
|
|
5
4
|
import { setWindowValaxyProp } from '../utils/dev'
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -11,57 +10,13 @@ import { setWindowValaxyProp } from '../utils/dev'
|
|
|
11
10
|
* - category
|
|
12
11
|
*/
|
|
13
12
|
export const useSiteStore = defineStore('site', () => {
|
|
14
|
-
const routerStore = useRouterStore()
|
|
15
|
-
const router = routerStore.router
|
|
16
|
-
|
|
17
13
|
// Get siteConfig once during store initialization to avoid inject() issues during HMR
|
|
18
14
|
const siteConfig = useSiteConfig()
|
|
19
15
|
const pageList = usePageList()
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
const postList = computed(() =>
|
|
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)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
// const postList = usePostList()
|
|
33
|
-
|
|
34
|
-
if (router) {
|
|
35
|
-
router.isReady().then(() => {
|
|
36
|
-
// hot reload when save md
|
|
37
|
-
if (import.meta.hot) {
|
|
38
|
-
import.meta.hot!.on('valaxy:pageData', (payload: PageDataPayload) => {
|
|
39
|
-
// hot reload for global categories & tags
|
|
40
|
-
let path = payload.path
|
|
41
|
-
if (payload.path.endsWith('.md'))
|
|
42
|
-
path = payload.path.slice(0, -3)
|
|
43
|
-
|
|
44
|
-
const routeName = path
|
|
45
|
-
if (!router.hasRoute(routeName))
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
// can not use generatedRoutes, otherwise will trigger ValaxyMain refresh
|
|
49
|
-
const route = router.getRoutes().find(r => r.name === routeName)!
|
|
50
|
-
router.removeRoute(routeName)
|
|
51
|
-
if (route.meta) {
|
|
52
|
-
route.meta.frontmatter = {
|
|
53
|
-
...route.meta.frontmatter,
|
|
54
|
-
...payload.pageData.frontmatter,
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
router.addRoute(route)
|
|
58
|
-
|
|
59
|
-
// trigger `computed` reload, not server
|
|
60
|
-
reload.value += 1
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
}
|
|
17
|
+
// usePageList observes the generated route metadata, including excerpts and
|
|
18
|
+
// removed fields, rather than merging raw Markdown frontmatter a second time.
|
|
19
|
+
const postList = computed(() => filterAndSortPosts(pageList.value, siteConfig.value))
|
|
65
20
|
|
|
66
21
|
if (import.meta.env.DEV)
|
|
67
22
|
setWindowValaxyProp('postList', postList)
|
package/client/utils/index.ts
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
|
2
|
+
import type { SocialLink } from '../../types'
|
|
3
|
+
import { EXTERNAL_URL_RE } from '../../shared'
|
|
4
|
+
import { resolveSiteUrl } from './path'
|
|
5
|
+
|
|
6
|
+
/** Keep URL parameters while using the matched route's trailing-slash convention. */
|
|
7
|
+
export function resolveCanonicalPath(route: Pick<RouteLocationNormalizedLoaded, 'path' | 'matched'>): string {
|
|
8
|
+
const matchedPath = route.matched.at(-1)?.path
|
|
9
|
+
if (!matchedPath || route.path === '/')
|
|
10
|
+
return route.path
|
|
11
|
+
|
|
12
|
+
const path = route.path.replace(/\/+$/, '')
|
|
13
|
+
return matchedPath.endsWith('/') ? `${path}/` : path
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolve a share image against the page when it is relative, and against the
|
|
18
|
+
* site deployment path when it is root-absolute. Absolute URLs are unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveShareImage(siteUrl: string, pagePath: string, src: string): string {
|
|
21
|
+
if (!src || EXTERNAL_URL_RE.test(src) || !/^https?:\/\//.test(siteUrl))
|
|
22
|
+
return src
|
|
23
|
+
if (src.startsWith('/')) {
|
|
24
|
+
// Vite asset imports already include the deployment base.
|
|
25
|
+
const base = new URL(siteUrl).pathname.replace(/\/+$/, '')
|
|
26
|
+
if (base && src.startsWith(`${base}/`))
|
|
27
|
+
return new URL(src, siteUrl).href
|
|
28
|
+
return resolveSiteUrl(siteUrl, src)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const directory = pagePath.endsWith('/') ? pagePath : pagePath.replace(/[^/]*$/, '')
|
|
32
|
+
const basePath = directory.startsWith('/') ? directory : `/${directory}`
|
|
33
|
+
try {
|
|
34
|
+
const resolved = new URL(src, `http://valaxy.local${basePath}`)
|
|
35
|
+
return resolveSiteUrl(siteUrl, `${resolved.pathname}${resolved.search}${resolved.hash}`)
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return src
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Public identity links only; this never changes the site's social navigation. */
|
|
43
|
+
export function resolveSocialSameAs(siteUrl: string, social: Pick<SocialLink, 'link' | 'sameAs'>[], feedName?: string): string[] {
|
|
44
|
+
const urls = new Set<string>()
|
|
45
|
+
const feeds = new Set((feedName ? [`${feedName}.xml`, `${feedName}.atom`, `${feedName}.json`] : [])
|
|
46
|
+
.map(path => resolveSiteUrl(siteUrl, path)))
|
|
47
|
+
|
|
48
|
+
for (const item of social) {
|
|
49
|
+
const value = typeof item.link === 'string' ? item.link.trim() : ''
|
|
50
|
+
if (item.sameAs === false || !value || /^[?#]/.test(value)
|
|
51
|
+
|| value.includes('\\') || Array.from(value).some(char => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127)) {
|
|
52
|
+
continue
|
|
53
|
+
}
|
|
54
|
+
// Do not let URL parsing repair a malformed scheme into a relative page.
|
|
55
|
+
if (/^[a-z][a-z\d+.-]*:/i.test(value) && !/^https?:\/\/[^/\s]/i.test(value))
|
|
56
|
+
continue
|
|
57
|
+
if (value.startsWith('///'))
|
|
58
|
+
continue
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
// Keep root-relative links pointing to the same destination as social anchors.
|
|
62
|
+
const resolved = value.startsWith('/') ? value : resolveSiteUrl(siteUrl, value)
|
|
63
|
+
const url = /^https?:\/\//i.test(resolved) ? new URL(resolved) : new URL(resolved, siteUrl)
|
|
64
|
+
if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password)
|
|
65
|
+
continue
|
|
66
|
+
|
|
67
|
+
// Recognize feed filenames, not arbitrary account names, domains or icons.
|
|
68
|
+
// Extensionless subscription/group links can opt out with sameAs: false.
|
|
69
|
+
const filename = decodeURIComponent(url.pathname).split('/').pop() || ''
|
|
70
|
+
if (/^(?:atom|rss|rss2|feed)\.xml$|^feed\.json$|\.(?:atom|rss)$/i.test(filename)
|
|
71
|
+
|| feeds.has(`${url.origin}${url.pathname}`)) {
|
|
72
|
+
continue
|
|
73
|
+
}
|
|
74
|
+
urls.add(url.href)
|
|
75
|
+
}
|
|
76
|
+
catch {}
|
|
77
|
+
}
|
|
78
|
+
return [...urls]
|
|
79
|
+
}
|
package/client/utils/time.ts
CHANGED
|
@@ -12,6 +12,12 @@ dayjs.extend(utc)
|
|
|
12
12
|
// https://day.js.org/docs/en/timezone/set-default-timezone
|
|
13
13
|
export { dayjs }
|
|
14
14
|
|
|
15
|
+
/** Convert a date using the same timezone rules as formatDate. */
|
|
16
|
+
export function toZonedDayjs(date?: string | number | Date, timezone?: string) {
|
|
17
|
+
const input = typeof date === 'string' ? new Date(date) : date
|
|
18
|
+
return dayjs.tz(dayjs.utc(input), timezone)
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* format the date (dayjs)
|
|
17
23
|
* with default timezone
|
|
@@ -21,10 +27,7 @@ export function formatDate(date?: string | number | Date, options: {
|
|
|
21
27
|
timezone?: string
|
|
22
28
|
// keepLocalTime?: boolean
|
|
23
29
|
} = {}) {
|
|
24
|
-
|
|
25
|
-
date = new Date(date)
|
|
26
|
-
}
|
|
27
|
-
return dayjs.tz(dayjs.utc(date), options.timezone).format(options.template || 'YYYY-MM-DD')
|
|
30
|
+
return toZonedDayjs(date, options.timezone).format(options.template || 'YYYY-MM-DD')
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
/**
|
package/dist/node/cli/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import 'node:path';
|
|
|
2
2
|
import 'node:process';
|
|
3
3
|
import 'yargs';
|
|
4
4
|
import 'yargs/helpers';
|
|
5
|
-
export { c as createCli, s as desktopRuntimeVersion, u as execBuild, O as registerDevCommand,
|
|
5
|
+
export { c as createCli, s as desktopRuntimeVersion, u as execBuild, O as registerDevCommand, a1 as run, a3 as startValaxyDev } from '../../shared/valaxy.Dpywjeor.mjs';
|
|
6
6
|
import 'node:os';
|
|
7
7
|
import '@11ty/gray-matter';
|
|
8
8
|
import 'consola';
|
|
@@ -16,7 +16,6 @@ import 'pathe';
|
|
|
16
16
|
import 'defu';
|
|
17
17
|
import 'vite';
|
|
18
18
|
import 'node:crypto';
|
|
19
|
-
import 'floating-vue';
|
|
20
19
|
import 'define-config-ts';
|
|
21
20
|
import 'ora';
|
|
22
21
|
import 'node:buffer';
|
|
@@ -58,7 +57,7 @@ import 'node:url';
|
|
|
58
57
|
import 'markdown-it-container';
|
|
59
58
|
import 'katex';
|
|
60
59
|
import 'katex/contrib/mhchem';
|
|
61
|
-
import '
|
|
60
|
+
import 'node:module';
|
|
62
61
|
import 'jiti';
|
|
63
62
|
import 'unocss';
|
|
64
63
|
import 'html-to-text';
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vite from 'vite';
|
|
1
2
|
import { UserConfig, InlineConfig, ViteDevServer, PluginOption, Plugin } from 'vite';
|
|
2
3
|
import { SiteConfig, DefaultTheme, RuntimeConfig, RedirectItem, ValaxyConfig, PartialDeep, ValaxyAddon, UserSiteConfig } from '../types/index.mjs';
|
|
3
4
|
import Vue from '@vitejs/plugin-vue';
|
|
@@ -6,14 +7,14 @@ import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
|
|
|
6
7
|
import { presetAttributify, presetIcons, presetTypography, presetWind4 } from 'unocss';
|
|
7
8
|
import { VitePluginConfig } from 'unocss/vite';
|
|
8
9
|
import Components from 'unplugin-vue-components/vite';
|
|
9
|
-
import
|
|
10
|
+
import { FilterPattern } from 'unplugin-utils';
|
|
11
|
+
import grayMatter from '@11ty/gray-matter';
|
|
12
|
+
import MarkdownExit, { MarkdownExitOptions, PluginSimple, PluginWithOptions, MarkdownExit as MarkdownExit$1, StateCore, Token } from 'markdown-exit';
|
|
10
13
|
import { EditableTreeNode } from 'vue-router/unplugin';
|
|
11
14
|
import Router from 'vue-router/vite';
|
|
12
|
-
import { MarkdownEnv } from 'unplugin-vue-markdown/types';
|
|
13
15
|
import { ValaxyDevtoolsAddon } from '@valaxyjs/devtools/plugin';
|
|
14
16
|
import { Argv } from 'yargs';
|
|
15
17
|
import { KatexOptions } from 'katex';
|
|
16
|
-
import { MarkdownExitOptions, MarkdownExit, StateCore, Token } from 'markdown-exit';
|
|
17
18
|
import { ThemeRegistration, BuiltinTheme, LanguageInput, ShikiTransformer, Highlighter } from 'shiki';
|
|
18
19
|
import { Header } from '@valaxyjs/utils';
|
|
19
20
|
export { CreateCliOptions, createCli, desktopRuntimeVersion, execBuild, registerDevCommand, run, startValaxyDev } from './cli/index.mjs';
|
|
@@ -26,6 +27,285 @@ import 'vue-router';
|
|
|
26
27
|
import '@vueuse/core';
|
|
27
28
|
import '@unhead/schema-org';
|
|
28
29
|
|
|
30
|
+
//#region src/types.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* Options of @mdit-vue/plugin-component
|
|
33
|
+
*/
|
|
34
|
+
interface ComponentPluginOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Extra tags to be treated as block tags.
|
|
37
|
+
*
|
|
38
|
+
* @default []
|
|
39
|
+
*/
|
|
40
|
+
blockTags?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Extra tags to be treated as inline tags.
|
|
43
|
+
*
|
|
44
|
+
* @default []
|
|
45
|
+
*/
|
|
46
|
+
inlineTags?: string[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#region src/types.d.ts
|
|
50
|
+
type GrayMatterOptions = grayMatter.GrayMatterOption<string, GrayMatterOptions>;
|
|
51
|
+
/**
|
|
52
|
+
* Options of @mdit-vue/plugin-frontmatter
|
|
53
|
+
*/
|
|
54
|
+
interface FrontmatterPluginOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Options of gray-matter
|
|
57
|
+
*
|
|
58
|
+
* @see https://github.com/jonschlinkert/gray-matter#options
|
|
59
|
+
*/
|
|
60
|
+
grayMatterOptions?: GrayMatterOptions;
|
|
61
|
+
/**
|
|
62
|
+
* Render the excerpt or not
|
|
63
|
+
*
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
renderExcerpt?: boolean;
|
|
67
|
+
}
|
|
68
|
+
declare module '@mdit-vue/types' {
|
|
69
|
+
interface MarkdownItEnv {
|
|
70
|
+
/**
|
|
71
|
+
* The raw Markdown content without frontmatter
|
|
72
|
+
*/
|
|
73
|
+
content?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The excerpt that extracted by `@mdit-vue/plugin-frontmatter`
|
|
76
|
+
*
|
|
77
|
+
* - Would be the rendered HTML when `renderExcerpt` is enabled
|
|
78
|
+
* - Would be the raw Markdown when `renderExcerpt` is disabled
|
|
79
|
+
*/
|
|
80
|
+
excerpt?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The frontmatter that extracted by `@mdit-vue/plugin-frontmatter`
|
|
83
|
+
*/
|
|
84
|
+
frontmatter?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#region src/types.d.ts
|
|
89
|
+
interface MarkdownItEnv {}
|
|
90
|
+
interface MarkdownItHeader {
|
|
91
|
+
/**
|
|
92
|
+
* The level of the header
|
|
93
|
+
*
|
|
94
|
+
* `1` to `6` for `<h1>` to `<h6>`
|
|
95
|
+
*/
|
|
96
|
+
level: number;
|
|
97
|
+
/**
|
|
98
|
+
* The title of the header
|
|
99
|
+
*/
|
|
100
|
+
title: string;
|
|
101
|
+
/**
|
|
102
|
+
* The slug of the header
|
|
103
|
+
*
|
|
104
|
+
* Typically the `id` attr of the header anchor
|
|
105
|
+
*/
|
|
106
|
+
slug: string;
|
|
107
|
+
/**
|
|
108
|
+
* Link of the header
|
|
109
|
+
*
|
|
110
|
+
* Typically using `#${slug}` as the anchor hash
|
|
111
|
+
*/
|
|
112
|
+
link: string;
|
|
113
|
+
/**
|
|
114
|
+
* The children of the header
|
|
115
|
+
*/
|
|
116
|
+
children: MarkdownItHeader[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
//#region src/core/head.d.ts
|
|
120
|
+
declare function preprocessHead<T extends Frontmatter>(frontmatter: T, options: ResolvedOptions): any;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/types.d.ts
|
|
123
|
+
/** a `<meta />` property in HTML is defined with the following name/values */
|
|
124
|
+
interface MetaProperty {
|
|
125
|
+
key?: string;
|
|
126
|
+
/**
|
|
127
|
+
* the "name" property used by Facebook and other providers who
|
|
128
|
+
* use the Opengraph standards
|
|
129
|
+
*/
|
|
130
|
+
property?: string;
|
|
131
|
+
/**
|
|
132
|
+
* used by google to identify the "name" of the name/value pair
|
|
133
|
+
*/
|
|
134
|
+
itemprop?: string;
|
|
135
|
+
/**
|
|
136
|
+
* used by Twitter to indicate the "name" field in a meta properties
|
|
137
|
+
* name/value pairing
|
|
138
|
+
*/
|
|
139
|
+
name?: string;
|
|
140
|
+
/**
|
|
141
|
+
* The value of the meta property
|
|
142
|
+
*/
|
|
143
|
+
content?: any;
|
|
144
|
+
[key: string]: unknown;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Frontmatter content is represented as key/value dictionary
|
|
148
|
+
*/
|
|
149
|
+
interface Frontmatter {
|
|
150
|
+
title?: string;
|
|
151
|
+
name?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
meta?: MetaProperty[];
|
|
154
|
+
[key: string]: unknown;
|
|
155
|
+
}
|
|
156
|
+
interface Options {
|
|
157
|
+
/**
|
|
158
|
+
* Explicitly set the Vue version
|
|
159
|
+
*
|
|
160
|
+
* @default auto detected
|
|
161
|
+
*/
|
|
162
|
+
vueVersion?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Enable head support, need to install @unhead/vue and register to App in main.js
|
|
165
|
+
*
|
|
166
|
+
* @default true
|
|
167
|
+
*/
|
|
168
|
+
headEnabled?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* The head field in frontmatter used to be used for @unhead/vue
|
|
171
|
+
*
|
|
172
|
+
* When an empty string is passed, it will use the root properties of the frontmatter
|
|
173
|
+
*
|
|
174
|
+
* @default ''
|
|
175
|
+
*/
|
|
176
|
+
headField?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Parse for frontmatter
|
|
179
|
+
*
|
|
180
|
+
* @default true
|
|
181
|
+
*/
|
|
182
|
+
frontmatter?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Parse for excerpt
|
|
185
|
+
*
|
|
186
|
+
* If `true`, it will be passed to `frontmatterPreprocess` as `frontmatter.excerpt`, replacing the `excerpt` key in frontmatter, if there's any
|
|
187
|
+
*
|
|
188
|
+
* @default false
|
|
189
|
+
*/
|
|
190
|
+
excerpt?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Remove custom SFC block
|
|
193
|
+
*
|
|
194
|
+
* @default ['route', 'i18n']
|
|
195
|
+
*/
|
|
196
|
+
customSfcBlocks?: string[];
|
|
197
|
+
/**
|
|
198
|
+
* Options passed to [@mdit-vue/plugin-component](https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-component)
|
|
199
|
+
*/
|
|
200
|
+
componentOptions?: ComponentPluginOptions;
|
|
201
|
+
/**
|
|
202
|
+
* Options passed to [@mdit-vue/plugin-frontmatter](https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-frontmatter)
|
|
203
|
+
*/
|
|
204
|
+
frontmatterOptions?: FrontmatterPluginOptions;
|
|
205
|
+
/**
|
|
206
|
+
* Custom function to provide defaults to the frontmatter and
|
|
207
|
+
* move certain attributes into the "meta" category.
|
|
208
|
+
*
|
|
209
|
+
* Note: _overriding this will remove built-in functionality setting
|
|
210
|
+
* "meta" properties and the built-in "head" support. Do this only
|
|
211
|
+
* if you know what you're doing._
|
|
212
|
+
*/
|
|
213
|
+
frontmatterPreprocess?: (frontmatter: Frontmatter, options: ResolvedOptions, id: string, defaultHeadProcess: typeof preprocessHead) => {
|
|
214
|
+
head: Record<string, any>;
|
|
215
|
+
frontmatter: Frontmatter;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Expose frontmatter via expose API
|
|
219
|
+
*
|
|
220
|
+
* @default true
|
|
221
|
+
*/
|
|
222
|
+
exposeFrontmatter?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Expose excerpt via expose API
|
|
225
|
+
*
|
|
226
|
+
* @default false
|
|
227
|
+
*/
|
|
228
|
+
exposeExcerpt?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Export frontmatter in component module
|
|
231
|
+
*
|
|
232
|
+
* @default true
|
|
233
|
+
*/
|
|
234
|
+
exportFrontmatter?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Add `v-pre` to `<code>` tag to escape curly brackets interpolation
|
|
237
|
+
*
|
|
238
|
+
* @see https://github.com/unplugin/unplugin-vue-markdown/issues/14
|
|
239
|
+
* @default true
|
|
240
|
+
*/
|
|
241
|
+
escapeCodeTagInterpolation?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Options passed to markdown-exit
|
|
244
|
+
*/
|
|
245
|
+
markdownOptions?: MarkdownExitOptions;
|
|
246
|
+
/**
|
|
247
|
+
* Plugins for markdown-exit
|
|
248
|
+
*/
|
|
249
|
+
markdownUses?: (PluginSimple | [PluginSimple | PluginWithOptions<any>, any] | any)[];
|
|
250
|
+
/**
|
|
251
|
+
* A function providing the markdown-exit instance gets the ability to apply custom
|
|
252
|
+
* settings/plugins
|
|
253
|
+
*/
|
|
254
|
+
markdownSetup?: (md: MarkdownExit) => void | Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* @deprecated Use `markdownOptions` instead
|
|
257
|
+
*/
|
|
258
|
+
markdownItOptions?: MarkdownExitOptions;
|
|
259
|
+
/**
|
|
260
|
+
* @deprecated Use `markdownUses` instead
|
|
261
|
+
*/
|
|
262
|
+
markdownItUses?: (PluginSimple | [PluginSimple | PluginWithOptions<any>, any] | any)[];
|
|
263
|
+
/**
|
|
264
|
+
* @deprecated Use `markdownSetup` instead
|
|
265
|
+
*/
|
|
266
|
+
markdownItSetup?: (md: MarkdownExit) => void | Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Wrap the rendered html in a div
|
|
269
|
+
*
|
|
270
|
+
* @default true
|
|
271
|
+
*/
|
|
272
|
+
wrapperDiv?: boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Class names for wrapper div
|
|
275
|
+
*
|
|
276
|
+
* This option will be ignored if `wrapperDiv` is set to `false`
|
|
277
|
+
*
|
|
278
|
+
* @default 'markdown-body'
|
|
279
|
+
*/
|
|
280
|
+
wrapperClasses?: string | string[] | undefined | null | ((id: string, code: string) => string | string[] | undefined | null);
|
|
281
|
+
/**
|
|
282
|
+
* Component name to wrapper with
|
|
283
|
+
*
|
|
284
|
+
* @default undefined
|
|
285
|
+
*/
|
|
286
|
+
wrapperComponent?: string | undefined | null | ((id: string, code: string) => string | undefined | null);
|
|
287
|
+
/**
|
|
288
|
+
* Custom tranformations apply before and after the markdown transformation
|
|
289
|
+
*/
|
|
290
|
+
transforms?: {
|
|
291
|
+
before?: (code: string, id: string) => string | Promise<string>;
|
|
292
|
+
after?: (code: string, id: string) => string | Promise<string>;
|
|
293
|
+
/**
|
|
294
|
+
* Return extra code to be injected into the `<script>` tag
|
|
295
|
+
*/
|
|
296
|
+
extraScripts?: (frontmatter: Record<string, any>, id: string) => string[] | Promise<string[]>;
|
|
297
|
+
};
|
|
298
|
+
include?: FilterPattern;
|
|
299
|
+
exclude?: FilterPattern;
|
|
300
|
+
}
|
|
301
|
+
interface ResolvedOptions extends Required<Options> {}
|
|
302
|
+
interface MarkdownEnv extends MarkdownItEnv {
|
|
303
|
+
id: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
//#region src/vite.d.ts
|
|
307
|
+
declare const _default: (options: Options) => vite.Plugin<any>[] | vite.Plugin<any>;
|
|
308
|
+
|
|
29
309
|
interface ValaxyFileInfo {
|
|
30
310
|
/**
|
|
31
311
|
* file path id
|
|
@@ -102,8 +382,8 @@ interface LayoutsOptions {
|
|
|
102
382
|
fallbackLayout?: string;
|
|
103
383
|
/**
|
|
104
384
|
* `sync` bundles a layout into the main chunk, `async` lazy-loads it.
|
|
105
|
-
* Defaults to `sync` for
|
|
106
|
-
*
|
|
385
|
+
* Defaults to `sync` for `default` and `async` for the rest, including builds.
|
|
386
|
+
* Navigation guards preload the active layout before rendering or hydration.
|
|
107
387
|
*/
|
|
108
388
|
importMode: (name: string) => LayoutImportMode;
|
|
109
389
|
/**
|
|
@@ -114,35 +394,6 @@ interface LayoutsOptions {
|
|
|
114
394
|
inheritDefaultLayout: boolean;
|
|
115
395
|
}
|
|
116
396
|
|
|
117
|
-
interface MarkdownItHeader {
|
|
118
|
-
/**
|
|
119
|
-
* The level of the header
|
|
120
|
-
*
|
|
121
|
-
* `1` to `6` for `<h1>` to `<h6>`
|
|
122
|
-
*/
|
|
123
|
-
level: number;
|
|
124
|
-
/**
|
|
125
|
-
* The title of the header
|
|
126
|
-
*/
|
|
127
|
-
title: string;
|
|
128
|
-
/**
|
|
129
|
-
* The slug of the header
|
|
130
|
-
*
|
|
131
|
-
* Typically the `id` attr of the header anchor
|
|
132
|
-
*/
|
|
133
|
-
slug: string;
|
|
134
|
-
/**
|
|
135
|
-
* Link of the header
|
|
136
|
-
*
|
|
137
|
-
* Typically using `#${slug}` as the anchor hash
|
|
138
|
-
*/
|
|
139
|
-
link: string;
|
|
140
|
-
/**
|
|
141
|
-
* The children of the header
|
|
142
|
-
*/
|
|
143
|
-
children: MarkdownItHeader[];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
397
|
//#region src/types.d.ts
|
|
147
398
|
|
|
148
399
|
/**
|
|
@@ -352,7 +603,7 @@ interface TocPluginOptions {
|
|
|
352
603
|
* Keep the concrete parser behind this module so page compilation, excerpts,
|
|
353
604
|
* search, and RSS share the same async rendering semantics.
|
|
354
605
|
*/
|
|
355
|
-
type MarkdownRenderer = MarkdownExit;
|
|
606
|
+
type MarkdownRenderer = MarkdownExit$1;
|
|
356
607
|
interface MarkdownRendererOptions extends Omit<MarkdownExitOptions, 'highlight'> {
|
|
357
608
|
highlight?: ((str: string, lang: string, attrs: string) => string | Promise<string>) | null;
|
|
358
609
|
}
|
|
@@ -912,17 +1163,15 @@ interface ValaxyExtendConfig {
|
|
|
912
1163
|
/**
|
|
913
1164
|
* @valaxy
|
|
914
1165
|
* @see https://cn.vuejs.org/guide/scaling-up/tooling#note-on-in-browser-template-compilation
|
|
915
|
-
*
|
|
916
|
-
*
|
|
917
|
-
*
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
* @default true
|
|
1166
|
+
* Browser template compilation:
|
|
1167
|
+
* - 'lazy': load the compiler when rendering HTML excerpts or decrypted content.
|
|
1168
|
+
* - true: include the compiler eagerly, also supporting arbitrary Vue `template` options.
|
|
1169
|
+
* - false: disable browser compilation (HTML excerpts and decrypted templates require it).
|
|
921
1170
|
*
|
|
922
|
-
*
|
|
923
|
-
* @description
|
|
1171
|
+
* @default 'lazy'
|
|
1172
|
+
* @description 浏览器模板编译模式,默认按需加载
|
|
924
1173
|
*/
|
|
925
|
-
browserTemplateCompilation?: boolean;
|
|
1174
|
+
browserTemplateCompilation?: boolean | 'lazy';
|
|
926
1175
|
};
|
|
927
1176
|
/**
|
|
928
1177
|
* @see https://github.com/unplugin/unplugin-vue-components
|
|
@@ -992,7 +1241,7 @@ interface ValaxyExtendConfig {
|
|
|
992
1241
|
* @zh markdown 相关配置
|
|
993
1242
|
* {@link MarkdownOptions}
|
|
994
1243
|
*/
|
|
995
|
-
markdown?: MarkdownOptions & Parameters<typeof
|
|
1244
|
+
markdown?: MarkdownOptions & Parameters<typeof _default>[0];
|
|
996
1245
|
/**
|
|
997
1246
|
* @en Extend markdown, you can modify the markdown content/excerpt
|
|
998
1247
|
* @zh 扩展 markdown
|
|
@@ -1144,8 +1393,6 @@ declare const defaultSiteConfig: SiteConfig;
|
|
|
1144
1393
|
* @param config
|
|
1145
1394
|
*/
|
|
1146
1395
|
declare function defineSiteConfig(config: UserSiteConfig): PartialDeep<SiteConfig>;
|
|
1147
|
-
/** Resolve before merging defaults so explicit legacy settings stay effective. */
|
|
1148
|
-
declare function resolveFootnoteConfig(config?: UserSiteConfig): SiteConfig['footnote'];
|
|
1149
1396
|
/**
|
|
1150
1397
|
* resolve valaxy config from special root
|
|
1151
1398
|
*/
|
|
@@ -1392,5 +1639,5 @@ declare function toAtFS(path: string): string;
|
|
|
1392
1639
|
declare function resolveImportPath(importName: string, ensure?: true): Promise<string>;
|
|
1393
1640
|
declare function resolveImportPath(importName: string, ensure?: boolean): Promise<string | undefined>;
|
|
1394
1641
|
|
|
1395
|
-
export { $t, ALL_ROUTE, EXCERPT_SEPARATOR, GLOBAL_STATE, PATHNAME_PROTOCOL_RE, StateManager, ViteValaxyPlugins, build, createContentService, createMemoryReleasePlugin, createServer, createValaxyNode, createValaxyPlugin, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineContentLoader, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, encryptContent, generateClientRedirects, getGitTimestamp, getIndexHtml, getServerInfoText, isExternal, isInstalledGlobally, isKatexEnabled, isKatexPluginNeeded, isMathJaxEnabled, isPath, loadAllContent, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig,
|
|
1642
|
+
export { $t, ALL_ROUTE, EXCERPT_SEPARATOR, GLOBAL_STATE, PATHNAME_PROTOCOL_RE, StateManager, ViteValaxyPlugins, build, createContentService, createMemoryReleasePlugin, createServer, createValaxyNode, createValaxyPlugin, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineContentLoader, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, encryptContent, generateClientRedirects, getGitTimestamp, getIndexHtml, getServerInfoText, isExternal, isInstalledGlobally, isKatexEnabled, isKatexPluginNeeded, isMathJaxEnabled, isPath, loadAllContent, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig, resolveImportPath, resolveImportUrl, resolveOptions, resolveSiteConfig, resolveSiteConfigFromRoot, resolveThemeConfigFromRoot, resolveThemeValaxyConfig, resolveUserThemeConfig, resolveValaxyConfig, resolveValaxyConfigFromRoot, ssgBuild, toAtFS, transformObject, version };
|
|
1396
1643
|
export type { CdnModule, ContentCheckResult, ContentDiagnostic, ContentItem, ContentLoader, ContentLoaderContext, ContentPageInfo, ContentServiceOptions, GroupIconOptions, GroupIconValue, HookResult, LoadConfigFromFileOptions, MarkdownRenderer, MdAfterRenderContext, ResolvedConfig, ResolvedValaxyOptions, UnoSetup, UserInputConfig, UserValaxyNodeConfig, ValaxyAddonCliContext, ValaxyAddonExport, ValaxyAddonExtendCli, ValaxyAddonFn, ValaxyAddonLike, ValaxyAddonResolver, ValaxyAddons, ValaxyApp, ValaxyConfigExport, ValaxyConfigExtendKey, ValaxyConfigFn, ValaxyEntryOptions, ValaxyExtendConfig, ValaxyFileInfo, ValaxyHooks, ValaxyNode, ValaxyNodeAddon, ValaxyNodeConfig, ValaxyPickConfig, ValaxyServerOptions, ValaxyTheme };
|