valaxy 1.1.0 → 1.2.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.
@@ -0,0 +1,359 @@
1
+ /**
2
+ * Runtime for `virtual:generated-layouts` (generated by `node/plugins/layouts.ts`).
3
+ *
4
+ * Ported from vite-plugin-vue-layouts-next@3.2.0 (MIT, https://github.com/loicduong/vite-plugin-vue-layouts-next)
5
+ * with unchanged behavior: `meta.layout` (name, `false` or `{ name, props }`), `meta.layoutProps`,
6
+ * the default/fallback layout, lazy-layout preloading, `setPageLayout` and `useLayout`.
7
+ */
8
+ import type { Component, ComputedRef } from 'vue'
9
+ import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, Router, RouteRecordNormalized, RouteRecordRaw } from 'vue-router'
10
+ import { computed, defineAsyncComponent, defineComponent, h, hasInjectionContext, inject, shallowRef } from 'vue'
11
+ import { matchedRouteKey, routerKey, RouterView, START_LOCATION, useRoute, useRouter } from 'vue-router'
12
+
13
+ export type LayoutName = string | false
14
+ export type LayoutProps = Record<string, unknown>
15
+
16
+ /** Object form of `meta.layout`. */
17
+ export interface LayoutOptions {
18
+ /** Layout name, `false` for no layout, or omitted for the default layout. */
19
+ name?: LayoutName
20
+ props?: LayoutProps
21
+ }
22
+
23
+ export type LayoutMeta = LayoutName | LayoutOptions
24
+
25
+ const LAZY = Symbol.for('valaxy:layouts:lazy')
26
+
27
+ export type LazyLayout = (() => Promise<{ default: Component } | Component>) & { [LAZY]: true }
28
+ export type LayoutMap = Record<string, Component | LazyLayout>
29
+
30
+ interface ResolvedLayout {
31
+ name: LayoutName
32
+ props?: LayoutProps
33
+ }
34
+
35
+ type Meta = Record<string, any> | undefined
36
+
37
+ function readLayoutMeta(meta: Meta): { name: LayoutName | undefined, props?: LayoutProps } {
38
+ const layout = meta?.layout
39
+ if (layout !== null && typeof layout === 'object') {
40
+ return {
41
+ name: layout.name,
42
+ props: layout.props ?? meta?.layoutProps,
43
+ }
44
+ }
45
+ return {
46
+ name: layout,
47
+ props: meta?.layoutProps,
48
+ }
49
+ }
50
+
51
+ function declaresLayout(meta: Meta) {
52
+ const layout = meta?.layout
53
+ if (layout !== null && typeof layout === 'object')
54
+ return layout.name !== false
55
+ return !!layout
56
+ }
57
+
58
+ /** Without `withLayout`, the returned getter hides the generated layout routes. */
59
+ export function createGetRoutes(router: Router, withLayout: true): RouteRecordNormalized[]
60
+ export function createGetRoutes(router: Router, withLayout?: false): () => RouteRecordNormalized[]
61
+ export function createGetRoutes(router: Router, withLayout = false) {
62
+ const routes = router.getRoutes()
63
+ if (withLayout)
64
+ return routes
65
+ return () => routes.filter(route => !route.meta.isLayout)
66
+ }
67
+
68
+ function hasChildWithLayout(route: RouteRecordRaw): boolean {
69
+ if (!route.children || route.children.length === 0)
70
+ return false
71
+ return route.children.some((child) => {
72
+ if (declaresLayout(child.meta))
73
+ return true
74
+ if (child.meta?.isLayout)
75
+ return true
76
+ return hasChildWithLayout(child)
77
+ })
78
+ }
79
+
80
+ export interface SetupLayoutsOptions {
81
+ inheritDefaultLayout: boolean
82
+ }
83
+
84
+ export function createSetupLayouts(wrapper: Component, options: SetupLayoutsOptions) {
85
+ const { inheritDefaultLayout } = options
86
+
87
+ function wrap(route: RouteRecordRaw, keepRootPath: boolean): RouteRecordRaw {
88
+ return {
89
+ path: route.path,
90
+ component: wrapper,
91
+ children: keepRootPath && route.path === '/' ? [route] : [{ ...route, path: '' } as RouteRecordRaw],
92
+ meta: { isLayout: true },
93
+ } as RouteRecordRaw
94
+ }
95
+
96
+ function deepSetupLayout(routes: RouteRecordRaw[], top = true): RouteRecordRaw[] {
97
+ return routes.map((route) => {
98
+ const childHasLayout = top && !inheritDefaultLayout && (route.children?.length ?? 0) > 0
99
+ ? hasChildWithLayout(route)
100
+ : false
101
+ if (route.children && route.children.length > 0)
102
+ route.children = deepSetupLayout(route.children, false)
103
+ if (top) {
104
+ if (!route.component && route.children?.find(r => (r.path === '' || r.path === '/') && r.meta?.isLayout))
105
+ return route
106
+ if (readLayoutMeta(route.meta).name !== false) {
107
+ if (inheritDefaultLayout || !childHasLayout)
108
+ return wrap(route, true)
109
+ }
110
+ }
111
+ if (declaresLayout(route.meta))
112
+ return wrap(route, false)
113
+ return route
114
+ })
115
+ }
116
+
117
+ return (routes: readonly RouteRecordRaw[]) => deepSetupLayout(routes as RouteRecordRaw[])
118
+ }
119
+
120
+ /**
121
+ * The virtual module wraps its async imports with this, so a lazy entry is always
122
+ * identified explicitly rather than guessed from its shape - unlike Vue Router's route
123
+ * components, a bare functional component is a perfectly valid, non-lazy layout here.
124
+ */
125
+ export function lazyLayout(loader: () => Promise<{ default: Component } | Component>): LazyLayout {
126
+ return Object.assign(loader, { [LAZY]: true as const })
127
+ }
128
+
129
+ function isLazyLayout(entry: unknown): entry is LazyLayout {
130
+ return typeof entry === 'function' && (entry as any)[LAZY] === true
131
+ }
132
+
133
+ const PREFIX = '[valaxy:layouts]'
134
+
135
+ /** In-place override set by `setPageLayout`; cleared on navigation to another path. */
136
+ const override = shallowRef<ResolvedLayout | null>(null)
137
+ const guardedRouters = new WeakSet<Router>()
138
+ /** `defaultLayout` of the last created wrapper; shared with `useLayout()`. */
139
+ let resolvedDefaultLayout = 'default'
140
+
141
+ /**
142
+ * Change the layout of the current page without navigating, optionally passing props
143
+ * to the layout component. The override lasts until the router navigates to a different `path`.
144
+ */
145
+ export function setPageLayout(name: LayoutName | null | undefined, props?: LayoutProps) {
146
+ override.value = name == null ? null : { name, props }
147
+ }
148
+
149
+ /**
150
+ * Reactive name of the layout resolved for the current route.
151
+ * `false` when no wrapper is rendered around it (a static `layout: false` route, or
152
+ * one deliberately left unwrapped because `inheritDefaultLayout` is `false`).
153
+ */
154
+ export function useLayout(): ComputedRef<LayoutName> {
155
+ const route = useRoute()
156
+ return computed(() => {
157
+ const own = innermostLayoutRecord(route)
158
+ if (!own)
159
+ return false
160
+ return resolveLayoutFor(route, own, override.value).name
161
+ })
162
+ }
163
+
164
+ function innermostLayoutRecord(route: RouteLocationNormalizedLoaded) {
165
+ const { matched } = route
166
+ for (let i = matched.length - 1; i >= 0; i--) {
167
+ if (matched[i].meta.isLayout)
168
+ return matched[i]
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Layout (name and props) the wrapper whose generated record is `own` renders for `route`.
174
+ *
175
+ * The static layout comes from the wrapped record's own meta (`||` fallback to the
176
+ * default), so nested trees keep one layout per level. Dynamic inputs - the
177
+ * `setPageLayout` override and a guard assignment to the merged `route.meta.layout` /
178
+ * `route.meta.layoutProps` - apply only to the innermost wrapper. A dynamic layout
179
+ * brings its own props and never inherits the page's static ones.
180
+ */
181
+ function resolveLayoutFor(route: RouteLocationNormalized, own: RouteRecordNormalized, overrideValue: ResolvedLayout | null): ResolvedLayout {
182
+ const { matched } = route
183
+ const idx = matched.indexOf(own)
184
+ const page = readLayoutMeta(matched[idx + 1]?.meta)
185
+ const staticLayout: ResolvedLayout = {
186
+ name: page.name || resolvedDefaultLayout,
187
+ props: page.props,
188
+ }
189
+ if (matched.slice(idx + 2).some(r => r.meta.isLayout))
190
+ return staticLayout
191
+ if (overrideValue)
192
+ return overrideValue
193
+
194
+ const meta = route.meta as Record<string, any>
195
+ const staticMerged = matched.reduce<unknown>((m, r) => (r.meta as Meta)?.layout ?? m, undefined)
196
+ const staticMergedProps = matched.reduce<unknown>((m, r) => (r.meta as Meta)?.layoutProps ?? m, undefined)
197
+ const guardProps = meta.layoutProps !== staticMergedProps ? meta.layoutProps : undefined
198
+ if (meta.layout != null && meta.layout !== staticMerged) {
199
+ const guard = readLayoutMeta({ layout: meta.layout, layoutProps: guardProps })
200
+ return {
201
+ name: guard.name ?? resolvedDefaultLayout,
202
+ props: guard.props,
203
+ }
204
+ }
205
+ return {
206
+ name: staticLayout.name,
207
+ props: guardProps ?? staticLayout.props,
208
+ }
209
+ }
210
+
211
+ function unwrapModule(mod: any) {
212
+ return mod && typeof mod === 'object' && 'default' in mod ? mod.default : mod
213
+ }
214
+
215
+ /** Options-API navigation guards that never run on a layout component (see `checkRouteGuards`). */
216
+ const ROUTE_GUARD_NAMES = ['beforeRouteEnter', 'beforeRouteUpdate', 'beforeRouteLeave'] as const
217
+
218
+ /** `fallbackLayout` is rendered when the requested layout is not in `layouts`; if it is missing too, the page renders without a layout. */
219
+ export function createLayoutWrapper(layouts: LayoutMap, defaultLayout: string, fallbackLayout = defaultLayout): Component {
220
+ resolvedDefaultLayout = defaultLayout
221
+ /** Lazy layouts already loaded (by the `beforeResolve` preload or an async render). */
222
+ const resolved = new Map<string, Component>()
223
+ /** In-flight loads, so a layout's factory runs at most once. */
224
+ const pending = new Map<string, Promise<Component>>()
225
+ /** `defineAsyncComponent` per name, for renders that happen before the preload. */
226
+ const asyncCache = new Map<string, Component>()
227
+ const warned = new Set<string>()
228
+ let fallbackWarned = false
229
+ const guardWarned = new Set<string>()
230
+
231
+ /**
232
+ * Layouts are rendered by `LayoutWrapper`, not matched as route components, so Vue
233
+ * Router never calls their Options-API route guards; the Composition-API
234
+ * `onBeforeRouteUpdate`/`onBeforeRouteLeave` still work since they subscribe directly
235
+ * to the router. Skipped for a `defineAsyncComponent` wrapper that hasn't resolved
236
+ * yet - the caller passes the real component once loaded.
237
+ */
238
+ function checkRouteGuards(name: string, comp: any) {
239
+ if (guardWarned.has(name) || !comp || (typeof comp !== 'object' && typeof comp !== 'function'))
240
+ return
241
+ const target = 'default' in comp ? comp.default : comp
242
+ if (!target)
243
+ return
244
+ const opts = target.__vccOpts ?? target
245
+ const guards = ROUTE_GUARD_NAMES.filter(g => opts?.[g])
246
+ if (guards.length > 0) {
247
+ guardWarned.add(name)
248
+ console.warn(`${PREFIX} Layout "${name}" declares ${guards.join(', ')}; layouts are not route components, so these guards will not run. Use onBeforeRouteUpdate/onBeforeRouteLeave or a router guard instead.`)
249
+ }
250
+ }
251
+
252
+ function load(name: string, loader: LazyLayout) {
253
+ let promise = pending.get(name)
254
+ if (!promise) {
255
+ promise = Promise.resolve(loader()).then((mod) => {
256
+ const component = unwrapModule(mod)
257
+ resolved.set(name, component)
258
+ return component
259
+ }, (error) => {
260
+ pending.delete(name)
261
+ throw error
262
+ })
263
+ pending.set(name, promise)
264
+ }
265
+ return promise
266
+ }
267
+
268
+ function resolveComponent(name: string): Component | undefined {
269
+ const loaded = resolved.get(name)
270
+ if (loaded) {
271
+ checkRouteGuards(name, loaded)
272
+ return loaded
273
+ }
274
+ const entry = layouts[name]
275
+ if (!entry)
276
+ return undefined
277
+ if (isLazyLayout(entry)) {
278
+ let created = asyncCache.get(name)
279
+ if (!created) {
280
+ created = defineAsyncComponent(() => load(name, entry))
281
+ asyncCache.set(name, created)
282
+ }
283
+ return created
284
+ }
285
+ checkRouteGuards(name, entry)
286
+ return entry
287
+ }
288
+
289
+ function resolveLayout(name: string) {
290
+ const found = resolveComponent(name)
291
+ if (found)
292
+ return found
293
+ if (!warned.has(name)) {
294
+ warned.add(name)
295
+ console.warn(`${PREFIX} Layout "${name}" not found, falling back to "${fallbackLayout}"`)
296
+ }
297
+ const fallback = resolveComponent(fallbackLayout)
298
+ if (!fallback && !fallbackWarned) {
299
+ fallbackWarned = true
300
+ console.warn(`${PREFIX} Fallback layout "${fallbackLayout}" not found, rendering without a layout`)
301
+ }
302
+ return fallback
303
+ }
304
+
305
+ const preload = async (to: RouteLocationNormalized, from: RouteLocationNormalized) => {
306
+ const keepOverride = from === START_LOCATION || to.path === from.path
307
+ for (const rec of to.matched) {
308
+ if (!rec.meta.isLayout)
309
+ continue
310
+ const { name } = resolveLayoutFor(to, rec, keepOverride ? override.value : null)
311
+ if (name === false)
312
+ continue
313
+ const key = layouts[name] ? name : fallbackLayout
314
+ const entry = layouts[key]
315
+ if (isLazyLayout(entry) && !resolved.has(key))
316
+ await load(key, entry)
317
+ }
318
+ }
319
+
320
+ function installGuards(router: Router) {
321
+ if (guardedRouters.has(router))
322
+ return
323
+ guardedRouters.add(router)
324
+ router.beforeResolve(preload)
325
+ router.afterEach((to, from, failure) => {
326
+ if (failure)
327
+ return
328
+ if (from !== START_LOCATION && to.path !== from.path)
329
+ override.value = null
330
+ })
331
+ }
332
+
333
+ return defineComponent({
334
+ name: 'LayoutWrapper',
335
+ beforeRouteEnter(to, from) {
336
+ if (hasInjectionContext()) {
337
+ const router = inject(routerKey, null)
338
+ if (router)
339
+ installGuards(router)
340
+ }
341
+ return preload(to, from)
342
+ },
343
+ setup() {
344
+ const route = useRoute()
345
+ const own = inject(matchedRouteKey)!
346
+ installGuards(useRouter())
347
+ const layout = computed(() => resolveLayoutFor(route, own.value!, override.value))
348
+ return () => {
349
+ const { name, props } = layout.value
350
+ if (name === false)
351
+ return h(RouterView)
352
+ const LayoutComponent = resolveLayout(name)
353
+ return LayoutComponent
354
+ ? h(LayoutComponent, props ? { ...props } : null, { default: () => h(RouterView) })
355
+ : h(RouterView)
356
+ }
357
+ },
358
+ })
359
+ }
@@ -7,6 +7,36 @@ function joinPath(base: string, path: string): string {
7
7
  return `${base}${path}`.replace(/\/+/g, '/')
8
8
  }
9
9
 
10
+ /**
11
+ * Decode a percent-encoded URL path (`/posts/%E4%B8%AD` → `/posts/中`).
12
+ *
13
+ * Route records and `route.path` are percent-encoded, while file names, config
14
+ * links and collection keys are written raw. Decode before comparing them.
15
+ * Malformed sequences return the path unchanged.
16
+ */
17
+ export function decodePath(path: string): string {
18
+ try {
19
+ return decodeURI(path)
20
+ }
21
+ catch {
22
+ return path
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Check whether a page file path (`/posts/中文.md`, `/guide/index.md`) is the page
28
+ * shown at a browser `pathname` (`/base/posts/%E4%B8%AD%E6%96%87`).
29
+ */
30
+ export function isSamePagePath(filePath: string, pathname: string, base = '/'): boolean {
31
+ const pagePath = filePath.replace(/(?:(^|\/)index)?\.md$/, '$1')
32
+ let locationPath = decodePath(pathname).replace(/(?:(^|\/)index)?\.html$/, '$1')
33
+ if (base !== '/' && locationPath.startsWith(base))
34
+ locationPath = locationPath.slice(base.length - 1)
35
+
36
+ const withSlash = (path: string) => path.endsWith('/') ? path : `${path}/`
37
+ return withSlash(pagePath) === withSlash(locationPath)
38
+ }
39
+
10
40
  /**
11
41
  * Append Vite's resolved base to an internal root-absolute URL.
12
42
  * External and relative URLs are returned unchanged.
@@ -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, a2 as run, a4 as startValaxyDev } from '../../shared/valaxy.BU27Owzs.mjs';
5
+ export { c as createCli, s as desktopRuntimeVersion, u as execBuild, O as registerDevCommand, a2 as run, a4 as startValaxyDev } from '../../shared/valaxy.DvkRJomf.mjs';
6
6
  import 'node:os';
7
7
  import 'consola';
8
8
  import 'consola/utils';
@@ -19,11 +19,13 @@ import 'node:crypto';
19
19
  import 'floating-vue';
20
20
  import 'define-config-ts';
21
21
  import 'ora';
22
+ import 'node:buffer';
22
23
  import 'cross-spawn';
23
24
  import 'mlly';
24
25
  import 'resolve-global';
25
26
  import '@valaxyjs/utils';
26
27
  import 'node:fs';
28
+ import 'picomatch';
27
29
  import 'node:fs/promises';
28
30
  import 'dayjs';
29
31
  import 'feed';
@@ -33,23 +35,14 @@ import 'hookable';
33
35
  import '@unhead/bundler/vite';
34
36
  import 'vitepress-plugin-group-icons';
35
37
  import 'local-pkg';
36
- import 'picomatch';
37
38
  import 'chokidar';
38
39
  import 'unplugin';
39
40
  import 'unplugin-utils';
40
41
  import 'obug';
41
42
  import 'magic-string';
42
- import 'node:buffer';
43
43
  import 'p-map';
44
44
  import 'pascalcase';
45
- import '@intlify/shared';
46
- import '@intlify/bundle-utils';
47
- import '@rollup/pluginutils';
48
- import 'vue/compiler-sfc';
49
- import 'picocolors';
50
- import '@eslint-community/eslint-utils';
51
- import '@intlify/vue-i18n-extensions';
52
- import '@typescript-eslint/scope-manager';
45
+ import '@intlify/unplugin-vue-i18n/vite';
53
46
  import 'minisearch';
54
47
  import '@shikijs/transformers';
55
48
  import 'lru-cache';
@@ -1,4 +1,4 @@
1
- import { Plugin, UserConfig, InlineConfig, ViteDevServer, PluginOption } from 'vite';
1
+ import { UserConfig, InlineConfig, ViteDevServer, PluginOption, Plugin } from 'vite';
2
2
  import { SiteConfig, DefaultTheme, RuntimeConfig, RedirectItem, ValaxyConfig, PartialDeep, ValaxyAddon, UserSiteConfig } from '../types/index.mjs';
3
3
  import Vue from '@vitejs/plugin-vue';
4
4
  import { Hookable } from 'hookable';
@@ -26,48 +26,6 @@ import 'vue-router';
26
26
  import '@vueuse/core';
27
27
  import '@unhead/schema-org';
28
28
 
29
- //#region src/types.d.ts
30
- interface Options {
31
- /**
32
- * Relative path to the directory to search for layout components.
33
- * @default 'src/layouts'
34
- */
35
- layoutsDirs: string | string[];
36
- /**
37
- * Valid file extensions for layout components.
38
- * @default ['vue']
39
- */
40
- extensions: string[];
41
- /**
42
- * List of path globs to exclude when resolving layouts.
43
- */
44
- exclude: string[];
45
- /**
46
- * Normalized layout name/key to use as the default layout
47
- * (for example, myDefault.vue -> my-default)
48
- * @default 'default'
49
- */
50
- defaultLayout: string;
51
- /**
52
- * Layout name/key to render when a page asks for a layout that does not exist.
53
- * Defaults to `defaultLayout`.
54
- */
55
- fallbackLayout?: string;
56
- /**
57
- * `sync` bundles a layout into the main chunk, `async` lazy-loads it.
58
- * Defaults to `sync` for `default` (and for every layout under `VITE_SSG`), `async` otherwise.
59
- */
60
- importMode: (name: string) => 'sync' | 'async';
61
- /**
62
- * Whether nested routes should inherit the default layout from parent routes.
63
- * When false, if a child route has its own layout, the parent route won't use the default layout.
64
- * @default true
65
- */
66
- inheritDefaultLayout: boolean;
67
- }
68
- type UserOptions = Partial<Options>;
69
- declare function Layout(userOptions?: UserOptions): Plugin;
70
-
71
29
  interface ValaxyFileInfo {
72
30
  /**
73
31
  * file path id
@@ -104,6 +62,58 @@ declare class StateManager {
104
62
  */
105
63
  declare function createValaxyNode(options: ResolvedValaxyOptions): ValaxyNode;
106
64
 
65
+ /**
66
+ * Valaxy's layout system: scans `layouts/` in every root and serves
67
+ * `virtual:generated-layouts`. The client runtime lives in `client/utils/layouts.ts`.
68
+ *
69
+ * Options, layout-name normalization and runtime behavior follow
70
+ * vite-plugin-vue-layouts-next@3.2.0 (MIT, https://github.com/loicduong/vite-plugin-vue-layouts-next),
71
+ * so existing `layouts` configs and `meta.layout` values keep working.
72
+ */
73
+
74
+ type LayoutImportMode = 'sync' | 'async';
75
+ interface LayoutsOptions {
76
+ /**
77
+ * Directories to search for layout components, absolute or relative to the user root.
78
+ * Entries containing `**` are expanded to every matching directory.
79
+ * Later directories override layouts with the same name from earlier ones.
80
+ * @default roots.map(root => `${root}/layouts`) (core → theme → addons → user)
81
+ */
82
+ layoutsDirs: string | string[];
83
+ /**
84
+ * Valid file extensions for layout components.
85
+ * @default ['vue']
86
+ */
87
+ extensions: string[];
88
+ /**
89
+ * List of path globs to exclude when resolving layouts.
90
+ */
91
+ exclude: string[];
92
+ /**
93
+ * Normalized layout name/key to use as the default layout
94
+ * (for example, myDefault.vue -> my-default)
95
+ * @default 'default'
96
+ */
97
+ defaultLayout: string;
98
+ /**
99
+ * Layout name/key to render when a page asks for a layout that does not exist.
100
+ * Defaults to `defaultLayout`.
101
+ */
102
+ fallbackLayout?: string;
103
+ /**
104
+ * `sync` bundles a layout into the main chunk, `async` lazy-loads it.
105
+ * Defaults to `sync` for every layout in builds (SSG hydration needs it),
106
+ * otherwise `sync` for `default` and `async` for the rest.
107
+ */
108
+ importMode: (name: string) => LayoutImportMode;
109
+ /**
110
+ * Whether nested routes should inherit the default layout from parent routes.
111
+ * When false, if a child route has its own layout, the parent route won't use the default layout.
112
+ * @default true
113
+ */
114
+ inheritDefaultLayout: boolean;
115
+ }
116
+
107
117
  interface MarkdownItHeader {
108
118
  /**
109
119
  * The level of the header
@@ -921,9 +931,10 @@ interface ValaxyExtendConfig {
921
931
  */
922
932
  components?: Parameters<typeof Components>[0];
923
933
  /**
924
- * @see https://github.com/loicduong/vite-plugin-vue-layouts-next
934
+ * Layout system options, compatible with vite-plugin-vue-layouts-next.
935
+ * @see https://valaxy.site/guide/custom/extend#automatic-layout-registration
925
936
  */
926
- layouts?: Parameters<typeof Layout>[0];
937
+ layouts?: Partial<LayoutsOptions>;
927
938
  /**
928
939
  * @see https://router.vuejs.org/file-based-routing/
929
940
  */
@@ -1320,6 +1331,18 @@ declare function getServerInfoText(msg: string): string;
1320
1331
  declare function createServer(valaxyApp: ValaxyNode, viteConfig?: InlineConfig, serverOptions?: ValaxyServerOptions): Promise<ViteDevServer>;
1321
1332
 
1322
1333
  /**
1334
+ * Encrypt content and return the ciphertext as base64.
1335
+ *
1336
+ * The ciphertext is embedded in the compiled page module, which UnoCSS scans
1337
+ * for utilities. A raw binary string (`String.fromCharCode` per byte) carries
1338
+ * quotes, brackets, `$`, `*` and backslashes, so random bytes could form
1339
+ * tokens like `p-["*(.]` that UnoCSS turns into unparsable CSS, failing the
1340
+ * build at random because salt/iv change on every build. Base64 has none of
1341
+ * those characters, and it is smaller once JSON-escaped.
1342
+ *
1343
+ * Breaking change: before this, the return value was a binary string (one char
1344
+ * per byte). Code that decodes it outside `useDecrypt` must now `atob` it first.
1345
+ *
1323
1346
  * @see https://github.com/mdn/dom-examples/blob/main/web-crypto/encrypt-decrypt/aes-cbc.js
1324
1347
  * @param content
1325
1348
  */
@@ -1,4 +1,4 @@
1
- export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as createCli, a as createContentService, d as createMemoryReleasePlugin, e as createServer, f as createValaxyNode, g as createValaxyPlugin, h as customElements, i as defaultSiteConfig, j as defaultValaxyConfig, k as defaultViteConfig, l as defineAddon, m as defineConfig, n as defineSiteConfig, o as defineTheme, p as defineValaxyAddon, q as defineValaxyConfig, r as defineValaxyTheme, s as desktopRuntimeVersion, t as encryptContent, u as execBuild, v as generateClientRedirects, w as getGitTimestamp, x as getIndexHtml, y as getServerInfoText, z as isExternal, B as isInstalledGlobally, C as isKatexEnabled, D as isKatexPluginNeeded, F as isMathJaxEnabled, H as isPath, I as loadAllContent, J as loadConfigFromFile, K as mergeValaxyConfig, L as mergeViteConfigs, M as postProcessForSSG, N as processValaxyOptions, O as registerDevCommand, Q as resolveAddonsConfig, R as resolveFootnoteConfig, T as resolveImportPath, U as resolveImportUrl, W as resolveOptions, X as resolveSiteConfig, Y as resolveSiteConfigFromRoot, Z as resolveThemeConfigFromRoot, _ as resolveThemeValaxyConfig, $ as resolveUserThemeConfig, a0 as resolveValaxyConfig, a1 as resolveValaxyConfigFromRoot, a2 as run, a3 as ssgBuild, a4 as startValaxyDev, a5 as toAtFS, a6 as transformObject, a7 as version } from '../shared/valaxy.BU27Owzs.mjs';
1
+ export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as createCli, a as createContentService, d as createMemoryReleasePlugin, e as createServer, f as createValaxyNode, g as createValaxyPlugin, h as customElements, i as defaultSiteConfig, j as defaultValaxyConfig, k as defaultViteConfig, l as defineAddon, m as defineConfig, n as defineSiteConfig, o as defineTheme, p as defineValaxyAddon, q as defineValaxyConfig, r as defineValaxyTheme, s as desktopRuntimeVersion, t as encryptContent, u as execBuild, v as generateClientRedirects, w as getGitTimestamp, x as getIndexHtml, y as getServerInfoText, z as isExternal, B as isInstalledGlobally, C as isKatexEnabled, D as isKatexPluginNeeded, F as isMathJaxEnabled, H as isPath, I as loadAllContent, J as loadConfigFromFile, K as mergeValaxyConfig, L as mergeViteConfigs, M as postProcessForSSG, N as processValaxyOptions, O as registerDevCommand, Q as resolveAddonsConfig, R as resolveFootnoteConfig, T as resolveImportPath, U as resolveImportUrl, W as resolveOptions, X as resolveSiteConfig, Y as resolveSiteConfigFromRoot, Z as resolveThemeConfigFromRoot, _ as resolveThemeValaxyConfig, $ as resolveUserThemeConfig, a0 as resolveValaxyConfig, a1 as resolveValaxyConfigFromRoot, a2 as run, a3 as ssgBuild, a4 as startValaxyDev, a5 as toAtFS, a6 as transformObject, a7 as version } from '../shared/valaxy.DvkRJomf.mjs';
2
2
  import 'node:path';
3
3
  import 'consola';
4
4
  import 'fs-extra';
@@ -19,11 +19,13 @@ import 'vite';
19
19
  import 'node:crypto';
20
20
  import 'floating-vue';
21
21
  import 'ora';
22
+ import 'node:buffer';
22
23
  import 'cross-spawn';
23
24
  import 'mlly';
24
25
  import 'resolve-global';
25
26
  import '@valaxyjs/utils';
26
27
  import 'node:fs';
28
+ import 'picomatch';
27
29
  import 'node:fs/promises';
28
30
  import 'dayjs';
29
31
  import 'feed';
@@ -33,23 +35,14 @@ import 'hookable';
33
35
  import '@unhead/bundler/vite';
34
36
  import 'vitepress-plugin-group-icons';
35
37
  import 'local-pkg';
36
- import 'picomatch';
37
38
  import 'chokidar';
38
39
  import 'unplugin';
39
40
  import 'unplugin-utils';
40
41
  import 'obug';
41
42
  import 'magic-string';
42
- import 'node:buffer';
43
43
  import 'p-map';
44
44
  import 'pascalcase';
45
- import '@intlify/shared';
46
- import '@intlify/bundle-utils';
47
- import '@rollup/pluginutils';
48
- import 'vue/compiler-sfc';
49
- import 'picocolors';
50
- import '@eslint-community/eslint-utils';
51
- import '@intlify/vue-i18n-extensions';
52
- import '@typescript-eslint/scope-manager';
45
+ import '@intlify/unplugin-vue-i18n/vite';
53
46
  import 'minisearch';
54
47
  import '@shikijs/transformers';
55
48
  import 'lru-cache';