valaxy 0.26.1 → 0.26.3
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/composables/collections.ts +1 -1
- package/client/composables/decrypt.ts +6 -3
- package/client/define/collection.ts +1 -35
- package/client/index.d.ts +48 -0
- package/client/shims.d.ts +32 -4
- package/client/tsconfig.json +16 -0
- package/client/types/collection.ts +35 -0
- package/client/types/index.ts +2 -0
- package/dist/node/cli/index.mjs +2 -2
- package/dist/node/index.d.mts +336 -314
- package/dist/node/index.mjs +2 -2
- package/dist/shared/valaxy.BwiZu4ms.d.mts +832 -0
- package/dist/shared/{valaxy.DYu2a9p6.mjs → valaxy.D7OlaIFc.mjs} +303 -303
- package/dist/types/index.d.mts +9 -775
- package/index.d.ts +0 -1
- package/package.json +34 -28
- package/types/frontmatter/page.ts +1 -1
- package/types/index.ts +0 -1
- package/dist/shared/valaxy.D_ue8jlC.d.mts +0 -60
- package/shims.d.ts +0 -85
package/dist/node/index.d.mts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
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 { MarkdownEnv } from 'unplugin-vue-markdown/types';
|
|
5
|
-
import { DefaultTheme, ValaxyConfig, ValaxyAddon, PartialDeep as PartialDeep$1, RuntimeConfig, RedirectItem, SiteConfig, UserSiteConfig } from 'valaxy/types';
|
|
6
4
|
import Vue from '@vitejs/plugin-vue';
|
|
7
5
|
import { Options as Options$2 } from 'beasties';
|
|
8
6
|
import { Hookable } from 'hookable';
|
|
9
7
|
import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
|
|
10
|
-
import {
|
|
8
|
+
import { presetWind4, presetAttributify, presetIcons, presetTypography } from 'unocss';
|
|
11
9
|
import { VitePluginConfig } from 'unocss/vite';
|
|
12
10
|
import Components from 'unplugin-vue-components/vite';
|
|
13
11
|
import Markdown from 'unplugin-vue-markdown/vite';
|
|
@@ -15,6 +13,8 @@ import { EditableTreeNode } from 'unplugin-vue-router';
|
|
|
15
13
|
import Router from 'unplugin-vue-router/vite';
|
|
16
14
|
import Layouts from 'vite-plugin-vue-layouts';
|
|
17
15
|
import { Options as Options$1 } from 'vitepress-plugin-group-icons';
|
|
16
|
+
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.BwiZu4ms.mjs';
|
|
17
|
+
import { MarkdownEnv } from 'unplugin-vue-markdown/types';
|
|
18
18
|
import { KatexOptions } from 'katex';
|
|
19
19
|
import MarkdownIt from 'markdown-it';
|
|
20
20
|
import anchorPlugin from 'markdown-it-anchor';
|
|
@@ -22,10 +22,14 @@ import { Options, MarkdownItAsync } from 'markdown-it-async';
|
|
|
22
22
|
import { ThemeRegistration, BuiltinTheme, LanguageInput, ShikiTransformer, Highlighter } from 'shiki';
|
|
23
23
|
export { cli, registerDevCommand, run, startValaxyDev } from './cli/index.mjs';
|
|
24
24
|
import { Awaitable } from '@antfu/utils';
|
|
25
|
-
import { V as ValaxyAddon$1, D as DefaultTheme$1 } from '../shared/valaxy.D_ue8jlC.mjs';
|
|
26
25
|
import * as defu from 'defu';
|
|
27
|
-
import '
|
|
26
|
+
import '@vueuse/integrations/useFuse';
|
|
27
|
+
import 'medium-zoom';
|
|
28
|
+
import 'vanilla-lazyload';
|
|
29
|
+
import 'vue-router';
|
|
28
30
|
import '@vueuse/core';
|
|
31
|
+
import '@unhead/schema-org';
|
|
32
|
+
import 'yargs';
|
|
29
33
|
|
|
30
34
|
declare module 'vite' {
|
|
31
35
|
interface UserConfig {
|
|
@@ -40,230 +44,235 @@ declare module 'vite' {
|
|
|
40
44
|
declare function createValaxyNode(options: ResolvedValaxyOptions): ValaxyNode;
|
|
41
45
|
|
|
42
46
|
interface MarkdownItHeader {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The level of the header
|
|
49
|
+
*
|
|
50
|
+
* `1` to `6` for `<h1>` to `<h6>`
|
|
51
|
+
*/
|
|
52
|
+
level: number;
|
|
53
|
+
/**
|
|
54
|
+
* The title of the header
|
|
55
|
+
*/
|
|
56
|
+
title: string;
|
|
57
|
+
/**
|
|
58
|
+
* The slug of the header
|
|
59
|
+
*
|
|
60
|
+
* Typically the `id` attr of the header anchor
|
|
61
|
+
*/
|
|
62
|
+
slug: string;
|
|
63
|
+
/**
|
|
64
|
+
* Link of the header
|
|
65
|
+
*
|
|
66
|
+
* Typically using `#${slug}` as the anchor hash
|
|
67
|
+
*/
|
|
68
|
+
link: string;
|
|
69
|
+
/**
|
|
70
|
+
* The children of the header
|
|
71
|
+
*/
|
|
72
|
+
children: MarkdownItHeader[];
|
|
69
73
|
}
|
|
70
74
|
|
|
75
|
+
//#region src/types.d.ts
|
|
76
|
+
|
|
71
77
|
/**
|
|
72
78
|
* Options of @mdit-vue/plugin-headers
|
|
73
79
|
*/
|
|
74
80
|
interface HeadersPluginOptions {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
81
|
+
/**
|
|
82
|
+
* A custom slugification function
|
|
83
|
+
*
|
|
84
|
+
* Should use the same slugify function with markdown-it-anchor
|
|
85
|
+
* to ensure the link is matched
|
|
86
|
+
*/
|
|
87
|
+
slugify?: (str: string) => string;
|
|
88
|
+
/**
|
|
89
|
+
* A function for formatting header title
|
|
90
|
+
*/
|
|
91
|
+
format?: (str: string) => string;
|
|
92
|
+
/**
|
|
93
|
+
* Heading level that going to be extracted
|
|
94
|
+
*
|
|
95
|
+
* Should be a subset of markdown-it-anchor's `level` option
|
|
96
|
+
* to ensure the slug is existed
|
|
97
|
+
*
|
|
98
|
+
* @default [2,3]
|
|
99
|
+
*/
|
|
100
|
+
level?: number[];
|
|
101
|
+
/**
|
|
102
|
+
* Should allow headers inside nested blocks or not
|
|
103
|
+
*
|
|
104
|
+
* If set to `true`, headers inside blockquote, list, etc. would also be extracted.
|
|
105
|
+
*
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
shouldAllowNested?: boolean;
|
|
103
109
|
}
|
|
104
110
|
declare module '@mdit-vue/types' {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
interface MarkdownItEnv {
|
|
112
|
+
/**
|
|
113
|
+
* The headers that extracted by `@mdit-vue/plugin-headers`
|
|
114
|
+
*/
|
|
115
|
+
headers?: MarkdownItHeader[];
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/types.d.ts
|
|
113
121
|
/**
|
|
114
122
|
* Options of @mdit-vue/plugin-sfc
|
|
115
123
|
*/
|
|
116
124
|
interface SfcPluginOptions {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Custom blocks to be extracted
|
|
127
|
+
*
|
|
128
|
+
* @default []
|
|
129
|
+
*/
|
|
130
|
+
customBlocks?: string[];
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
133
|
* SFC block that extracted from markdown
|
|
126
134
|
*/
|
|
127
135
|
interface SfcBlock {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
136
|
+
/**
|
|
137
|
+
* The type of the block
|
|
138
|
+
*/
|
|
139
|
+
type: string;
|
|
140
|
+
/**
|
|
141
|
+
* The content, including open-tag and close-tag
|
|
142
|
+
*/
|
|
143
|
+
content: string;
|
|
144
|
+
/**
|
|
145
|
+
* The content that stripped open-tag and close-tag off
|
|
146
|
+
*/
|
|
147
|
+
contentStripped: string;
|
|
148
|
+
/**
|
|
149
|
+
* The open-tag
|
|
150
|
+
*/
|
|
151
|
+
tagOpen: string;
|
|
152
|
+
/**
|
|
153
|
+
* The close-tag
|
|
154
|
+
*/
|
|
155
|
+
tagClose: string;
|
|
148
156
|
}
|
|
149
157
|
interface MarkdownSfcBlocks {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
/**
|
|
159
|
+
* The `<template>` block
|
|
160
|
+
*/
|
|
161
|
+
template: SfcBlock | null;
|
|
162
|
+
/**
|
|
163
|
+
* The common `<script>` block
|
|
164
|
+
*/
|
|
165
|
+
script: SfcBlock | null;
|
|
166
|
+
/**
|
|
167
|
+
* The `<script setup>` block
|
|
168
|
+
*/
|
|
169
|
+
scriptSetup: SfcBlock | null;
|
|
170
|
+
/**
|
|
171
|
+
* All `<script>` blocks.
|
|
172
|
+
*
|
|
173
|
+
* By default, SFC only allows one `<script>` block and one `<script setup>` block.
|
|
174
|
+
* However, some tools may support different types of `<script>`s, so we keep all of them here.
|
|
175
|
+
*/
|
|
176
|
+
scripts: SfcBlock[];
|
|
177
|
+
/**
|
|
178
|
+
* All `<style>` blocks.
|
|
179
|
+
*/
|
|
180
|
+
styles: SfcBlock[];
|
|
181
|
+
/**
|
|
182
|
+
* All custom blocks.
|
|
183
|
+
*/
|
|
184
|
+
customBlocks: SfcBlock[];
|
|
177
185
|
}
|
|
178
186
|
declare module '@mdit-vue/types' {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
interface MarkdownItEnv {
|
|
188
|
+
/**
|
|
189
|
+
* SFC blocks that extracted by `@mdit-vue/plugin-sfc`
|
|
190
|
+
*/
|
|
191
|
+
sfcBlocks?: MarkdownSfcBlocks;
|
|
192
|
+
}
|
|
185
193
|
}
|
|
186
194
|
|
|
195
|
+
//#region src/types.d.ts
|
|
187
196
|
/**
|
|
188
197
|
* Options of @mdit-vue/plugin-toc
|
|
189
198
|
*/
|
|
190
199
|
interface TocPluginOptions {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
200
|
+
/**
|
|
201
|
+
* The pattern serving as the TOC placeholder in your markdown
|
|
202
|
+
*
|
|
203
|
+
* @default /^\[\[toc\]\]$/i
|
|
204
|
+
*/
|
|
205
|
+
pattern?: RegExp;
|
|
206
|
+
/**
|
|
207
|
+
* A custom slugification function
|
|
208
|
+
*
|
|
209
|
+
* Should use the same slugify function with markdown-it-anchor
|
|
210
|
+
* to ensure the link is matched
|
|
211
|
+
*/
|
|
212
|
+
slugify?: (str: string) => string;
|
|
213
|
+
/**
|
|
214
|
+
* A function for formatting headings
|
|
215
|
+
*/
|
|
216
|
+
format?: (str: string) => string;
|
|
217
|
+
/**
|
|
218
|
+
* Heading level that going to be included in the TOC
|
|
219
|
+
*
|
|
220
|
+
* Should be a subset of markdown-it-anchor's `level` option
|
|
221
|
+
* to ensure the link is existed
|
|
222
|
+
*
|
|
223
|
+
* @default [2,3]
|
|
224
|
+
*/
|
|
225
|
+
level?: number[];
|
|
226
|
+
/**
|
|
227
|
+
* Should allow headers inside nested blocks or not
|
|
228
|
+
*
|
|
229
|
+
* If set to `true`, headers inside blockquote, list, etc. would also be included.
|
|
230
|
+
*
|
|
231
|
+
* @default false
|
|
232
|
+
*/
|
|
233
|
+
shouldAllowNested?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* HTML tag of the TOC container
|
|
236
|
+
*
|
|
237
|
+
* @default 'nav'
|
|
238
|
+
*/
|
|
239
|
+
containerTag?: string;
|
|
240
|
+
/**
|
|
241
|
+
* The class for the TOC container
|
|
242
|
+
*
|
|
243
|
+
* @default 'table-of-contents'
|
|
244
|
+
*/
|
|
245
|
+
containerClass?: string;
|
|
246
|
+
/**
|
|
247
|
+
* HTML tag of the TOC list
|
|
248
|
+
*
|
|
249
|
+
* @default 'ul'
|
|
250
|
+
*/
|
|
251
|
+
listTag?: 'ol' | 'ul';
|
|
252
|
+
/**
|
|
253
|
+
* The class for the TOC list
|
|
254
|
+
*
|
|
255
|
+
* @default ''
|
|
256
|
+
*/
|
|
257
|
+
listClass?: string;
|
|
258
|
+
/**
|
|
259
|
+
* The class for the `<li>` tag
|
|
260
|
+
*
|
|
261
|
+
* @default ''
|
|
262
|
+
*/
|
|
263
|
+
itemClass?: string;
|
|
264
|
+
/**
|
|
265
|
+
* The tag of the link inside `<li>` tag
|
|
266
|
+
*
|
|
267
|
+
* @default 'a'
|
|
268
|
+
*/
|
|
269
|
+
linkTag?: 'a' | 'router-link';
|
|
270
|
+
/**
|
|
271
|
+
* The class for the link inside the `<li>` tag
|
|
272
|
+
*
|
|
273
|
+
* @default ''
|
|
274
|
+
*/
|
|
275
|
+
linkClass?: string;
|
|
267
276
|
}
|
|
268
277
|
|
|
269
278
|
interface BlockItem {
|
|
@@ -396,13 +405,6 @@ interface MarkdownOptions extends Options {
|
|
|
396
405
|
externalLinks?: Record<string, string>;
|
|
397
406
|
}
|
|
398
407
|
|
|
399
|
-
type ValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = ValaxyConfig<ThemeConfig> & ValaxyExtendConfig;
|
|
400
|
-
type UserValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep$1<ValaxyNodeConfig<ThemeConfig>>;
|
|
401
|
-
/**
|
|
402
|
-
* fn with options for theme config
|
|
403
|
-
*/
|
|
404
|
-
type ValaxyConfigFn<ThemeConfig = DefaultTheme.Config> = (options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyNodeConfig | Promise<ValaxyNodeConfig>;
|
|
405
|
-
type ValaxyConfigExport<ThemeConfig = DefaultTheme.Config> = ValaxyNodeConfig<ThemeConfig> | ValaxyConfigFn<ThemeConfig>;
|
|
406
408
|
type HookResult = Promise<void> | void;
|
|
407
409
|
interface ValaxyHooks {
|
|
408
410
|
'options:resolved': () => HookResult;
|
|
@@ -415,6 +417,88 @@ interface ValaxyHooks {
|
|
|
415
417
|
'build:before': () => HookResult;
|
|
416
418
|
'build:after': () => HookResult;
|
|
417
419
|
}
|
|
420
|
+
|
|
421
|
+
interface ValaxyEntryOptions {
|
|
422
|
+
/**
|
|
423
|
+
* theme name
|
|
424
|
+
*/
|
|
425
|
+
theme?: string;
|
|
426
|
+
userRoot: string;
|
|
427
|
+
}
|
|
428
|
+
interface ValaxyServerOptions {
|
|
429
|
+
onConfigReload?: (newConfig: ValaxyNodeConfig, config: ValaxyNodeConfig, force?: boolean) => void;
|
|
430
|
+
}
|
|
431
|
+
interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
|
|
432
|
+
mode: 'dev' | 'build';
|
|
433
|
+
/**
|
|
434
|
+
* package.json root
|
|
435
|
+
*/
|
|
436
|
+
pkgRoot: string;
|
|
437
|
+
/**
|
|
438
|
+
* temp dir, store d.ts and other temp files
|
|
439
|
+
* .valaxy
|
|
440
|
+
*/
|
|
441
|
+
tempDir: string;
|
|
442
|
+
/**
|
|
443
|
+
* Client root path
|
|
444
|
+
* @default 'valaxy/client'
|
|
445
|
+
*/
|
|
446
|
+
clientRoot: string;
|
|
447
|
+
/**
|
|
448
|
+
* User root path
|
|
449
|
+
* @default process.cwd()
|
|
450
|
+
*/
|
|
451
|
+
userRoot: string;
|
|
452
|
+
/**
|
|
453
|
+
* Theme root path
|
|
454
|
+
*/
|
|
455
|
+
themeRoot: string;
|
|
456
|
+
/**
|
|
457
|
+
* Addon root path
|
|
458
|
+
*/
|
|
459
|
+
addonRoots: string[];
|
|
460
|
+
/**
|
|
461
|
+
* clientRoot, themeRoot, ...addonRoots, userRoot
|
|
462
|
+
*/
|
|
463
|
+
roots: string[];
|
|
464
|
+
theme: string;
|
|
465
|
+
/**
|
|
466
|
+
* Valaxy Config
|
|
467
|
+
*/
|
|
468
|
+
config: ValaxyNodeConfig<ThemeConfig> & {
|
|
469
|
+
/**
|
|
470
|
+
* Generated Runtime Config
|
|
471
|
+
*/
|
|
472
|
+
runtimeConfig: RuntimeConfig;
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* config file path
|
|
476
|
+
*/
|
|
477
|
+
configFile: string;
|
|
478
|
+
siteConfigFile: string;
|
|
479
|
+
themeConfigFile: string;
|
|
480
|
+
pages: string[];
|
|
481
|
+
/**
|
|
482
|
+
* all addons
|
|
483
|
+
* Record<package-name, OptionResolver>
|
|
484
|
+
*/
|
|
485
|
+
addons: ValaxyAddonResolver[];
|
|
486
|
+
/**
|
|
487
|
+
* Collect redirect rule
|
|
488
|
+
*/
|
|
489
|
+
redirects: RedirectItem[];
|
|
490
|
+
env: MarkdownEnv & {
|
|
491
|
+
links: string[];
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
type ValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = ValaxyConfig<ThemeConfig> & ValaxyExtendConfig;
|
|
496
|
+
type UserValaxyNodeConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep<ValaxyNodeConfig<ThemeConfig>>;
|
|
497
|
+
/**
|
|
498
|
+
* fn with options for theme config
|
|
499
|
+
*/
|
|
500
|
+
type ValaxyConfigFn<ThemeConfig = DefaultTheme.Config> = (options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyNodeConfig | Promise<ValaxyNodeConfig>;
|
|
501
|
+
type ValaxyConfigExport<ThemeConfig = DefaultTheme.Config> = ValaxyNodeConfig<ThemeConfig> | ValaxyConfigFn<ThemeConfig>;
|
|
418
502
|
interface ValaxyNode {
|
|
419
503
|
version: string;
|
|
420
504
|
hooks: Hookable<ValaxyHooks>;
|
|
@@ -550,7 +634,7 @@ interface ValaxyExtendConfig {
|
|
|
550
634
|
/**
|
|
551
635
|
* @deprecated use wind4 instead
|
|
552
636
|
*/
|
|
553
|
-
uno?: Parameters<typeof
|
|
637
|
+
uno?: Parameters<typeof presetWind4>[0];
|
|
554
638
|
attributify?: Parameters<typeof presetAttributify>[0];
|
|
555
639
|
icons?: Parameters<typeof presetIcons>[0];
|
|
556
640
|
typography?: Parameters<typeof presetTypography>[0];
|
|
@@ -620,10 +704,8 @@ interface ValaxyExtendConfig {
|
|
|
620
704
|
*/
|
|
621
705
|
beastiesOptions?: Options$2;
|
|
622
706
|
}
|
|
623
|
-
type
|
|
624
|
-
|
|
625
|
-
type ValaxyAddonFn<ThemeConfig = DefaultTheme.Config> = (addonOptions: ValaxyAddonResolver, valaxyOptions: ResolvedValaxyOptions<ThemeConfig>) => ValaxyNodeConfig | Promise<ValaxyNodeConfig>;
|
|
626
|
-
type ValaxyAddonExport<ThemeConfig = DefaultTheme.Config> = ValaxyNodeConfig<ThemeConfig> | ValaxyAddonFn<ThemeConfig>;
|
|
707
|
+
type ValaxyApp = ReturnType<typeof createValaxyNode>;
|
|
708
|
+
|
|
627
709
|
interface ValaxyAddonResolver {
|
|
628
710
|
name: string;
|
|
629
711
|
root: string;
|
|
@@ -635,93 +717,10 @@ interface ValaxyAddonResolver {
|
|
|
635
717
|
pkg: Record<string, any>;
|
|
636
718
|
setup?: (node: ValaxyNode) => void;
|
|
637
719
|
}
|
|
638
|
-
type
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
* theme name
|
|
643
|
-
*/
|
|
644
|
-
theme?: string;
|
|
645
|
-
userRoot: string;
|
|
646
|
-
}
|
|
647
|
-
interface ResolvedValaxyOptions<ThemeConfig = DefaultTheme.Config> {
|
|
648
|
-
mode: 'dev' | 'build';
|
|
649
|
-
/**
|
|
650
|
-
* package.json root
|
|
651
|
-
*/
|
|
652
|
-
pkgRoot: string;
|
|
653
|
-
/**
|
|
654
|
-
* temp dir, store d.ts and other temp files
|
|
655
|
-
* .valaxy
|
|
656
|
-
*/
|
|
657
|
-
tempDir: string;
|
|
658
|
-
/**
|
|
659
|
-
* Client root path
|
|
660
|
-
* @default 'valaxy/client'
|
|
661
|
-
*/
|
|
662
|
-
clientRoot: string;
|
|
663
|
-
/**
|
|
664
|
-
* User root path
|
|
665
|
-
* @default process.cwd()
|
|
666
|
-
*/
|
|
667
|
-
userRoot: string;
|
|
668
|
-
/**
|
|
669
|
-
* Theme root path
|
|
670
|
-
*/
|
|
671
|
-
themeRoot: string;
|
|
672
|
-
/**
|
|
673
|
-
* Addon root path
|
|
674
|
-
*/
|
|
675
|
-
addonRoots: string[];
|
|
676
|
-
/**
|
|
677
|
-
* clientRoot, themeRoot, ...addonRoots, userRoot
|
|
678
|
-
*/
|
|
679
|
-
roots: string[];
|
|
680
|
-
theme: string;
|
|
681
|
-
/**
|
|
682
|
-
* Valaxy Config
|
|
683
|
-
*/
|
|
684
|
-
config: ValaxyNodeConfig<ThemeConfig> & {
|
|
685
|
-
/**
|
|
686
|
-
* Generated Runtime Config
|
|
687
|
-
*/
|
|
688
|
-
runtimeConfig: RuntimeConfig;
|
|
689
|
-
};
|
|
690
|
-
/**
|
|
691
|
-
* config file path
|
|
692
|
-
*/
|
|
693
|
-
configFile: string;
|
|
694
|
-
siteConfigFile: string;
|
|
695
|
-
themeConfigFile: string;
|
|
696
|
-
pages: string[];
|
|
697
|
-
/**
|
|
698
|
-
* all addons
|
|
699
|
-
* Record<package-name, OptionResolver>
|
|
700
|
-
*/
|
|
701
|
-
addons: ValaxyAddonResolver[];
|
|
702
|
-
/**
|
|
703
|
-
* Collect redirect rule
|
|
704
|
-
*/
|
|
705
|
-
redirects: RedirectItem[];
|
|
706
|
-
env: MarkdownEnv & {
|
|
707
|
-
links: string[];
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
interface ValaxyServerOptions {
|
|
711
|
-
onConfigReload?: (newConfig: ValaxyNodeConfig, config: ValaxyNodeConfig, force?: boolean) => void;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Post process valaxyOptions
|
|
715
|
-
* @param valaxyOptions
|
|
716
|
-
* @param valaxyConfig
|
|
717
|
-
*/
|
|
718
|
-
declare function processValaxyOptions(valaxyOptions: ResolvedValaxyOptions, valaxyConfig: ValaxyNodeConfig): Promise<ResolvedValaxyOptions<DefaultTheme.Config>>;
|
|
719
|
-
declare function resolveOptions(options?: ValaxyEntryOptions, mode?: ResolvedValaxyOptions['mode']): Promise<ResolvedValaxyOptions<DefaultTheme.Config>>;
|
|
720
|
-
/**
|
|
721
|
-
* resolve theme config
|
|
722
|
-
* @param options
|
|
723
|
-
*/
|
|
724
|
-
declare function resolveThemeValaxyConfig(options: ResolvedValaxyOptions): Promise<any>;
|
|
720
|
+
type ValaxyAddonLike = ValaxyAddon | false | null | undefined;
|
|
721
|
+
type ValaxyAddons = (ValaxyAddon | string)[] | Record<string, ValaxyAddonLike>;
|
|
722
|
+
type ValaxyAddonFn<ThemeConfig = DefaultTheme.Config> = (addonOptions: ValaxyAddonResolver, valaxyOptions: ResolvedValaxyOptions<ThemeConfig>) => ValaxyNodeConfig | Promise<ValaxyNodeConfig>;
|
|
723
|
+
type ValaxyAddonExport<ThemeConfig = DefaultTheme.Config> = ValaxyNodeConfig<ThemeConfig> | ValaxyAddonFn<ThemeConfig>;
|
|
725
724
|
|
|
726
725
|
declare function build(valaxyApp: ValaxyNode, viteConfig?: InlineConfig): Promise<void>;
|
|
727
726
|
declare function ssgBuild(valaxyApp: ValaxyNode, viteConfig?: InlineConfig): Promise<void>;
|
|
@@ -745,13 +744,13 @@ declare function mergeViteConfigs({ userRoot, themeRoot }: ResolvedValaxyOptions
|
|
|
745
744
|
*/
|
|
746
745
|
declare function getIndexHtml({ clientRoot, themeRoot, userRoot, config }: ResolvedValaxyOptions, rawHtml: string): Promise<string>;
|
|
747
746
|
|
|
748
|
-
declare function defineValaxyAddon<AddonOptions = object>(addonFunc: (addonOptions?: AddonOptions, valaxyOptions?: ResolvedValaxyOptions) => ValaxyAddon
|
|
747
|
+
declare function defineValaxyAddon<AddonOptions = object>(addonFunc: (addonOptions?: AddonOptions, valaxyOptions?: ResolvedValaxyOptions) => ValaxyAddon & {
|
|
749
748
|
setup?: ValaxyAddonResolver['setup'];
|
|
750
|
-
}): (addonOptions?: AddonOptions, valaxyOptions?: ResolvedValaxyOptions) => ValaxyAddon
|
|
749
|
+
}): (addonOptions?: AddonOptions, valaxyOptions?: ResolvedValaxyOptions) => ValaxyAddon & {
|
|
751
750
|
setup?: ValaxyAddonResolver["setup"];
|
|
752
751
|
};
|
|
753
752
|
declare const defineAddon: typeof defineValaxyAddon;
|
|
754
|
-
declare function resolveAddonsConfig(addons: ValaxyAddonResolver[], options: ResolvedValaxyOptions): Promise<
|
|
753
|
+
declare function resolveAddonsConfig(addons: ValaxyAddonResolver[], options: ResolvedValaxyOptions): Promise<ValaxyNodeConfig>;
|
|
755
754
|
|
|
756
755
|
interface LoadConfigFromFileOptions {
|
|
757
756
|
cwd?: string;
|
|
@@ -769,24 +768,24 @@ declare const defaultSiteConfig: SiteConfig;
|
|
|
769
768
|
* Type helper for site.config.ts
|
|
770
769
|
* @param config
|
|
771
770
|
*/
|
|
772
|
-
declare function defineSiteConfig(config: UserSiteConfig):
|
|
771
|
+
declare function defineSiteConfig(config: UserSiteConfig): PartialDeep<SiteConfig>;
|
|
773
772
|
/**
|
|
774
773
|
* resolve valaxy config from special root
|
|
775
774
|
*/
|
|
776
|
-
declare function resolveSiteConfigFromRoot(root: string): Promise<ResolvedConfig<
|
|
775
|
+
declare function resolveSiteConfigFromRoot(root: string): Promise<ResolvedConfig<PartialDeep<SiteConfig>>>;
|
|
777
776
|
/**
|
|
778
777
|
* resolve site.config.ts and merge with default
|
|
779
778
|
* @param root
|
|
780
779
|
*/
|
|
781
780
|
declare function resolveSiteConfig(root: string): Promise<{
|
|
782
|
-
siteConfig:
|
|
781
|
+
siteConfig: PartialDeep<SiteConfig>;
|
|
783
782
|
siteConfigFile: string;
|
|
784
783
|
}>;
|
|
785
784
|
|
|
786
785
|
/**
|
|
787
786
|
* resolve theme config from special root
|
|
788
787
|
*/
|
|
789
|
-
declare function resolveThemeConfigFromRoot(root: string): Promise<ResolvedConfig<DefaultTheme
|
|
788
|
+
declare function resolveThemeConfigFromRoot(root: string): Promise<ResolvedConfig<DefaultTheme.Config>>;
|
|
790
789
|
/**
|
|
791
790
|
* resolve theme.config.ts and merge with default
|
|
792
791
|
*/
|
|
@@ -794,24 +793,24 @@ declare function resolveUserThemeConfig(options: {
|
|
|
794
793
|
userRoot: string;
|
|
795
794
|
themeRoot: string;
|
|
796
795
|
}): Promise<{
|
|
797
|
-
themeConfig: DefaultTheme
|
|
796
|
+
themeConfig: DefaultTheme.Config;
|
|
798
797
|
themeConfigFile: string;
|
|
799
798
|
}>;
|
|
800
799
|
type ValaxyConfigExtendKey = 'vite' | 'vue' | 'unocss' | 'unocssPresets' | 'markdown' | 'extendMd' | 'addons';
|
|
801
800
|
type ValaxyPickConfig = Pick<ValaxyNodeConfig, ValaxyConfigExtendKey>;
|
|
802
|
-
type ValaxyTheme<ThemeConfig = DefaultTheme
|
|
801
|
+
type ValaxyTheme<ThemeConfig = DefaultTheme.Config> = ValaxyPickConfig & {
|
|
803
802
|
themeConfig?: ThemeConfig;
|
|
804
803
|
};
|
|
805
|
-
declare function defineValaxyTheme<ThemeConfig = DefaultTheme
|
|
804
|
+
declare function defineValaxyTheme<ThemeConfig = DefaultTheme.Config>(theme: ValaxyTheme<ThemeConfig> | ((options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyTheme<ThemeConfig>)): ValaxyTheme<ThemeConfig> | ((options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyTheme<ThemeConfig>);
|
|
806
805
|
declare const defineTheme: typeof defineValaxyTheme;
|
|
807
806
|
|
|
808
807
|
declare const defaultValaxyConfig: ValaxyNodeConfig;
|
|
809
808
|
/**
|
|
810
809
|
* Type helper for valaxy.config.ts
|
|
811
810
|
*/
|
|
812
|
-
declare function defineValaxyConfig<ThemeConfig>(config: UserValaxyNodeConfig<ThemeConfig>): PartialDeep<
|
|
811
|
+
declare function defineValaxyConfig<ThemeConfig>(config: UserValaxyNodeConfig<ThemeConfig>): PartialDeep<ValaxyNodeConfig<ThemeConfig>>;
|
|
813
812
|
declare const defineConfig: typeof defineValaxyConfig;
|
|
814
|
-
declare function resolveValaxyConfigFromRoot(root: string, options?: ResolvedValaxyOptions): Promise<ResolvedConfig<
|
|
813
|
+
declare function resolveValaxyConfigFromRoot(root: string, options?: ResolvedValaxyOptions): Promise<ResolvedConfig<ValaxyNodeConfig>>;
|
|
815
814
|
/**
|
|
816
815
|
* merge valaxy.config
|
|
817
816
|
* (source, default)
|
|
@@ -831,9 +830,9 @@ declare const mergeValaxyConfig: <Source extends {
|
|
|
831
830
|
* @param options
|
|
832
831
|
*/
|
|
833
832
|
declare function resolveValaxyConfig(options: ValaxyEntryOptions): Promise<{
|
|
834
|
-
config:
|
|
833
|
+
config: ValaxyNodeConfig;
|
|
835
834
|
configFile: string;
|
|
836
|
-
theme:
|
|
835
|
+
theme: string;
|
|
837
836
|
}>;
|
|
838
837
|
|
|
839
838
|
type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
|
|
@@ -856,6 +855,19 @@ declare const GLOBAL_STATE: {
|
|
|
856
855
|
server: ViteDevServer | undefined;
|
|
857
856
|
};
|
|
858
857
|
|
|
858
|
+
/**
|
|
859
|
+
* Post process valaxyOptions
|
|
860
|
+
* @param valaxyOptions
|
|
861
|
+
* @param valaxyConfig
|
|
862
|
+
*/
|
|
863
|
+
declare function processValaxyOptions(valaxyOptions: ResolvedValaxyOptions, valaxyConfig: ValaxyNodeConfig): Promise<ResolvedValaxyOptions<DefaultTheme.Config>>;
|
|
864
|
+
declare function resolveOptions(options?: ValaxyEntryOptions, mode?: ResolvedValaxyOptions['mode']): Promise<ResolvedValaxyOptions<DefaultTheme.Config>>;
|
|
865
|
+
/**
|
|
866
|
+
* resolve theme config
|
|
867
|
+
* @param options
|
|
868
|
+
*/
|
|
869
|
+
declare function resolveThemeValaxyConfig(options: ResolvedValaxyOptions): Promise<ValaxyNodeConfig>;
|
|
870
|
+
|
|
859
871
|
declare function ViteValaxyPlugins(valaxyApp: ValaxyNode, serverOptions?: ValaxyServerOptions): Promise<(PluginOption | PluginOption[])[]>;
|
|
860
872
|
|
|
861
873
|
/**
|
|
@@ -877,6 +889,16 @@ declare function createValaxyPlugin(options: ResolvedValaxyOptions, serverOption
|
|
|
877
889
|
declare function getServerInfoText(msg: string): string;
|
|
878
890
|
declare function createServer(valaxyApp: ValaxyNode, viteConfig?: InlineConfig, serverOptions?: ValaxyServerOptions): Promise<vite.ViteDevServer>;
|
|
879
891
|
|
|
892
|
+
/**
|
|
893
|
+
* @see https://github.com/mdn/dom-examples/blob/main/web-crypto/encrypt-decrypt/aes-cbc.js
|
|
894
|
+
* @param content
|
|
895
|
+
*/
|
|
896
|
+
declare function encryptContent(content: string, options: {
|
|
897
|
+
password: string;
|
|
898
|
+
iv: Uint8Array;
|
|
899
|
+
salt: Uint8Array;
|
|
900
|
+
}): Promise<string>;
|
|
901
|
+
|
|
880
902
|
declare function getGitTimestamp(file: string, type?: 'created' | 'updated'): Promise<number>;
|
|
881
903
|
|
|
882
904
|
/**
|
|
@@ -916,5 +938,5 @@ declare function toAtFS(path: string): string;
|
|
|
916
938
|
declare function resolveImportPath(importName: string, ensure?: true): Promise<string>;
|
|
917
939
|
declare function resolveImportPath(importName: string, ensure?: boolean): Promise<string | undefined>;
|
|
918
940
|
|
|
919
|
-
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, 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 };
|
|
941
|
+
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 };
|
|
920
942
|
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 };
|