valaxy 0.24.5 → 0.25.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/components/ValaxyContainerBlockTitle.vue +16 -0
- package/client/components/ValaxyCopyright.vue +3 -1
- package/client/composables/app/useValaxyApp.ts +5 -5
- package/client/composables/app/useValaxyHead.ts +4 -6
- package/client/composables/locale.ts +42 -0
- package/client/locales/en.yml +8 -0
- package/client/locales/zh-CN.yml +8 -0
- package/client/styles/components/custom-block.scss +1 -2
- package/dist/{chunk-OA6SKHSD.js → chunk-JXEHOFBR.js} +37 -45
- package/dist/node/cli/index.js +1 -1
- package/dist/node/index.d.ts +22 -21
- package/dist/node/index.js +3 -1
- package/package.json +3 -3
- package/shared/constants.ts +7 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// import { useValaxyI18n } from 'valaxy'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
title: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const { t } = useI18n()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<span>
|
|
14
|
+
{{ t(title) }}
|
|
15
|
+
</span>
|
|
16
|
+
</template>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { useValaxyI18n } from 'valaxy'
|
|
2
3
|
import { computed } from 'vue'
|
|
3
4
|
import { useI18n } from 'vue-i18n'
|
|
4
5
|
import { useSiteConfig } from '../config'
|
|
@@ -10,6 +11,7 @@ withDefaults(defineProps<{
|
|
|
10
11
|
})
|
|
11
12
|
|
|
12
13
|
const { t, locale } = useI18n()
|
|
14
|
+
const { $t } = useValaxyI18n()
|
|
13
15
|
|
|
14
16
|
const siteConfig = useSiteConfig()
|
|
15
17
|
|
|
@@ -31,7 +33,7 @@ const licenseHtml = computed(() => {
|
|
|
31
33
|
<strong>
|
|
32
34
|
{{ t('post.copyright.author') + t('symbol.colon') }}
|
|
33
35
|
</strong>
|
|
34
|
-
<span>{{ t(siteConfig.author.name) }}</span>
|
|
36
|
+
<span>{{ $t(siteConfig.author.name) }}</span>
|
|
35
37
|
</li>
|
|
36
38
|
<li v-if="url" class="post-copyright-link">
|
|
37
39
|
<strong>
|
|
@@ -5,8 +5,7 @@ import { useSeoMeta } from '@unhead/vue'
|
|
|
5
5
|
import { computed } from 'vue'
|
|
6
6
|
import { useI18n } from 'vue-i18n'
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { useFrontmatter, useValaxyHead } from '../../composables'
|
|
8
|
+
import { useFrontmatter, useValaxyHead, useValaxyI18n } from '../../composables'
|
|
10
9
|
|
|
11
10
|
import { useTimezone } from '../../composables/global'
|
|
12
11
|
// https://github.com/vueuse/head
|
|
@@ -20,8 +19,9 @@ export function useValaxyApp() {
|
|
|
20
19
|
const fm = useFrontmatter()
|
|
21
20
|
|
|
22
21
|
const { locale } = useI18n()
|
|
22
|
+
const { $t, $tO } = useValaxyI18n()
|
|
23
23
|
|
|
24
|
-
const title = computed(() =>
|
|
24
|
+
const title = computed(() => $tO(fm.value.title))
|
|
25
25
|
|
|
26
26
|
// seo
|
|
27
27
|
// todo: get first image url from markdown
|
|
@@ -34,7 +34,7 @@ export function useValaxyApp() {
|
|
|
34
34
|
ogLocale: computed(() => locale.value || fm.value.lang || siteConfig.value.lang || 'en'),
|
|
35
35
|
ogLocaleAlternate: computed(() => siteConfig.value.languages.filter(l => l !== locale.value)),
|
|
36
36
|
ogSiteName: computed(() => siteConfig.value.title),
|
|
37
|
-
ogTitle: computed(() =>
|
|
37
|
+
ogTitle: computed(() => $tO(fm.value.title || siteConfig.value.title)),
|
|
38
38
|
ogImage: computed(() => fm.value.ogImage || fm.value.cover || siteConfig.value.favicon),
|
|
39
39
|
ogType: 'website',
|
|
40
40
|
ogUrl: siteUrl,
|
|
@@ -45,7 +45,7 @@ export function useValaxyApp() {
|
|
|
45
45
|
// https://unhead.unjs.io/docs/schema-org/guides/recipes/identity
|
|
46
46
|
// Personal Website or Blog
|
|
47
47
|
definePerson({
|
|
48
|
-
name: siteConfig.value.author.name,
|
|
48
|
+
name: $t(siteConfig.value.author.name),
|
|
49
49
|
url: siteUrl.value,
|
|
50
50
|
image: siteConfig.value.author.avatar,
|
|
51
51
|
sameAs: siteConfig.value.social.map(s => s.link),
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { useHead } from '@unhead/vue'
|
|
2
2
|
import pkg from 'valaxy/package.json'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
4
|
|
|
6
|
-
import { useFrontmatter } from '../../composables'
|
|
5
|
+
import { useFrontmatter, useValaxyI18n } from '../../composables'
|
|
7
6
|
import { useSiteConfig } from '../../config'
|
|
8
|
-
import { tObject } from '../../utils'
|
|
9
7
|
|
|
10
8
|
export function useValaxyHead() {
|
|
11
|
-
const {
|
|
9
|
+
const { $t, $tO } = useValaxyI18n()
|
|
12
10
|
|
|
13
11
|
const fm = useFrontmatter()
|
|
14
12
|
const siteConfig = useSiteConfig()
|
|
15
|
-
const $title = computed(() =>
|
|
13
|
+
const $title = computed(() => $tO(fm.value.title))
|
|
16
14
|
|
|
17
15
|
useHead({
|
|
18
16
|
title: $title,
|
|
19
17
|
titleTemplate: (title) => {
|
|
20
|
-
const siteTitle = t(siteConfig.value.title)
|
|
18
|
+
const siteTitle = $t(siteConfig.value.title)
|
|
21
19
|
return fm.value.titleTemplate || (title ? `${title} - ${siteTitle}` : siteTitle)
|
|
22
20
|
},
|
|
23
21
|
link: [
|
|
@@ -6,6 +6,7 @@ import { computed } from 'vue'
|
|
|
6
6
|
// not optimize deps all locales
|
|
7
7
|
import { useI18n } from 'vue-i18n'
|
|
8
8
|
import { tObject } from '../../shared/utils/i18n'
|
|
9
|
+
import { LOCALE_PREFIX } from '../utils'
|
|
9
10
|
import 'dayjs/locale/en'
|
|
10
11
|
import 'dayjs/locale/zh-cn'
|
|
11
12
|
|
|
@@ -63,3 +64,44 @@ export function useLocaleTitle(fm: Ref<{
|
|
|
63
64
|
return tObject(fm.value.title || '', lang) || ''
|
|
64
65
|
})
|
|
65
66
|
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @experimental
|
|
70
|
+
* 以 `$locale:` 开头的 key 会被认为是国际化的 key
|
|
71
|
+
* 会从 locales/ 目录中获取对应的翻译
|
|
72
|
+
*/
|
|
73
|
+
export function useValaxyI18n() {
|
|
74
|
+
const { t, locale } = useI18n()
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* translate `$locale:key`
|
|
78
|
+
* @param key
|
|
79
|
+
*/
|
|
80
|
+
const $t = (key: string) => {
|
|
81
|
+
if (key.startsWith(LOCALE_PREFIX)) {
|
|
82
|
+
return t(key.slice(LOCALE_PREFIX.length))
|
|
83
|
+
}
|
|
84
|
+
return key
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* translate object
|
|
89
|
+
*
|
|
90
|
+
* {
|
|
91
|
+
* "zh-CN": "你好",
|
|
92
|
+
* "en": "Hello"
|
|
93
|
+
* }
|
|
94
|
+
*/
|
|
95
|
+
const $tO = (data?: string | Record<string, string>) => {
|
|
96
|
+
return tObject(data || '', locale.value)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
locale,
|
|
101
|
+
/**
|
|
102
|
+
* vue-i18n t function
|
|
103
|
+
*/
|
|
104
|
+
$t,
|
|
105
|
+
$tO,
|
|
106
|
+
}
|
|
107
|
+
}
|
package/client/locales/en.yml
CHANGED
|
@@ -25,6 +25,7 @@ menu:
|
|
|
25
25
|
archives: Archives
|
|
26
26
|
categories: Categories
|
|
27
27
|
tags: Tags
|
|
28
|
+
posts: Posts
|
|
28
29
|
about: About
|
|
29
30
|
search: Search
|
|
30
31
|
|
|
@@ -110,3 +111,10 @@ time:
|
|
|
110
111
|
|
|
111
112
|
tooltip:
|
|
112
113
|
last_updated: Last updated
|
|
114
|
+
|
|
115
|
+
blocks:
|
|
116
|
+
tip: TIP
|
|
117
|
+
warning: WARNING
|
|
118
|
+
danger: DANGER
|
|
119
|
+
info: INFO
|
|
120
|
+
details: DETAILS
|
package/client/locales/zh-CN.yml
CHANGED
|
@@ -25,6 +25,7 @@ menu:
|
|
|
25
25
|
archives: 归档
|
|
26
26
|
categories: 分类
|
|
27
27
|
tags: 标签
|
|
28
|
+
posts: 博客文章
|
|
28
29
|
about: 关于
|
|
29
30
|
search: 搜索
|
|
30
31
|
|
|
@@ -109,3 +110,10 @@ time:
|
|
|
109
110
|
|
|
110
111
|
tooltip:
|
|
111
112
|
last_updated: 最后更新于
|
|
113
|
+
|
|
114
|
+
blocks:
|
|
115
|
+
tip: 提示
|
|
116
|
+
warning: 注意
|
|
117
|
+
danger: 警告
|
|
118
|
+
info: 信息
|
|
119
|
+
details: 详情
|
|
@@ -4,7 +4,7 @@ import yargs from "yargs";
|
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "0.
|
|
7
|
+
var version = "0.25.1";
|
|
8
8
|
|
|
9
9
|
// node/modules/fuse.ts
|
|
10
10
|
import path4 from "path";
|
|
@@ -537,6 +537,11 @@ function transformObject(obj) {
|
|
|
537
537
|
return `JSON.parse(${JSON.stringify(JSON.stringify(obj))})`;
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
+
// node/utils/i18n.ts
|
|
541
|
+
function $t(key) {
|
|
542
|
+
return `$locale:${key}`;
|
|
543
|
+
}
|
|
544
|
+
|
|
540
545
|
// node/utils/resolve.ts
|
|
541
546
|
import { ensurePrefix, slash } from "@antfu/utils";
|
|
542
547
|
import { consola as consola6 } from "consola";
|
|
@@ -2050,12 +2055,13 @@ function preWrapperPlugin(md3, options) {
|
|
|
2050
2055
|
const lang = extractLang(token.info);
|
|
2051
2056
|
const rawCode = fence(...args);
|
|
2052
2057
|
const codeHeightLimitClass = getCodeHeightLimitStyle(options, env);
|
|
2053
|
-
return `<div class="language-${lang}${active}${codeHeightLimitClass}"><button title="${options.codeCopyButtonTitle}" class="copy"></button><span class="lang">${lang}</span>${rawCode}<button class="collapse"></button></div>`;
|
|
2058
|
+
return `<div class="language-${lang}${active}${codeHeightLimitClass}"><button title="${options.codeCopyButtonTitle || "Copy code"}" class="copy"></button><span class="lang">${lang}</span>${rawCode}<button class="collapse"></button></div>`;
|
|
2054
2059
|
};
|
|
2055
2060
|
}
|
|
2056
2061
|
|
|
2057
2062
|
// node/plugins/markdown/plugins/markdown-it/container.ts
|
|
2058
|
-
function createContainer(
|
|
2063
|
+
function createContainer(key, block = {}, md3) {
|
|
2064
|
+
const classes = key;
|
|
2059
2065
|
return [
|
|
2060
2066
|
container,
|
|
2061
2067
|
classes,
|
|
@@ -2067,15 +2073,9 @@ function createContainer(classes, { icon, color, text: defaultTitle, langs } = {
|
|
|
2067
2073
|
const attrs = md3.renderer.renderAttrs(token);
|
|
2068
2074
|
const info = token.info.trim().slice(classes.length).trim();
|
|
2069
2075
|
let iconTag = "";
|
|
2070
|
-
if (icon)
|
|
2071
|
-
iconTag = `<i class="icon ${icon}" ${color ? `style="color: ${color}"` : ""}></i>`;
|
|
2072
|
-
|
|
2073
|
-
if (langs) {
|
|
2074
|
-
Object.keys(langs).forEach((lang) => {
|
|
2075
|
-
titleWithLang += `<span lang="${lang}">${info || langs[lang]}</span>`;
|
|
2076
|
-
});
|
|
2077
|
-
}
|
|
2078
|
-
const title = md3.renderInline(titleWithLang, {});
|
|
2076
|
+
if (block.icon)
|
|
2077
|
+
iconTag = `<i class="icon ${block.icon}" ${block.color ? `style="color: ${block.color}"` : ""}></i>`;
|
|
2078
|
+
const title = `<ValaxyContainerBlockTitle title="blocks.${key}" />`;
|
|
2079
2079
|
const titleClass = `custom-block-title${info ? "" : " custom-block-title-default"}`;
|
|
2080
2080
|
if (classes === "details")
|
|
2081
2081
|
return `<details ${attrs}><summary>${title}</summary>
|
|
@@ -2091,43 +2091,27 @@ function createContainer(classes, { icon, color, text: defaultTitle, langs } = {
|
|
|
2091
2091
|
}
|
|
2092
2092
|
var defaultBlocksOptions = {
|
|
2093
2093
|
tip: {
|
|
2094
|
-
text: "TIP"
|
|
2095
|
-
langs: {
|
|
2096
|
-
"zh-CN": "\u63D0\u793A"
|
|
2097
|
-
}
|
|
2094
|
+
text: "TIP"
|
|
2098
2095
|
},
|
|
2099
2096
|
warning: {
|
|
2100
|
-
text: "WARNING"
|
|
2101
|
-
langs: {
|
|
2102
|
-
"zh-CN": "\u6CE8\u610F"
|
|
2103
|
-
}
|
|
2097
|
+
text: "WARNING"
|
|
2104
2098
|
},
|
|
2105
2099
|
danger: {
|
|
2106
|
-
text: "DANGER"
|
|
2107
|
-
langs: {
|
|
2108
|
-
"zh-CN": "\u8B66\u544A"
|
|
2109
|
-
}
|
|
2100
|
+
text: "DANGER"
|
|
2110
2101
|
},
|
|
2111
2102
|
info: {
|
|
2112
|
-
text: "INFO"
|
|
2113
|
-
langs: {
|
|
2114
|
-
"zh-CN": "\u4FE1\u606F"
|
|
2115
|
-
}
|
|
2103
|
+
text: "INFO"
|
|
2116
2104
|
},
|
|
2117
2105
|
details: {
|
|
2118
|
-
text: "Details"
|
|
2119
|
-
langs: {
|
|
2120
|
-
"zh-CN": "\u8BE6\u60C5"
|
|
2121
|
-
}
|
|
2106
|
+
text: "Details"
|
|
2122
2107
|
}
|
|
2123
2108
|
};
|
|
2124
2109
|
function containerPlugin(md3, containerOptions = {}) {
|
|
2125
|
-
const blockKeys = new Set(Object.keys(Object.assign(defaultBlocksOptions, containerOptions)));
|
|
2110
|
+
const blockKeys = new Set(Object.keys(Object.assign({}, defaultBlocksOptions, containerOptions.blocks)));
|
|
2126
2111
|
blockKeys.forEach((optionKey) => {
|
|
2127
|
-
const
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
};
|
|
2112
|
+
const key = optionKey;
|
|
2113
|
+
const userOption = containerOptions.blocks?.[key] || {};
|
|
2114
|
+
const option = Object.assign({}, defaultBlocksOptions[key], userOption);
|
|
2131
2115
|
md3.use(...createContainer(optionKey, option, md3));
|
|
2132
2116
|
});
|
|
2133
2117
|
md3.use(container, "v-pre", {
|
|
@@ -2140,7 +2124,7 @@ function containerPlugin(md3, containerOptions = {}) {
|
|
|
2140
2124
|
` : `</div>
|
|
2141
2125
|
`
|
|
2142
2126
|
});
|
|
2143
|
-
const languages = ["zh-CN", "en"];
|
|
2127
|
+
const languages = containerOptions.languages || ["zh-CN", "en"];
|
|
2144
2128
|
languages.forEach((lang) => {
|
|
2145
2129
|
md3.use(container, lang, {
|
|
2146
2130
|
render: (tokens, idx) => tokens[idx].nesting === 1 ? `<div lang="${lang}">
|
|
@@ -2556,8 +2540,12 @@ async function setupMarkdownPlugins(md3, options, base = "/") {
|
|
|
2556
2540
|
if (mdOptions.preConfig)
|
|
2557
2541
|
mdOptions.preConfig(md3);
|
|
2558
2542
|
md3.use(highlightLinePlugin).use(preWrapperPlugin, { theme, siteConfig }).use(snippetPlugin, options?.userRoot).use(containerPlugin, {
|
|
2559
|
-
|
|
2560
|
-
...mdOptions?.container
|
|
2543
|
+
languages: siteConfig.languages,
|
|
2544
|
+
...mdOptions?.container,
|
|
2545
|
+
blocks: {
|
|
2546
|
+
...mdOptions.blocks,
|
|
2547
|
+
...mdOptions.container?.blocks
|
|
2548
|
+
}
|
|
2561
2549
|
}).use(cssI18nContainer, {
|
|
2562
2550
|
languages: options?.config.siteConfig.languages
|
|
2563
2551
|
}).use(
|
|
@@ -3089,7 +3077,7 @@ var templateConfig = {
|
|
|
3089
3077
|
import fs16 from "fs-extra";
|
|
3090
3078
|
var templateLocales = {
|
|
3091
3079
|
id: "/@valaxyjs/locales",
|
|
3092
|
-
async getContent({ roots }) {
|
|
3080
|
+
async getContent({ roots, config }) {
|
|
3093
3081
|
const imports = [
|
|
3094
3082
|
'import { createDefu } from "defu"',
|
|
3095
3083
|
'const messages = { "zh-CN": {}, en: {} }',
|
|
@@ -3102,7 +3090,7 @@ var templateLocales = {
|
|
|
3102
3090
|
})
|
|
3103
3091
|
`
|
|
3104
3092
|
];
|
|
3105
|
-
const languages = ["zh-CN", "en"];
|
|
3093
|
+
const languages = config.siteConfig.languages || ["zh-CN", "en"];
|
|
3106
3094
|
roots.forEach((root, i) => {
|
|
3107
3095
|
languages.forEach((lang) => {
|
|
3108
3096
|
const langYml = `${root}/locales/${lang}.yml`;
|
|
@@ -4064,7 +4052,7 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
|
|
|
4064
4052
|
console.log();
|
|
4065
4053
|
}
|
|
4066
4054
|
}
|
|
4067
|
-
const
|
|
4055
|
+
const builtinCustomIcon = {
|
|
4068
4056
|
nodejs: "vscode-icons:file-type-node",
|
|
4069
4057
|
playwright: "vscode-icons:file-type-playwright",
|
|
4070
4058
|
typedoc: "vscode-icons:file-type-typedoc",
|
|
@@ -4072,10 +4060,13 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
|
|
|
4072
4060
|
};
|
|
4073
4061
|
plugins.push(
|
|
4074
4062
|
groupIconVitePlugin({
|
|
4075
|
-
customIcon
|
|
4076
|
-
|
|
4063
|
+
customIcon: {
|
|
4064
|
+
...builtinCustomIcon,
|
|
4065
|
+
...valaxyConfig.groupIcons?.customIcon
|
|
4066
|
+
},
|
|
4077
4067
|
defaultLabels: [
|
|
4078
4068
|
...valaxyConfig.groupIcons?.defaultLabels || [],
|
|
4069
|
+
...Object.keys(builtinCustomIcon),
|
|
4079
4070
|
...Object.keys(valaxyConfig.groupIcons?.customIcon || {})
|
|
4080
4071
|
]
|
|
4081
4072
|
})
|
|
@@ -4809,6 +4800,7 @@ export {
|
|
|
4809
4800
|
isExternal,
|
|
4810
4801
|
isPath,
|
|
4811
4802
|
transformObject,
|
|
4803
|
+
$t,
|
|
4812
4804
|
isInstalledGlobally,
|
|
4813
4805
|
resolveImportUrl,
|
|
4814
4806
|
toAtFS,
|
package/dist/node/cli/index.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { ViteSSGOptions } from 'vite-ssg';
|
|
|
2
2
|
import * as vite from 'vite';
|
|
3
3
|
import { UserConfig, InlineConfig, PluginOption, Plugin } from 'vite';
|
|
4
4
|
import { MarkdownEnv } from 'unplugin-vue-markdown/types';
|
|
5
|
-
import {
|
|
5
|
+
import { D as DefaultTheme, V as ValaxyConfig, a as ValaxyAddon, P as PartialDeep, R as RuntimeConfig, b as RedirectItem, S as SiteConfig, U as UserSiteConfig } from '../config-DHcACRUt.js';
|
|
6
6
|
import Vue from '@vitejs/plugin-vue';
|
|
7
|
-
import { Options as Options$
|
|
7
|
+
import { Options as Options$2 } from 'beasties';
|
|
8
8
|
import { Hookable } from 'hookable';
|
|
9
9
|
import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
|
|
10
10
|
import { presetUno, presetAttributify, presetIcons, presetTypography } from 'unocss';
|
|
@@ -14,14 +14,14 @@ import Markdown from 'unplugin-vue-markdown/vite';
|
|
|
14
14
|
import { EditableTreeNode } from 'unplugin-vue-router';
|
|
15
15
|
import Router from 'unplugin-vue-router/vite';
|
|
16
16
|
import Layouts from 'vite-plugin-vue-layouts';
|
|
17
|
-
import { Options as Options$
|
|
17
|
+
import { Options as Options$1 } from 'vitepress-plugin-group-icons';
|
|
18
18
|
import { HeadersPluginOptions } from '@mdit-vue/plugin-headers';
|
|
19
19
|
import { SfcPluginOptions } from '@mdit-vue/plugin-sfc';
|
|
20
20
|
import { TocPluginOptions } from '@mdit-vue/plugin-toc';
|
|
21
21
|
import { KatexOptions } from 'katex';
|
|
22
22
|
import MarkdownIt from 'markdown-it';
|
|
23
23
|
import anchorPlugin from 'markdown-it-anchor';
|
|
24
|
-
import { Options
|
|
24
|
+
import { Options, MarkdownItAsync } from 'markdown-it-async';
|
|
25
25
|
import { ThemeRegistration, BuiltinTheme, LanguageInput, ShikiTransformer, Highlighter } from 'shiki';
|
|
26
26
|
export { cli, registerDevCommand, run, startValaxyDev } from './cli/index.js';
|
|
27
27
|
import { Awaitable } from '@antfu/utils';
|
|
@@ -46,22 +46,10 @@ declare module 'vite' {
|
|
|
46
46
|
*/
|
|
47
47
|
declare function createValaxyNode(options: ResolvedValaxyOptions): ValaxyNode;
|
|
48
48
|
|
|
49
|
-
interface Options {
|
|
50
|
-
codeCopyButtonTitle: string;
|
|
51
|
-
theme: ThemeOptions;
|
|
52
|
-
siteConfig?: SiteConfig;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
49
|
interface BlockItem {
|
|
56
50
|
text?: string;
|
|
57
51
|
icon?: string;
|
|
58
52
|
color?: string;
|
|
59
|
-
/**
|
|
60
|
-
* for i18n
|
|
61
|
-
*/
|
|
62
|
-
langs?: {
|
|
63
|
-
[key: string]: string;
|
|
64
|
-
};
|
|
65
53
|
}
|
|
66
54
|
interface Blocks {
|
|
67
55
|
tip?: BlockItem;
|
|
@@ -70,7 +58,10 @@ interface Blocks {
|
|
|
70
58
|
info?: BlockItem;
|
|
71
59
|
details?: BlockItem;
|
|
72
60
|
}
|
|
73
|
-
|
|
61
|
+
interface ContainerOptions {
|
|
62
|
+
blocks?: Blocks;
|
|
63
|
+
languages?: string[];
|
|
64
|
+
}
|
|
74
65
|
|
|
75
66
|
type ThemeOptions = ThemeRegistration | BuiltinTheme | {
|
|
76
67
|
light: ThemeRegistration | BuiltinTheme;
|
|
@@ -80,7 +71,7 @@ type ThemeOptions = ThemeRegistration | BuiltinTheme | {
|
|
|
80
71
|
* Extend Markdown options
|
|
81
72
|
* @zh 扩展 Markdown 配置,包含代码高亮、Markdown-it 和插件配置
|
|
82
73
|
*/
|
|
83
|
-
interface MarkdownOptions extends Options
|
|
74
|
+
interface MarkdownOptions extends Options {
|
|
84
75
|
/**
|
|
85
76
|
* Setup markdown-it instance before applying plugins
|
|
86
77
|
*/
|
|
@@ -313,7 +304,7 @@ interface ValaxyExtendConfig {
|
|
|
313
304
|
/**
|
|
314
305
|
* @see https://github.com/yuyinws/vitepress-plugin-group-icons
|
|
315
306
|
*/
|
|
316
|
-
groupIcons?: Partial<Options$
|
|
307
|
+
groupIcons?: Partial<Options$1>;
|
|
317
308
|
/**
|
|
318
309
|
* unocss presets
|
|
319
310
|
* @see https://unocss.dev/guide/presets
|
|
@@ -386,7 +377,7 @@ interface ValaxyExtendConfig {
|
|
|
386
377
|
* beastiesOptions
|
|
387
378
|
* @see https://github.com/danielroe/beasties
|
|
388
379
|
*/
|
|
389
|
-
beastiesOptions?: Options$
|
|
380
|
+
beastiesOptions?: Options$2;
|
|
390
381
|
}
|
|
391
382
|
type ValaxyAddonLike = ValaxyAddon | false | null | undefined;
|
|
392
383
|
type ValaxyAddons = (ValaxyAddon | string)[] | Record<string, ValaxyAddonLike>;
|
|
@@ -653,6 +644,16 @@ declare function isPath(name: string): boolean;
|
|
|
653
644
|
*/
|
|
654
645
|
declare function transformObject(obj: any): string;
|
|
655
646
|
|
|
647
|
+
/**
|
|
648
|
+
* @experimental 试验性
|
|
649
|
+
* @see https://github.com/YunYouJun/valaxy/issues/566
|
|
650
|
+
* @param key
|
|
651
|
+
*
|
|
652
|
+
* 声明这是一个使用国际化的 key
|
|
653
|
+
* 从 locales/ 目录中获取对应的翻译
|
|
654
|
+
*/
|
|
655
|
+
declare function $t(key: string): string;
|
|
656
|
+
|
|
656
657
|
declare const isInstalledGlobally: {
|
|
657
658
|
value?: boolean;
|
|
658
659
|
};
|
|
@@ -668,4 +669,4 @@ declare function toAtFS(path: string): string;
|
|
|
668
669
|
declare function resolveImportPath(importName: string, ensure?: true): Promise<string>;
|
|
669
670
|
declare function resolveImportPath(importName: string, ensure?: boolean): Promise<string | undefined>;
|
|
670
671
|
|
|
671
|
-
export { ALL_ROUTE, EXCERPT_SEPARATOR, type HookResult, type LoadConfigFromFileOptions, PATHNAME_PROTOCOL_RE, type ResolvedConfig, type ResolvedValaxyOptions, type UnoSetup, type UserInputConfig, type UserValaxyNodeConfig, type ValaxyAddonExport, type ValaxyAddonFn, type ValaxyAddonLike, type ValaxyAddonResolver, type ValaxyAddons, type ValaxyApp, type ValaxyConfigExport, type ValaxyConfigExtendKey, type ValaxyConfigFn, type ValaxyEntryOptions, type ValaxyExtendConfig, type ValaxyHooks, type ValaxyNode, type ValaxyNodeConfig, type ValaxyPickConfig, type ValaxyServerOptions, type ValaxyTheme, ViteValaxyPlugins, build, createServer, createValaxyPlugin, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, generateClientRedirects, getGitTimestamp, getIndexHtml, getServerInfoText, isExternal, isInstalledGlobally, isPath, loadConfig, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig, resolveImportPath, resolveImportUrl, resolveOptions, resolveSiteConfig, resolveSiteConfigFromRoot, resolveThemeConfigFromRoot, resolveThemeValaxyConfig, resolveUserThemeConfig, resolveValaxyConfig, resolveValaxyConfigFromRoot, ssgBuild, toAtFS, transformObject };
|
|
672
|
+
export { $t, ALL_ROUTE, EXCERPT_SEPARATOR, type HookResult, type LoadConfigFromFileOptions, PATHNAME_PROTOCOL_RE, type ResolvedConfig, type ResolvedValaxyOptions, type UnoSetup, type UserInputConfig, type UserValaxyNodeConfig, type ValaxyAddonExport, type ValaxyAddonFn, type ValaxyAddonLike, type ValaxyAddonResolver, type ValaxyAddons, type ValaxyApp, type ValaxyConfigExport, type ValaxyConfigExtendKey, type ValaxyConfigFn, type ValaxyEntryOptions, type ValaxyExtendConfig, type ValaxyHooks, type ValaxyNode, type ValaxyNodeConfig, type ValaxyPickConfig, type ValaxyServerOptions, type ValaxyTheme, ViteValaxyPlugins, build, createServer, createValaxyPlugin, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, generateClientRedirects, getGitTimestamp, getIndexHtml, getServerInfoText, isExternal, isInstalledGlobally, isPath, loadConfig, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig, resolveImportPath, resolveImportUrl, resolveOptions, resolveSiteConfig, resolveSiteConfigFromRoot, resolveThemeConfigFromRoot, resolveThemeValaxyConfig, resolveUserThemeConfig, resolveValaxyConfig, resolveValaxyConfigFromRoot, ssgBuild, toAtFS, transformObject };
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
$t,
|
|
2
3
|
ALL_ROUTE,
|
|
3
4
|
EXCERPT_SEPARATOR,
|
|
4
5
|
PATHNAME_PROTOCOL_RE,
|
|
@@ -49,8 +50,9 @@ import {
|
|
|
49
50
|
startValaxyDev,
|
|
50
51
|
toAtFS,
|
|
51
52
|
transformObject
|
|
52
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-JXEHOFBR.js";
|
|
53
54
|
export {
|
|
55
|
+
$t,
|
|
54
56
|
ALL_ROUTE,
|
|
55
57
|
EXCERPT_SEPARATOR,
|
|
56
58
|
PATHNAME_PROTOCOL_RE,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.1",
|
|
5
5
|
"description": "📄 Vite & Vue powered static blog generator.",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "me@yunyoujun.cn",
|
|
@@ -132,8 +132,8 @@
|
|
|
132
132
|
"vue-i18n": "^11.1.9",
|
|
133
133
|
"vue-router": "^4.5.1",
|
|
134
134
|
"yargs": "^18.0.0",
|
|
135
|
-
"@valaxyjs/devtools": "0.
|
|
136
|
-
"@valaxyjs/utils": "0.
|
|
135
|
+
"@valaxyjs/devtools": "0.25.1",
|
|
136
|
+
"@valaxyjs/utils": "0.25.1"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": {
|
|
139
139
|
"@mdit-vue/plugin-component": "^2.1.4",
|