valaxy 0.21.1 → 0.22.2-beta.5
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 → valaxy.js} +1 -1
- package/client/composables/common.ts +37 -0
- package/client/composables/global.ts +4 -4
- package/client/composables/locale.ts +8 -5
- package/client/composables/outline/anchor.ts +4 -2
- package/client/main.ts +9 -5
- package/client/templates/loader.vue +10 -0
- package/client/utils/time.ts +21 -55
- package/dist/chunk-ACYXZDCP.js +2 -0
- package/dist/{chunk-KQEK3EI2.mjs → chunk-BKO6YTFK.js} +1 -1
- package/dist/chunk-ESOXDAAD.js +158 -0
- package/dist/node/cli/index.d.ts +12 -2
- package/dist/node/cli/index.js +2 -0
- package/dist/node/index.d.ts +8 -2
- package/dist/node/index.js +2 -0
- package/dist/node/worker_shikiResolveLang.d.ts +10 -0
- package/dist/node/worker_shikiResolveLang.js +2 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/{index.mjs → index.js} +1 -1
- package/package.json +16 -23
- package/types/data.ts +5 -1
- package/bin/valaxy.cjs +0 -10
- package/dist/chunk-QBQ5XWB7.cjs +0 -1
- package/dist/chunk-TWPNJIK4.cjs +0 -161
- package/dist/chunk-WZQPPSXL.mjs +0 -162
- package/dist/config-Dxu7i2Zs.d.cts +0 -741
- package/dist/node/cli/index.cjs +0 -1
- package/dist/node/cli/index.d.cts +0 -6
- package/dist/node/cli/index.mjs +0 -2
- package/dist/node/index.cjs +0 -1
- package/dist/node/index.d.cts +0 -649
- package/dist/node/index.mjs +0 -2
- package/dist/types/index.cjs +0 -1
- package/dist/types/index.d.cts +0 -31
package/dist/node/cli/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTWPNJIK4cjs = require('../../chunk-TWPNJIK4.cjs');require('../../chunk-QBQ5XWB7.cjs');exports.cli = _chunkTWPNJIK4cjs.V; exports.run = _chunkTWPNJIK4cjs.W;
|
package/dist/node/cli/index.mjs
DELETED
package/dist/node/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTWPNJIK4cjs = require('../chunk-TWPNJIK4.cjs');require('../chunk-QBQ5XWB7.cjs');exports.ALL_ROUTE = _chunkTWPNJIK4cjs.d; exports.EXCERPT_SEPARATOR = _chunkTWPNJIK4cjs.a; exports.EXTERNAL_URL_RE = _chunkTWPNJIK4cjs.b; exports.PATHNAME_PROTOCOL_RE = _chunkTWPNJIK4cjs.c; exports.ViteValaxyPlugins = _chunkTWPNJIK4cjs.P; exports.build = _chunkTWPNJIK4cjs.Q; exports.cli = _chunkTWPNJIK4cjs.V; exports.createServer = _chunkTWPNJIK4cjs.U; exports.createValaxyLoader = _chunkTWPNJIK4cjs.O; exports.customElements = _chunkTWPNJIK4cjs.e; exports.defaultSiteConfig = _chunkTWPNJIK4cjs.t; exports.defaultValaxyConfig = _chunkTWPNJIK4cjs.x; exports.defaultViteConfig = _chunkTWPNJIK4cjs.f; exports.defineAddon = _chunkTWPNJIK4cjs.E; exports.defineConfig = _chunkTWPNJIK4cjs.z; exports.defineSiteConfig = _chunkTWPNJIK4cjs.u; exports.defineTheme = _chunkTWPNJIK4cjs.J; exports.defineUnoSetup = _chunkTWPNJIK4cjs.K; exports.defineValaxyAddon = _chunkTWPNJIK4cjs.D; exports.defineValaxyConfig = _chunkTWPNJIK4cjs.y; exports.defineValaxyTheme = _chunkTWPNJIK4cjs.I; exports.ensurePrefix = _chunkTWPNJIK4cjs.j; exports.generateClientRedirects = _chunkTWPNJIK4cjs.T; exports.getGitTimestamp = _chunkTWPNJIK4cjs.g; exports.getIndexHtml = _chunkTWPNJIK4cjs.q; exports.isExternal = _chunkTWPNJIK4cjs.h; exports.isInstalledGlobally = _chunkTWPNJIK4cjs.n; exports.isPath = _chunkTWPNJIK4cjs.l; exports.loadConfig = _chunkTWPNJIK4cjs.r; exports.loadConfigFromFile = _chunkTWPNJIK4cjs.s; exports.mergeValaxyConfig = _chunkTWPNJIK4cjs.B; exports.mergeViteConfigs = _chunkTWPNJIK4cjs.p; exports.postProcessForSSG = _chunkTWPNJIK4cjs.S; exports.processValaxyOptions = _chunkTWPNJIK4cjs.L; exports.resolveAddonsConfig = _chunkTWPNJIK4cjs.F; exports.resolveImportPath = _chunkTWPNJIK4cjs.o; exports.resolveOptions = _chunkTWPNJIK4cjs.M; exports.resolveSiteConfig = _chunkTWPNJIK4cjs.w; exports.resolveSiteConfigFromRoot = _chunkTWPNJIK4cjs.v; exports.resolveThemeConfigFromRoot = _chunkTWPNJIK4cjs.G; exports.resolveThemeValaxyConfig = _chunkTWPNJIK4cjs.N; exports.resolveUserThemeConfig = _chunkTWPNJIK4cjs.H; exports.resolveValaxyConfig = _chunkTWPNJIK4cjs.C; exports.resolveValaxyConfigFromRoot = _chunkTWPNJIK4cjs.A; exports.run = _chunkTWPNJIK4cjs.W; exports.slash = _chunkTWPNJIK4cjs.i; exports.ssgBuild = _chunkTWPNJIK4cjs.R; exports.toAtFS = _chunkTWPNJIK4cjs.k; exports.transformObject = _chunkTWPNJIK4cjs.m;
|
package/dist/node/index.d.cts
DELETED
|
@@ -1,649 +0,0 @@
|
|
|
1
|
-
import { ViteSSGOptions } from 'vite-ssg';
|
|
2
|
-
import * as vite from 'vite';
|
|
3
|
-
import { UserConfig, InlineConfig, PluginOption, Plugin } from 'vite';
|
|
4
|
-
import { MarkdownEnv } from 'unplugin-vue-markdown/types';
|
|
5
|
-
import * as valaxy_types from 'valaxy/types';
|
|
6
|
-
import { SiteConfig, DefaultTheme, ValaxyConfig, PartialDeep, ValaxyAddon, RuntimeConfig, RedirectItem, UserSiteConfig } from 'valaxy/types';
|
|
7
|
-
import Vue from '@vitejs/plugin-vue';
|
|
8
|
-
import { Hookable } from 'hookable';
|
|
9
|
-
import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
|
|
10
|
-
import { presetUno, presetAttributify, presetIcons, presetTypography } from 'unocss';
|
|
11
|
-
import { VitePluginConfig } from 'unocss/vite';
|
|
12
|
-
import Components from 'unplugin-vue-components/vite';
|
|
13
|
-
import Markdown from 'unplugin-vue-markdown/vite';
|
|
14
|
-
import { EditableTreeNode } from 'unplugin-vue-router';
|
|
15
|
-
import Router from 'unplugin-vue-router/vite';
|
|
16
|
-
import Layouts from 'vite-plugin-vue-layouts';
|
|
17
|
-
import { HeadersPluginOptions } from '@mdit-vue/plugin-headers';
|
|
18
|
-
import { SfcPluginOptions } from '@mdit-vue/plugin-sfc';
|
|
19
|
-
import { TocPluginOptions } from '@mdit-vue/plugin-toc';
|
|
20
|
-
import { KatexOptions } from 'katex';
|
|
21
|
-
import MarkdownIt from 'markdown-it';
|
|
22
|
-
import anchorPlugin from 'markdown-it-anchor';
|
|
23
|
-
import { LanguageInput, ShikiTransformer, Highlighter, ThemeRegistration, BuiltinTheme } from 'shiki';
|
|
24
|
-
export { cli, run } from './cli/index.cjs';
|
|
25
|
-
import { Awaitable } from '@antfu/utils';
|
|
26
|
-
import * as defu from 'defu';
|
|
27
|
-
import { P as PartialDeep$1 } from '../config-Dxu7i2Zs.cjs';
|
|
28
|
-
import 'yargs';
|
|
29
|
-
import '@vueuse/integrations/useFuse';
|
|
30
|
-
import 'medium-zoom';
|
|
31
|
-
import 'vanilla-lazyload';
|
|
32
|
-
import 'vue-router';
|
|
33
|
-
import '@vueuse/core';
|
|
34
|
-
import '@unhead/schema-org';
|
|
35
|
-
|
|
36
|
-
declare module 'vite' {
|
|
37
|
-
interface UserConfig {
|
|
38
|
-
ssgOptions?: ViteSSGOptions;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface Options {
|
|
43
|
-
hasSingleTheme: boolean;
|
|
44
|
-
theme: ThemeOptions;
|
|
45
|
-
siteConfig?: SiteConfig;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface BlockItem {
|
|
49
|
-
text?: string;
|
|
50
|
-
icon?: string;
|
|
51
|
-
color?: string;
|
|
52
|
-
/**
|
|
53
|
-
* for i18n
|
|
54
|
-
*/
|
|
55
|
-
langs?: {
|
|
56
|
-
[key: string]: string;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
interface Blocks {
|
|
60
|
-
tip?: BlockItem;
|
|
61
|
-
warning?: BlockItem;
|
|
62
|
-
danger?: BlockItem;
|
|
63
|
-
info?: BlockItem;
|
|
64
|
-
details?: BlockItem;
|
|
65
|
-
}
|
|
66
|
-
type ContainerOptions = Blocks & Partial<Options>;
|
|
67
|
-
|
|
68
|
-
type ThemeOptions = ThemeRegistration | BuiltinTheme | {
|
|
69
|
-
light: ThemeRegistration | BuiltinTheme;
|
|
70
|
-
dark: ThemeRegistration | BuiltinTheme;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Extend Markdown options
|
|
74
|
-
* @zh 扩展 Markdown 配置,包含代码高亮、Markdown-it 和插件配置
|
|
75
|
-
*/
|
|
76
|
-
interface MarkdownOptions {
|
|
77
|
-
/**
|
|
78
|
-
* Setup markdown-it instance before applying plugins
|
|
79
|
-
*/
|
|
80
|
-
preConfig?: (md: MarkdownIt) => void;
|
|
81
|
-
/**
|
|
82
|
-
* markdown-it options
|
|
83
|
-
*/
|
|
84
|
-
options?: MarkdownIt['options'];
|
|
85
|
-
/**
|
|
86
|
-
* config markdown-it
|
|
87
|
-
*/
|
|
88
|
-
config?: (md: MarkdownIt) => void;
|
|
89
|
-
anchor?: anchorPlugin.AnchorOptions;
|
|
90
|
-
attrs?: {
|
|
91
|
-
leftDelimiter?: string;
|
|
92
|
-
rightDelimiter?: string;
|
|
93
|
-
allowedAttributes?: string[];
|
|
94
|
-
disable?: boolean;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Custom theme for syntax highlighting.
|
|
98
|
-
*
|
|
99
|
-
* You can also pass an object with `light` and `dark` themes to support dual themes.
|
|
100
|
-
*
|
|
101
|
-
* @see You can use an existing theme. https://shiki.style/themes
|
|
102
|
-
* @see Or add your own theme. https://shiki.style/guide/load-theme
|
|
103
|
-
*
|
|
104
|
-
* @example { theme: 'github-dark' }
|
|
105
|
-
* @example light and dark themes
|
|
106
|
-
* ```js
|
|
107
|
-
* { theme: { light: 'github-light', dark: 'github-dark' } }
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
theme?: ThemeOptions;
|
|
111
|
-
/**
|
|
112
|
-
* Languages for syntax highlighting.
|
|
113
|
-
* @see https://shiki.style/languages
|
|
114
|
-
*/
|
|
115
|
-
languages?: LanguageInput[];
|
|
116
|
-
/**
|
|
117
|
-
* Custom language aliases.
|
|
118
|
-
*
|
|
119
|
-
* @example { 'my-lang': 'js' }
|
|
120
|
-
* @see https://shiki.style/guide/load-lang#custom-language-aliases
|
|
121
|
-
*/
|
|
122
|
-
languageAlias?: Record<string, string>;
|
|
123
|
-
/**
|
|
124
|
-
* Show line numbers in code blocks
|
|
125
|
-
* @default false
|
|
126
|
-
*/
|
|
127
|
-
lineNumbers?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Fallback language when the specified language is not available.
|
|
130
|
-
*/
|
|
131
|
-
defaultHighlightLang?: string;
|
|
132
|
-
/**
|
|
133
|
-
* Transformers applied to code blocks
|
|
134
|
-
* @see https://shiki.style/guide/transformers
|
|
135
|
-
*/
|
|
136
|
-
codeTransformers?: ShikiTransformer[];
|
|
137
|
-
/**
|
|
138
|
-
* Setup Shiki instance
|
|
139
|
-
*/
|
|
140
|
-
shikiSetup?: (shiki: Highlighter) => void | Promise<void>;
|
|
141
|
-
/**
|
|
142
|
-
* Options for `@mdit-vue/plugin-headers`
|
|
143
|
-
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers
|
|
144
|
-
*/
|
|
145
|
-
headers?: HeadersPluginOptions | boolean;
|
|
146
|
-
/**
|
|
147
|
-
* Options for `@mdit-vue/plugin-sfc`
|
|
148
|
-
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc
|
|
149
|
-
*/
|
|
150
|
-
sfc?: SfcPluginOptions;
|
|
151
|
-
/**
|
|
152
|
-
* Options for `@mdit-vue/plugin-toc`
|
|
153
|
-
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc
|
|
154
|
-
*/
|
|
155
|
-
toc?: TocPluginOptions;
|
|
156
|
-
/**
|
|
157
|
-
* Options for `markdown-it-container`
|
|
158
|
-
* @see https://github.com/markdown-it/markdown-it-container
|
|
159
|
-
*/
|
|
160
|
-
container?: ContainerOptions;
|
|
161
|
-
/**
|
|
162
|
-
* Custom block configurations based on `markdown-it-container`
|
|
163
|
-
*/
|
|
164
|
-
blocks?: Blocks;
|
|
165
|
-
/**
|
|
166
|
-
* @see [markdown-it-image-figures](https://www.npmjs.com/package/markdown-it-image-figures)
|
|
167
|
-
*/
|
|
168
|
-
imageFigures?: {
|
|
169
|
-
lazy: boolean;
|
|
170
|
-
removeSrc: boolean;
|
|
171
|
-
async: boolean;
|
|
172
|
-
classes: string;
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* @see https://katex.org/docs/options.html
|
|
176
|
-
*/
|
|
177
|
-
katex?: KatexOptions;
|
|
178
|
-
externalLinks?: Record<string, string>;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
type ValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = ValaxyConfig<ThemeConfig> & ValaxyExtendConfig;
|
|
182
|
-
type UserValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep<ValaxyNodeConfig<ThemeConfig>>;
|
|
183
|
-
/**
|
|
184
|
-
* fn with options for theme config
|
|
185
|
-
*/
|
|
186
|
-
type ValaxyConfigFn<ThemeConfig = DefaultTheme.Config> = (options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyNodeConfig | Promise<ValaxyNodeConfig>;
|
|
187
|
-
type ValaxyConfigExport<ThemeConfig = DefaultTheme.Config> = ValaxyNodeConfig<ThemeConfig> | ValaxyConfigFn<ThemeConfig>;
|
|
188
|
-
type HookResult = Promise<void> | void;
|
|
189
|
-
interface ValaxyHooks {
|
|
190
|
-
'options:resolved': () => HookResult;
|
|
191
|
-
'config:init': () => HookResult;
|
|
192
|
-
/**
|
|
193
|
-
* @see valaxy/node/plugins/vueRouter.ts extendRoute
|
|
194
|
-
*/
|
|
195
|
-
'vue-router:extendRoute': (route: EditableTreeNode) => HookResult;
|
|
196
|
-
'build:before': () => HookResult;
|
|
197
|
-
'build:after': () => HookResult;
|
|
198
|
-
}
|
|
199
|
-
interface ValaxyNode {
|
|
200
|
-
version: string;
|
|
201
|
-
hooks: Hookable<ValaxyHooks>;
|
|
202
|
-
hook: ValaxyNode['hooks']['hook'];
|
|
203
|
-
options: ResolvedValaxyOptions;
|
|
204
|
-
}
|
|
205
|
-
interface ValaxyExtendConfig {
|
|
206
|
-
/**
|
|
207
|
-
* Don't fail builds due to dead links.
|
|
208
|
-
*
|
|
209
|
-
* @default false
|
|
210
|
-
* @deprecated use `build.ignoreDeadLinks` instead
|
|
211
|
-
*/
|
|
212
|
-
ignoreDeadLinks?: boolean | 'localhostLinks' | (string | RegExp | ((link: string) => boolean))[];
|
|
213
|
-
/**
|
|
214
|
-
* options for `valaxy build`
|
|
215
|
-
*/
|
|
216
|
-
build: {
|
|
217
|
-
/**
|
|
218
|
-
* Don't fail builds due to dead links.
|
|
219
|
-
* @zh 忽略死链
|
|
220
|
-
* @default false
|
|
221
|
-
*/
|
|
222
|
-
ignoreDeadLinks?: boolean | 'localhostLinks' | (string | RegExp | ((link: string) => boolean))[];
|
|
223
|
-
/**
|
|
224
|
-
* Enable SSG for pagination
|
|
225
|
-
* @en When enabled, it will generate pagination pages for you. `/page/1`, `/page/2`, ...
|
|
226
|
-
* @zh 启用 SSG 分页,将单独构建分页页面 `/page/1`, `/page/2`, ...
|
|
227
|
-
* @default false
|
|
228
|
-
*/
|
|
229
|
-
ssgForPagination: boolean;
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* @experimental
|
|
233
|
-
* Deploy to gh-pages/remote server
|
|
234
|
-
*/
|
|
235
|
-
deploy: {
|
|
236
|
-
/**
|
|
237
|
-
* @zh 部署类型
|
|
238
|
-
* @en deploy type
|
|
239
|
-
*/
|
|
240
|
-
type?: 'gh-pages' | 'remote';
|
|
241
|
-
};
|
|
242
|
-
/**
|
|
243
|
-
* internal modules
|
|
244
|
-
*/
|
|
245
|
-
modules: {
|
|
246
|
-
rss: {
|
|
247
|
-
/**
|
|
248
|
-
* enable rss
|
|
249
|
-
*/
|
|
250
|
-
enable: boolean;
|
|
251
|
-
/**
|
|
252
|
-
* @zh 全文输出
|
|
253
|
-
* @en full text output
|
|
254
|
-
* @default false
|
|
255
|
-
*/
|
|
256
|
-
fullText: boolean;
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Markdown Feature
|
|
261
|
-
*/
|
|
262
|
-
features: {
|
|
263
|
-
/**
|
|
264
|
-
* enable katex for global
|
|
265
|
-
* @see [Example | Valaxy](https://valaxy.site/examples/katex)
|
|
266
|
-
* @see https://katex.org/
|
|
267
|
-
*/
|
|
268
|
-
katex: boolean;
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* vite.config.ts options
|
|
272
|
-
* @see https://vite.dev/
|
|
273
|
-
*/
|
|
274
|
-
vite?: UserConfig;
|
|
275
|
-
/**
|
|
276
|
-
* @vitejs/plugin-vue options
|
|
277
|
-
* @see https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/README.md
|
|
278
|
-
*/
|
|
279
|
-
vue?: Parameters<typeof Vue>[0] & {
|
|
280
|
-
isCustomElement?: ((tag: string) => boolean)[];
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* @see https://github.com/unplugin/unplugin-vue-components
|
|
284
|
-
*/
|
|
285
|
-
components?: Parameters<typeof Components>[0];
|
|
286
|
-
/**
|
|
287
|
-
* @see https://github.com/JohnCampionJr/vite-plugin-vue-layouts
|
|
288
|
-
*/
|
|
289
|
-
layouts?: Parameters<typeof Layouts>[0];
|
|
290
|
-
/**
|
|
291
|
-
* @see https://github.com/posva/unplugin-vue-router
|
|
292
|
-
*/
|
|
293
|
-
router?: Parameters<typeof Router>[0];
|
|
294
|
-
/**
|
|
295
|
-
* @see https://unocss.dev/config/
|
|
296
|
-
*/
|
|
297
|
-
unocss?: VitePluginConfig;
|
|
298
|
-
/**
|
|
299
|
-
* rollup-plugin-visualizer
|
|
300
|
-
* @see https://github.com/btd/rollup-plugin-visualizer
|
|
301
|
-
*/
|
|
302
|
-
visualizer?: PluginVisualizerOptions;
|
|
303
|
-
/**
|
|
304
|
-
* unocss presets
|
|
305
|
-
* @see https://unocss.dev/guide/presets
|
|
306
|
-
*/
|
|
307
|
-
unocssPresets?: {
|
|
308
|
-
uno?: Parameters<typeof presetUno>[0];
|
|
309
|
-
attributify?: Parameters<typeof presetAttributify>[0];
|
|
310
|
-
icons?: Parameters<typeof presetIcons>[0];
|
|
311
|
-
typography?: Parameters<typeof presetTypography>[0];
|
|
312
|
-
};
|
|
313
|
-
fuse?: {
|
|
314
|
-
/**
|
|
315
|
-
* @en_US Extends the metadata fields returned by the search
|
|
316
|
-
* @zh_CN 扩展搜索返回的元数据字段
|
|
317
|
-
* @default []
|
|
318
|
-
* @description:en-US By default, returns the following fields: title, tags, categories, author, excerpt, link
|
|
319
|
-
* @description:zh-CN 默认返回以下字段:title、tags、categories、author、excerpt、link
|
|
320
|
-
*/
|
|
321
|
-
extendKeys?: string[];
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* @experimental
|
|
325
|
-
* Enable Vue Devtools & Valaxy Devtools
|
|
326
|
-
* @see https://devtools-next.vuejs.org/
|
|
327
|
-
*/
|
|
328
|
-
devtools?: boolean;
|
|
329
|
-
/**
|
|
330
|
-
* @en config for markdown (include markdown-it plugins)
|
|
331
|
-
* @zh markdown 相关配置
|
|
332
|
-
* {@link MarkdownOptions}
|
|
333
|
-
*/
|
|
334
|
-
markdown?: MarkdownOptions & Parameters<typeof Markdown>[0];
|
|
335
|
-
/**
|
|
336
|
-
* @en Extend markdown, you can modify the markdown content/excerpt
|
|
337
|
-
* @zh 扩展 markdown
|
|
338
|
-
*/
|
|
339
|
-
extendMd?: (ctx: {
|
|
340
|
-
route: EditableTreeNode;
|
|
341
|
-
data: Readonly<Record<string, any>>;
|
|
342
|
-
content: string;
|
|
343
|
-
excerpt?: string;
|
|
344
|
-
path: string;
|
|
345
|
-
}) => void;
|
|
346
|
-
/**
|
|
347
|
-
* @en Addons system
|
|
348
|
-
* @zh 插件系统
|
|
349
|
-
* @see 为什么需要插件? [Why Addon? | Valaxy](https://valaxy.site/addons/why)
|
|
350
|
-
* @see 插件橱窗 [Addons Gallery | Valaxy](https://valaxy.site/addons/gallery)
|
|
351
|
-
* @example
|
|
352
|
-
* ```ts
|
|
353
|
-
* import { defineValaxyConfig } from 'valaxy'
|
|
354
|
-
* import { addonTest } from 'valaxy-addon-test'
|
|
355
|
-
*
|
|
356
|
-
* export default defineValaxyConfig({
|
|
357
|
-
* addons: [
|
|
358
|
-
* // we always recommend to use function, so that you can pass options
|
|
359
|
-
* addonTest(),
|
|
360
|
-
* ]
|
|
361
|
-
* })
|
|
362
|
-
* ```
|
|
363
|
-
*/
|
|
364
|
-
addons?: ValaxyAddons;
|
|
365
|
-
/**
|
|
366
|
-
* @en Hooks system, you can customize each stage of the lifecycle.
|
|
367
|
-
* @zh 钩子系统,你可以对生命周期的各个阶段进行定制。
|
|
368
|
-
* @see https://valaxy.site/guide/custom/hooks
|
|
369
|
-
*/
|
|
370
|
-
hooks?: Partial<ValaxyHooks>;
|
|
371
|
-
}
|
|
372
|
-
type ValaxyAddonLike = ValaxyAddon | false | null | undefined;
|
|
373
|
-
type ValaxyAddons = (ValaxyAddon | string)[] | Record<string, ValaxyAddonLike>;
|
|
374
|
-
type ValaxyAddonFn<ThemeConfig = DefaultTheme.Config> = (addonOptions: ValaxyAddonResolver, valaxyOptions: ResolvedValaxyOptions<ThemeConfig>) => ValaxyNodeConfig | Promise<ValaxyNodeConfig>;
|
|
375
|
-
type ValaxyAddonExport<ThemeConfig = DefaultTheme.Config> = ValaxyNodeConfig<ThemeConfig> | ValaxyAddonFn<ThemeConfig>;
|
|
376
|
-
interface ValaxyAddonResolver {
|
|
377
|
-
name: string;
|
|
378
|
-
root: string;
|
|
379
|
-
enable: boolean;
|
|
380
|
-
global: boolean;
|
|
381
|
-
props: Record<string, any>;
|
|
382
|
-
options: Record<string, any>;
|
|
383
|
-
configFile?: string;
|
|
384
|
-
pkg: Record<string, any>;
|
|
385
|
-
setup?: (node: ValaxyNode) => void;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
interface ValaxyEntryOptions {
|
|
389
|
-
/**
|
|
390
|
-
* theme name
|
|
391
|
-
*/
|
|
392
|
-
theme?: string;
|
|
393
|
-
userRoot: string;
|
|
394
|
-
}
|
|
395
|
-
interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
|
|
396
|
-
mode: 'dev' | 'build';
|
|
397
|
-
/**
|
|
398
|
-
* package.json root
|
|
399
|
-
*/
|
|
400
|
-
pkgRoot: string;
|
|
401
|
-
/**
|
|
402
|
-
* temp dir, store d.ts and other temp files
|
|
403
|
-
* .valaxy
|
|
404
|
-
*/
|
|
405
|
-
tempDir: string;
|
|
406
|
-
/**
|
|
407
|
-
* Client root path
|
|
408
|
-
* @default 'valaxy/client'
|
|
409
|
-
*/
|
|
410
|
-
clientRoot: string;
|
|
411
|
-
/**
|
|
412
|
-
* User root path
|
|
413
|
-
* @default process.cwd()
|
|
414
|
-
*/
|
|
415
|
-
userRoot: string;
|
|
416
|
-
/**
|
|
417
|
-
* Theme root path
|
|
418
|
-
*/
|
|
419
|
-
themeRoot: string;
|
|
420
|
-
/**
|
|
421
|
-
* Addon root path
|
|
422
|
-
*/
|
|
423
|
-
addonRoots: string[];
|
|
424
|
-
/**
|
|
425
|
-
* clientRoot, themeRoot, ...addonRoots, userRoot
|
|
426
|
-
*/
|
|
427
|
-
roots: string[];
|
|
428
|
-
theme: string;
|
|
429
|
-
/**
|
|
430
|
-
* Valaxy Config
|
|
431
|
-
*/
|
|
432
|
-
config: ValaxyNodeConfig<ThemeConfig> & {
|
|
433
|
-
/**
|
|
434
|
-
* Generated Runtime Config
|
|
435
|
-
*/
|
|
436
|
-
runtimeConfig: RuntimeConfig;
|
|
437
|
-
};
|
|
438
|
-
/**
|
|
439
|
-
* config file path
|
|
440
|
-
*/
|
|
441
|
-
configFile: string;
|
|
442
|
-
siteConfigFile: string;
|
|
443
|
-
themeConfigFile: string;
|
|
444
|
-
pages: string[];
|
|
445
|
-
/**
|
|
446
|
-
* all addons
|
|
447
|
-
* Record<package-name, OptionResolver>
|
|
448
|
-
*/
|
|
449
|
-
addons: ValaxyAddonResolver[];
|
|
450
|
-
/**
|
|
451
|
-
* Collect redirect rule
|
|
452
|
-
*/
|
|
453
|
-
redirects: RedirectItem[];
|
|
454
|
-
env: MarkdownEnv & {
|
|
455
|
-
links: string[];
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
interface ValaxyServerOptions {
|
|
459
|
-
onConfigReload?: (newConfig: ValaxyNodeConfig, config: ValaxyNodeConfig, force?: boolean) => void;
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Post process valaxyOptions
|
|
463
|
-
* @param valaxyOptions
|
|
464
|
-
* @param valaxyConfig
|
|
465
|
-
*/
|
|
466
|
-
declare function processValaxyOptions(valaxyOptions: ResolvedValaxyOptions, valaxyConfig: ValaxyNodeConfig): Promise<ResolvedValaxyOptions<DefaultTheme.Config>>;
|
|
467
|
-
declare function resolveOptions(options?: ValaxyEntryOptions, mode?: ResolvedValaxyOptions['mode']): Promise<ResolvedValaxyOptions<DefaultTheme.Config>>;
|
|
468
|
-
/**
|
|
469
|
-
* resolve theme config
|
|
470
|
-
* @param options
|
|
471
|
-
*/
|
|
472
|
-
declare function resolveThemeValaxyConfig(options: ResolvedValaxyOptions): Promise<ValaxyNodeConfig>;
|
|
473
|
-
|
|
474
|
-
declare function build(valaxyApp: ValaxyNode, viteConfig?: InlineConfig): Promise<void>;
|
|
475
|
-
declare function ssgBuild(valaxyApp: ValaxyNode, viteConfig?: InlineConfig): Promise<void>;
|
|
476
|
-
/**
|
|
477
|
-
* post process for ssg fix extra string like `/html>` `ml>` `l>`
|
|
478
|
-
* handle tasks after ssg build
|
|
479
|
-
* todo find why
|
|
480
|
-
* @param options
|
|
481
|
-
*/
|
|
482
|
-
declare function postProcessForSSG(options: ResolvedValaxyOptions): Promise<void>;
|
|
483
|
-
declare function generateClientRedirects(options: ResolvedValaxyOptions): Promise<void>;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* merge vite.config.ts (user & theme)
|
|
487
|
-
* @internal
|
|
488
|
-
*/
|
|
489
|
-
declare function mergeViteConfigs({ userRoot, themeRoot }: ResolvedValaxyOptions, command: 'serve' | 'build'): Promise<InlineConfig>;
|
|
490
|
-
/**
|
|
491
|
-
* generate index.html from user/theme/client
|
|
492
|
-
* @internal
|
|
493
|
-
*/
|
|
494
|
-
declare function getIndexHtml({ clientRoot, themeRoot, userRoot, config }: ResolvedValaxyOptions, rawHtml: string): Promise<string>;
|
|
495
|
-
|
|
496
|
-
declare function defineValaxyAddon<AddonOptions = object>(addonFunc: (addonOptions?: AddonOptions, valaxyOptions?: ResolvedValaxyOptions) => ValaxyAddon & {
|
|
497
|
-
setup?: ValaxyAddonResolver['setup'];
|
|
498
|
-
}): (addonOptions?: AddonOptions, valaxyOptions?: ResolvedValaxyOptions) => ValaxyAddon & {
|
|
499
|
-
setup?: ValaxyAddonResolver["setup"];
|
|
500
|
-
};
|
|
501
|
-
declare const defineAddon: typeof defineValaxyAddon;
|
|
502
|
-
declare function resolveAddonsConfig(addons: ValaxyAddonResolver[], options: ResolvedValaxyOptions): Promise<ValaxyNodeConfig>;
|
|
503
|
-
|
|
504
|
-
interface LoadConfigFromFileOptions {
|
|
505
|
-
cwd?: string;
|
|
506
|
-
valaxyOptions?: ResolvedValaxyOptions;
|
|
507
|
-
}
|
|
508
|
-
type UserInputConfig = Record<string, any>;
|
|
509
|
-
interface ResolvedConfig<T extends UserInputConfig = UserInputConfig> {
|
|
510
|
-
config: T;
|
|
511
|
-
configFile: string;
|
|
512
|
-
}
|
|
513
|
-
declare function loadConfig<T extends UserInputConfig = UserInputConfig>(options: {
|
|
514
|
-
name: string;
|
|
515
|
-
cwd: string;
|
|
516
|
-
}): Promise<ResolvedConfig<T>>;
|
|
517
|
-
declare function loadConfigFromFile<T extends UserInputConfig>(file: string, options?: LoadConfigFromFileOptions): Promise<ResolvedConfig<T>>;
|
|
518
|
-
|
|
519
|
-
declare const defaultSiteConfig: SiteConfig;
|
|
520
|
-
/**
|
|
521
|
-
* Type helper for site.config.ts
|
|
522
|
-
* @param config
|
|
523
|
-
*/
|
|
524
|
-
declare function defineSiteConfig(config: UserSiteConfig): valaxy_types.PartialDeep<SiteConfig>;
|
|
525
|
-
/**
|
|
526
|
-
* resolve valaxy config from special root
|
|
527
|
-
*/
|
|
528
|
-
declare function resolveSiteConfigFromRoot(root: string): Promise<ResolvedConfig<valaxy_types.PartialDeep<SiteConfig>>>;
|
|
529
|
-
/**
|
|
530
|
-
* resolve site.config.ts and merge with default
|
|
531
|
-
* @param root
|
|
532
|
-
*/
|
|
533
|
-
declare function resolveSiteConfig(root: string): Promise<{
|
|
534
|
-
siteConfig: valaxy_types.PartialDeep<SiteConfig>;
|
|
535
|
-
siteConfigFile: string;
|
|
536
|
-
}>;
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* resolve theme config from special root
|
|
540
|
-
*/
|
|
541
|
-
declare function resolveThemeConfigFromRoot(root: string): Promise<ResolvedConfig<DefaultTheme.Config>>;
|
|
542
|
-
/**
|
|
543
|
-
* resolve theme.config.ts and merge with default
|
|
544
|
-
*/
|
|
545
|
-
declare function resolveUserThemeConfig(options: ResolvedValaxyOptions): Promise<{
|
|
546
|
-
themeConfig: DefaultTheme.Config;
|
|
547
|
-
themeConfigFile: string;
|
|
548
|
-
}>;
|
|
549
|
-
type ValaxyConfigExtendKey = 'vite' | 'vue' | 'unocss' | 'unocssPresets' | 'markdown' | 'extendMd' | 'addons';
|
|
550
|
-
type ValaxyPickConfig = Pick<ValaxyNodeConfig, ValaxyConfigExtendKey>;
|
|
551
|
-
type ValaxyTheme<ThemeConfig = DefaultTheme.Config> = ValaxyPickConfig & {
|
|
552
|
-
themeConfig?: ThemeConfig;
|
|
553
|
-
};
|
|
554
|
-
declare function defineValaxyTheme<ThemeConfig = DefaultTheme.Config>(theme: ValaxyTheme<ThemeConfig> | ((options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyTheme<ThemeConfig>)): ValaxyTheme<ThemeConfig> | ((options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyTheme<ThemeConfig>);
|
|
555
|
-
declare const defineTheme: typeof defineValaxyTheme;
|
|
556
|
-
|
|
557
|
-
declare const defaultValaxyConfig: ValaxyNodeConfig;
|
|
558
|
-
/**
|
|
559
|
-
* Type helper for valaxy.config.ts
|
|
560
|
-
*/
|
|
561
|
-
declare function defineValaxyConfig<ThemeConfig>(config: UserValaxyNodeConfig<ThemeConfig>): PartialDeep$1<ValaxyNodeConfig<ThemeConfig>>;
|
|
562
|
-
declare const defineConfig: typeof defineValaxyConfig;
|
|
563
|
-
declare function resolveValaxyConfigFromRoot(root: string, options?: ResolvedValaxyOptions): Promise<ResolvedConfig<ValaxyNodeConfig>>;
|
|
564
|
-
/**
|
|
565
|
-
* merge valaxy.config
|
|
566
|
-
* (source, default)
|
|
567
|
-
*/
|
|
568
|
-
declare const mergeValaxyConfig: <Source extends {
|
|
569
|
-
[x: string]: any;
|
|
570
|
-
[x: number]: any;
|
|
571
|
-
[x: symbol]: any;
|
|
572
|
-
}, Defaults extends Array<{
|
|
573
|
-
[x: string]: any;
|
|
574
|
-
[x: number]: any;
|
|
575
|
-
[x: symbol]: any;
|
|
576
|
-
} | (number | boolean | any[] | Record<never, any> | null | undefined)>>(source: Source, ...defaults: Defaults) => defu.Defu<Source, Defaults>;
|
|
577
|
-
/**
|
|
578
|
-
* resolve user valaxy config
|
|
579
|
-
* options only have userRoot
|
|
580
|
-
* @param options
|
|
581
|
-
*/
|
|
582
|
-
declare function resolveValaxyConfig(options: ValaxyEntryOptions): Promise<{
|
|
583
|
-
config: ValaxyNodeConfig;
|
|
584
|
-
configFile: string;
|
|
585
|
-
theme: string;
|
|
586
|
-
}>;
|
|
587
|
-
|
|
588
|
-
type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
|
|
589
|
-
declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
|
|
590
|
-
|
|
591
|
-
declare const EXCERPT_SEPARATOR = "<!-- more -->";
|
|
592
|
-
declare const EXTERNAL_URL_RE: RegExp;
|
|
593
|
-
declare const PATHNAME_PROTOCOL_RE: RegExp;
|
|
594
|
-
declare const ALL_ROUTE = "/:all(.*)*";
|
|
595
|
-
declare const customElements: Set<string>;
|
|
596
|
-
/**
|
|
597
|
-
* @see https://vitejs.dev/config/shared-options.html#css-preprocessoroptions for sass@2
|
|
598
|
-
*/
|
|
599
|
-
declare const defaultViteConfig: UserConfig;
|
|
600
|
-
|
|
601
|
-
declare function ViteValaxyPlugins(valaxyApp: ValaxyNode, serverOptions?: ValaxyServerOptions): Promise<(PluginOption | PluginOption[])[]>;
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* @packageDocumentation valaxy plugin
|
|
605
|
-
*/
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* create valaxy loader (custom virtual modules)
|
|
609
|
-
* multiple plugins
|
|
610
|
-
* @internal
|
|
611
|
-
* @param options
|
|
612
|
-
* @param serverOptions
|
|
613
|
-
*/
|
|
614
|
-
declare function createValaxyLoader(options: ResolvedValaxyOptions, serverOptions?: ValaxyServerOptions): Promise<Plugin[]>;
|
|
615
|
-
|
|
616
|
-
declare function createServer(valaxyApp: ValaxyNode, viteConfig?: InlineConfig, serverOptions?: ValaxyServerOptions): Promise<vite.ViteDevServer>;
|
|
617
|
-
|
|
618
|
-
declare function getGitTimestamp(file: string, type?: 'created' | 'updated'): Promise<number>;
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
* is url external (http/https:)
|
|
622
|
-
* @param str
|
|
623
|
-
*/
|
|
624
|
-
declare function isExternal(str: string): boolean;
|
|
625
|
-
/**
|
|
626
|
-
* slash path for windows
|
|
627
|
-
* @param str
|
|
628
|
-
*/
|
|
629
|
-
declare function slash(str: string): string;
|
|
630
|
-
declare function ensurePrefix(prefix: string, str: string): string;
|
|
631
|
-
declare function toAtFS(path: string): string;
|
|
632
|
-
declare function isPath(name: string): boolean;
|
|
633
|
-
/**
|
|
634
|
-
* transform obj for vite code
|
|
635
|
-
* @param obj
|
|
636
|
-
*/
|
|
637
|
-
declare function transformObject(obj: any): string;
|
|
638
|
-
|
|
639
|
-
declare const isInstalledGlobally: {
|
|
640
|
-
value?: boolean;
|
|
641
|
-
};
|
|
642
|
-
/**
|
|
643
|
-
* Before is CJS: use 'resolve'
|
|
644
|
-
* ESM: use 'mlly'
|
|
645
|
-
*/
|
|
646
|
-
declare function resolveImportPath(importName: string, ensure?: true): Promise<string>;
|
|
647
|
-
declare function resolveImportPath(importName: string, ensure?: boolean): Promise<string | undefined>;
|
|
648
|
-
|
|
649
|
-
export { ALL_ROUTE, EXCERPT_SEPARATOR, EXTERNAL_URL_RE, 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 ValaxyConfigExport, type ValaxyConfigExtendKey, type ValaxyConfigFn, type ValaxyEntryOptions, type ValaxyExtendConfig, type ValaxyHooks, type ValaxyNode, type ValaxyNodeConfig, type ValaxyPickConfig, type ValaxyServerOptions, type ValaxyTheme, ViteValaxyPlugins, build, createServer, createValaxyLoader, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, ensurePrefix, generateClientRedirects, getGitTimestamp, getIndexHtml, isExternal, isInstalledGlobally, isPath, loadConfig, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig, resolveImportPath, resolveOptions, resolveSiteConfig, resolveSiteConfigFromRoot, resolveThemeConfigFromRoot, resolveThemeValaxyConfig, resolveUserThemeConfig, resolveValaxyConfig, resolveValaxyConfigFromRoot, slash, ssgBuild, toAtFS, transformObject };
|
package/dist/node/index.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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,O,P,Q,R,S,T,U,V,W,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-WZQPPSXL.mjs";import"../chunk-KQEK3EI2.mjs";export{d as ALL_ROUTE,a as EXCERPT_SEPARATOR,b as EXTERNAL_URL_RE,c as PATHNAME_PROTOCOL_RE,P as ViteValaxyPlugins,Q as build,V as cli,U as createServer,O as createValaxyLoader,e as customElements,t as defaultSiteConfig,x as defaultValaxyConfig,f as defaultViteConfig,E as defineAddon,z as defineConfig,u as defineSiteConfig,J as defineTheme,K as defineUnoSetup,D as defineValaxyAddon,y as defineValaxyConfig,I as defineValaxyTheme,j as ensurePrefix,T as generateClientRedirects,g as getGitTimestamp,q as getIndexHtml,h as isExternal,n as isInstalledGlobally,l as isPath,r as loadConfig,s as loadConfigFromFile,B as mergeValaxyConfig,p as mergeViteConfigs,S as postProcessForSSG,L as processValaxyOptions,F as resolveAddonsConfig,o as resolveImportPath,M as resolveOptions,w as resolveSiteConfig,v as resolveSiteConfigFromRoot,G as resolveThemeConfigFromRoot,N as resolveThemeValaxyConfig,H as resolveUserThemeConfig,C as resolveValaxyConfig,A as resolveValaxyConfigFromRoot,W as run,i as slash,R as ssgBuild,k as toAtFS,m as transformObject};
|
package/dist/types/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _chunkQBQ5XWB7cjs = require('../chunk-QBQ5XWB7.cjs');_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );_chunkQBQ5XWB7cjs.e.call(void 0, );
|