valaxy 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/valaxy.mjs +1 -5
- package/client/components/ValaxyDecrypt.vue +6 -25
- package/client/components/ValaxyDynamicComponent.vue +13 -34
- package/client/components/ValaxyFootnoteTooltip.vue +140 -11
- package/client/composables/app/index.ts +1 -0
- package/client/composables/app/usePageSeo.ts +40 -0
- package/client/composables/app/useValaxyApp.ts +24 -23
- package/client/composables/app/useValaxyHead.ts +5 -12
- package/client/composables/dark.ts +8 -1
- package/client/composables/post/filter.ts +1 -1
- package/client/composables/post/index.ts +4 -4
- package/client/composables/search/index.ts +2 -0
- package/client/composables/search/package.json +4 -0
- package/client/composables/search/useFuseSearch.ts +1 -1
- package/client/composables/widgets/backToTop.ts +30 -6
- package/client/main.ts +6 -6
- package/client/runtime/ValaxyRuntimeTemplate.vue +26 -0
- package/client/setup/main.ts +0 -2
- package/client/shims.d.ts +4 -0
- package/client/stores/router.ts +12 -0
- package/client/stores/site.ts +5 -50
- package/client/utils/index.ts +1 -0
- package/client/utils/seo.ts +79 -0
- package/client/utils/time.ts +7 -4
- package/dist/node/cli/index.mjs +2 -3
- package/dist/node/index.d.mts +295 -48
- package/dist/node/index.mjs +2 -3
- package/dist/shared/{valaxy.BTmQYjWn.mjs → valaxy.Dpywjeor.mjs} +1266 -218
- package/dist/shared/{valaxy.EzGcrVef.d.mts → valaxy.Jqi53gnQ.d.mts} +42 -15
- package/dist/types/index.d.mts +2 -2
- package/package.json +4 -5
- package/shared/index.ts +2 -0
- package/shared/page-policy.ts +123 -0
- package/shared/seo.ts +182 -0
- package/types/config.ts +39 -17
- package/types/vue-router.d.ts +4 -0
- package/vendor/README.md +4 -4
- package/client/components/footnote/FootnotePopover.vue +0 -146
- package/client/components/footnote/LegacyFootnoteTooltip.vue +0 -25
- package/client/modules/floating-vue.ts +0 -11
- package/vendor/ensure-gray-matter.d.ts +0 -1
- package/vendor/ensure-gray-matter.mjs +0 -23
- package/vendor/redirect-gray-matter.mjs +0 -30
|
@@ -10,13 +10,12 @@ import fs from 'fs-extra';
|
|
|
10
10
|
import { glob, globSync } from 'tinyglobby';
|
|
11
11
|
import * as yaml from 'js-yaml';
|
|
12
12
|
import { dump, load, CORE_SCHEMA } from 'js-yaml';
|
|
13
|
-
import { isFunction, ensurePrefix, slash as slash$1, uniq, ensureSuffix, isObject } from '@antfu/utils';
|
|
13
|
+
import { isFunction, ensurePrefix, slash as slash$1, uniq as uniq$1, ensureSuffix, isObject } from '@antfu/utils';
|
|
14
14
|
import _debug from 'debug';
|
|
15
15
|
import path$1, { resolve as resolve$1, relative, isAbsolute, normalize, join as join$1, basename as basename$1, dirname as dirname$1 } from 'pathe';
|
|
16
16
|
import defu, { createDefu } from 'defu';
|
|
17
|
-
import { mergeConfig, loadConfigFromFile as loadConfigFromFile$1, searchForWorkspaceRoot, build as build$3, createServer as createServer$1 } from 'vite';
|
|
17
|
+
import { mergeConfig, loadConfigFromFile as loadConfigFromFile$1, normalizePath, searchForWorkspaceRoot, build as build$3, createServer as createServer$1 } from 'vite';
|
|
18
18
|
import { webcrypto, createHash } from 'node:crypto';
|
|
19
|
-
import { options } from 'floating-vue';
|
|
20
19
|
import { loadConfig } from 'define-config-ts';
|
|
21
20
|
import ora from 'ora';
|
|
22
21
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
@@ -26,7 +25,7 @@ import { resolveGlobal } from 'resolve-global';
|
|
|
26
25
|
import { normalizeRepositoryUrl } from '@valaxyjs/utils';
|
|
27
26
|
import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
28
27
|
import picomatch from 'picomatch';
|
|
29
|
-
import { readFile, mkdir, writeFile, realpath, rm, stat } from 'node:fs/promises';
|
|
28
|
+
import { readFile, mkdir, writeFile, realpath, copyFile, access, constants, rm, stat } from 'node:fs/promises';
|
|
30
29
|
import dayjs from 'dayjs';
|
|
31
30
|
import { Feed } from 'feed';
|
|
32
31
|
import { createMarkdownExit } from 'markdown-exit';
|
|
@@ -36,7 +35,7 @@ import { Unhead } from '@unhead/bundler/vite';
|
|
|
36
35
|
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';
|
|
37
36
|
import { isPackageExists } from 'local-pkg';
|
|
38
37
|
import chokidar from 'chokidar';
|
|
39
|
-
import { createUnplugin } from 'unplugin';
|
|
38
|
+
import { createUnplugin, createVitePlugin } from 'unplugin';
|
|
40
39
|
import { createFilter } from 'unplugin-utils';
|
|
41
40
|
import { createDebug } from 'obug';
|
|
42
41
|
import MagicString from 'magic-string';
|
|
@@ -58,14 +57,14 @@ import { URL as URL$1, pathToFileURL } from 'node:url';
|
|
|
58
57
|
import container from 'markdown-it-container';
|
|
59
58
|
import katex from 'katex';
|
|
60
59
|
import 'katex/contrib/mhchem';
|
|
61
|
-
import {
|
|
60
|
+
import { createRequire } from 'node:module';
|
|
62
61
|
import { createJiti } from 'jiti';
|
|
63
62
|
import { transformerDirectives, transformerVariantGroup, presetWind4, presetAttributify, presetIcons, presetTypography } from 'unocss';
|
|
64
63
|
import { convert } from 'html-to-text';
|
|
65
64
|
import VueRouter from 'vue-router/vite';
|
|
66
65
|
import generateSitemap from 'vite-ssg-sitemap';
|
|
67
66
|
import { renderSSRHead } from '@unhead/vue/server';
|
|
68
|
-
import { createRoutesContext, resolveOptions as resolveOptions$
|
|
67
|
+
import { createRoutesContext, resolveOptions as resolveOptions$3 } from 'vue-router/unplugin';
|
|
69
68
|
import { execSync, exec } from 'node:child_process';
|
|
70
69
|
import { intro, confirm, isCancel, cancel, select, outro } from '@clack/prompts';
|
|
71
70
|
import net from 'node:net';
|
|
@@ -73,7 +72,7 @@ import * as readline from 'node:readline';
|
|
|
73
72
|
import qrcode from 'qrcode';
|
|
74
73
|
import ejs from 'ejs';
|
|
75
74
|
|
|
76
|
-
const version = "1.
|
|
75
|
+
const version = "1.3.1";
|
|
77
76
|
|
|
78
77
|
const GLOBAL_STATE = {
|
|
79
78
|
valaxyApp: void 0,
|
|
@@ -182,6 +181,176 @@ function nodeT(key, lang) {
|
|
|
182
181
|
return result || "";
|
|
183
182
|
}
|
|
184
183
|
|
|
184
|
+
function normalizePagePath(filePath) {
|
|
185
|
+
return filePath.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
186
|
+
}
|
|
187
|
+
function relativePagePath(filePath, userRoot) {
|
|
188
|
+
const normalized = normalizePagePath(filePath);
|
|
189
|
+
if (userRoot) {
|
|
190
|
+
const root = normalizePagePath(userRoot).replace(/\/$/, "");
|
|
191
|
+
const prefixes = [`${root}/pages/`, `${root}/.valaxy/content/pages/`];
|
|
192
|
+
for (const prefix of prefixes) {
|
|
193
|
+
if (normalized.startsWith(prefix))
|
|
194
|
+
return normalized.slice(prefix.length);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const markers = ["/.valaxy/content/pages/", "/pages/"];
|
|
198
|
+
for (const marker of markers) {
|
|
199
|
+
const index = normalized.lastIndexOf(marker);
|
|
200
|
+
if (index >= 0)
|
|
201
|
+
return normalized.slice(index + marker.length);
|
|
202
|
+
}
|
|
203
|
+
if (normalized.startsWith("pages/"))
|
|
204
|
+
return normalized.slice("pages/".length);
|
|
205
|
+
}
|
|
206
|
+
function isUnderscorePage(relativePath) {
|
|
207
|
+
return normalizePagePath(relativePath).split("/").some((segment) => segment.startsWith("_"));
|
|
208
|
+
}
|
|
209
|
+
function isReadmePage(relativePath) {
|
|
210
|
+
const base = normalizePagePath(relativePath).split("/").pop() || "";
|
|
211
|
+
return /^readme\.md$/i.test(base);
|
|
212
|
+
}
|
|
213
|
+
function isUnpublishedPage(relativePath, publishing = {}) {
|
|
214
|
+
if (!publishing.underscore && isUnderscorePage(relativePath))
|
|
215
|
+
return true;
|
|
216
|
+
if (!publishing.readme && isReadmePage(relativePath))
|
|
217
|
+
return true;
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
function pageExcludeGlobs(publishing = {}) {
|
|
221
|
+
const globs = [];
|
|
222
|
+
if (!publishing.underscore)
|
|
223
|
+
globs.push("**/_*/**", "**/_*");
|
|
224
|
+
if (!publishing.readme)
|
|
225
|
+
globs.push("**/[Rr][Ee][Aa][Dd][Mm][Ee].[Mm][Dd]");
|
|
226
|
+
return globs;
|
|
227
|
+
}
|
|
228
|
+
function normalizeExcludeGlobs(exclude) {
|
|
229
|
+
if (typeof exclude === "string")
|
|
230
|
+
return [exclude];
|
|
231
|
+
if (Array.isArray(exclude))
|
|
232
|
+
return exclude.filter((item) => typeof item === "string");
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
235
|
+
function mergePageExcludes(publishing, userExclude) {
|
|
236
|
+
const defaults = pageExcludeGlobs(publishing);
|
|
237
|
+
if (typeof userExclude === "function")
|
|
238
|
+
return userExclude(defaults);
|
|
239
|
+
return [...defaults, ...normalizeExcludeGlobs(userExclude)];
|
|
240
|
+
}
|
|
241
|
+
function notFoundSitemapPaths(routes) {
|
|
242
|
+
const paths = /* @__PURE__ */ new Set();
|
|
243
|
+
for (const route of routes) {
|
|
244
|
+
const path = route.length > 1 && route.endsWith("/") ? route.slice(0, -1) : route;
|
|
245
|
+
if (path === "/404" || path.endsWith("/404"))
|
|
246
|
+
paths.add(path);
|
|
247
|
+
}
|
|
248
|
+
return [...paths];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function publicAuthor(author) {
|
|
252
|
+
const result = {};
|
|
253
|
+
const name = author?.name?.trim();
|
|
254
|
+
const email = author?.email?.trim();
|
|
255
|
+
const link = author?.link?.trim();
|
|
256
|
+
if (name)
|
|
257
|
+
result.name = name;
|
|
258
|
+
if (email)
|
|
259
|
+
result.email = email;
|
|
260
|
+
if (link)
|
|
261
|
+
result.link = link;
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
const SHARE_IMAGE = /\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/i;
|
|
265
|
+
function pickShareImage(candidates) {
|
|
266
|
+
for (const candidate of candidates) {
|
|
267
|
+
const value = typeof candidate === "string" ? candidate.trim() : "";
|
|
268
|
+
if (!value || Array.from(value).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127))
|
|
269
|
+
continue;
|
|
270
|
+
const url = value.startsWith("<") ? value.match(/^<([^>]+)>/)?.[1] : value.replace(/\s+(?:"[^"]*"|'[^']*'|\([^)]*\))$/, "");
|
|
271
|
+
if (!url || url.includes("\\"))
|
|
272
|
+
continue;
|
|
273
|
+
const pathname = url.split(/[?#]/)[0];
|
|
274
|
+
if (/\.vue$/i.test(pathname) || /^[a-z][a-z\d+.-]*:/i.test(url) && !/^https?:\/\//i.test(url))
|
|
275
|
+
continue;
|
|
276
|
+
if (/^(?:https?:)?\/\//i.test(url)) {
|
|
277
|
+
try {
|
|
278
|
+
if (new URL(url, "https://valaxy.local").hostname)
|
|
279
|
+
return url;
|
|
280
|
+
} catch {
|
|
281
|
+
}
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (/^(?:\/|\.\.?\/)/.test(url) || pathname.includes("/") || SHARE_IMAGE.test(pathname))
|
|
285
|
+
return url;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function pickPageShareImage(frontmatter) {
|
|
289
|
+
return pickShareImage([frontmatter.ogImage, frontmatter.image, frontmatter.cover, frontmatter.firstImage]);
|
|
290
|
+
}
|
|
291
|
+
function stripEncryptedContent(markdown) {
|
|
292
|
+
return markdown.replace(/<!--\s*valaxy-encrypt-start:[\s\S]*?(?:<!-- valaxy-encrypt-end -->|$)/g, "\n");
|
|
293
|
+
}
|
|
294
|
+
function plainSeoDescription(markdown, maxLength = 200) {
|
|
295
|
+
if (!markdown || maxLength <= 0)
|
|
296
|
+
return "";
|
|
297
|
+
let text = stripEncryptedContent(markdown).replace(/\r\n/g, "\n");
|
|
298
|
+
text = text.replace(/```[\s\S]*?```/g, "\n");
|
|
299
|
+
text = text.replace(/~~~[\s\S]*?~~~/g, "\n");
|
|
300
|
+
text = text.replace(/```[\s\S]*$/g, "\n");
|
|
301
|
+
text = text.replace(/~~~[\s\S]*$/g, "\n");
|
|
302
|
+
text = text.replace(/<!--[\s\S]*?-->/g, "\n");
|
|
303
|
+
text = text.replace(/<script[\s\S]*?<\/script>/gi, "\n");
|
|
304
|
+
text = text.replace(/<style[\s\S]*?<\/style>/gi, "\n");
|
|
305
|
+
text = text.replace(/!\[[^\]]*\]\([^)]*\)/g, "\n");
|
|
306
|
+
text = text.replace(/<[^>]+>/g, " ");
|
|
307
|
+
const paragraphs = [];
|
|
308
|
+
for (const block of text.split(/\n\s*\n/)) {
|
|
309
|
+
const lines = block.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
310
|
+
const prose = lines.filter(
|
|
311
|
+
(line) => !/^#{1,6}\s/.test(line) && !/^```|^~~~/.test(line) && !/^(?:-{3,}|\*{3,}|_{3,})$/.test(line) && !line.startsWith(":::") && !/^(?:import|export)\s/.test(line)
|
|
312
|
+
);
|
|
313
|
+
const paragraph = prose.map(stripInlineMarkdown).join(" ").replace(/\s+/g, " ").trim();
|
|
314
|
+
if (!paragraph)
|
|
315
|
+
continue;
|
|
316
|
+
paragraphs.push(paragraph);
|
|
317
|
+
if (paragraphs.join(" ").length >= maxLength)
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
const combined = paragraphs.join(" ").replace(/\s+/g, " ").trim();
|
|
321
|
+
if (!combined || combined.length <= maxLength)
|
|
322
|
+
return combined;
|
|
323
|
+
const slice = combined.slice(0, maxLength + 1);
|
|
324
|
+
const windowStart = Math.floor(maxLength * 0.6);
|
|
325
|
+
const space = slice.lastIndexOf(" ");
|
|
326
|
+
const end = space >= windowStart ? space : maxLength;
|
|
327
|
+
const trimmed = combined.slice(0, end).replace(/[\s,;:]+$/u, "").trim();
|
|
328
|
+
return trimmed ? `${trimmed}\u2026` : "";
|
|
329
|
+
}
|
|
330
|
+
function stripInlineMarkdown(line) {
|
|
331
|
+
const literals = [];
|
|
332
|
+
const protect = (value) => `\0${literals.push(value) - 1}\0`;
|
|
333
|
+
let text = line.replace(/(`+)(.*?)\1/g, (_, _fence, code) => protect(code)).replace(/\\([\\`*_~[\]{}()#+\-.!|>])/g, (_, char) => protect(char)).replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g, "$1");
|
|
334
|
+
for (let depth = 0; depth < 3; depth++) {
|
|
335
|
+
text = text.replace(/(?<![\p{L}\p{N}_])(_{1,3})(?=\S)(.+?\S|\S)\1(?![\p{L}\p{N}_])/gu, "$2").replace(/(?<!\*)(\*{1,3})(?=\S)(.+?\S|\S)\1(?!\*)/g, "$2").replace(/~~(?=\S)(.+?\S|\S)~~/g, "$1");
|
|
336
|
+
}
|
|
337
|
+
return text.replace(/^>\s?/, "").replace(/^[-*+]\s+/, "").replace(/^\d+\.\s+/, "").replace(/\|/g, " ").replace(/\0(\d+)\0/g, (_, index) => literals[Number(index)]);
|
|
338
|
+
}
|
|
339
|
+
function extractMarkdownImage(code) {
|
|
340
|
+
const withoutFence = stripEncryptedContent(code).replace(/```[\s\S]*?```/g, "").replace(/~~~[\s\S]*?~~~/g, "");
|
|
341
|
+
const markdown = withoutFence.match(/!\[[^\]]*\]\(\s*<?([^\s)>]+)>?/);
|
|
342
|
+
if (markdown)
|
|
343
|
+
return markdown[1];
|
|
344
|
+
const html = withoutFence.match(/<img\s[^>]*?\bsrc=(?:"([^"]+)"|'([^']+)')/i);
|
|
345
|
+
return (html?.[1] || html?.[2])?.replace(/&(amp|lt|gt|quot|apos|#(?:x[\da-f]+|\d+));/gi, (entity, name) => {
|
|
346
|
+
if (name.startsWith("#")) {
|
|
347
|
+
const value = name[1].toLowerCase() === "x" ? Number.parseInt(name.slice(2), 16) : Number.parseInt(name.slice(1), 10);
|
|
348
|
+
return value > 0 && value <= 1114111 ? String.fromCodePoint(value) : entity;
|
|
349
|
+
}
|
|
350
|
+
return { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" }[name.toLowerCase()];
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
185
354
|
function commonOptions(args) {
|
|
186
355
|
return args.positional("root", {
|
|
187
356
|
default: ".",
|
|
@@ -190,14 +359,49 @@ function commonOptions(args) {
|
|
|
190
359
|
});
|
|
191
360
|
}
|
|
192
361
|
|
|
362
|
+
const EXCERPT_SEPARATOR = "<!-- more -->";
|
|
363
|
+
const PATHNAME_PROTOCOL_RE = /^pathname:\/\//;
|
|
364
|
+
const ALL_ROUTE = "/:all(.*)*";
|
|
365
|
+
const customElements = /* @__PURE__ */ new Set([
|
|
366
|
+
// katex (MathML elements)
|
|
367
|
+
"annotation",
|
|
368
|
+
"math",
|
|
369
|
+
"menclose",
|
|
370
|
+
"mfrac",
|
|
371
|
+
"mglyph",
|
|
372
|
+
"mi",
|
|
373
|
+
"mlabeledtr",
|
|
374
|
+
"mn",
|
|
375
|
+
"mo",
|
|
376
|
+
"mover",
|
|
377
|
+
"mpadded",
|
|
378
|
+
"mphantom",
|
|
379
|
+
"mroot",
|
|
380
|
+
"mrow",
|
|
381
|
+
"mspace",
|
|
382
|
+
"msqrt",
|
|
383
|
+
"mstyle",
|
|
384
|
+
"msub",
|
|
385
|
+
"msubsup",
|
|
386
|
+
"msup",
|
|
387
|
+
"mtable",
|
|
388
|
+
"mtd",
|
|
389
|
+
"mtext",
|
|
390
|
+
"mtr",
|
|
391
|
+
"munder",
|
|
392
|
+
"munderover",
|
|
393
|
+
"semantics",
|
|
394
|
+
// mathjax (SVG container element)
|
|
395
|
+
"mjx-container",
|
|
396
|
+
"mjx-assistive-mml"
|
|
397
|
+
]);
|
|
398
|
+
const defaultViteConfig = {};
|
|
399
|
+
|
|
193
400
|
function escapeRegExp(str) {
|
|
194
401
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
195
402
|
}
|
|
196
|
-
function getRolldownOutputOptions(
|
|
403
|
+
function getRolldownOutputOptions() {
|
|
197
404
|
const assetsDir = "assets";
|
|
198
|
-
const escapedThemeRoot = escapeRegExp(
|
|
199
|
-
options.themeRoot.replace(/\\/g, "/")
|
|
200
|
-
);
|
|
201
405
|
const outputOptions = {
|
|
202
406
|
assetFileNames: `${assetsDir}/[name].[hash].[ext]`,
|
|
203
407
|
entryFileNames: `${assetsDir}/[name].[hash].js`,
|
|
@@ -246,13 +450,9 @@ function getRolldownOutputOptions(options) {
|
|
|
246
450
|
name: "chunks/@vueuse/motion",
|
|
247
451
|
test: /[\\/]@vueuse[\\/]motion[\\/]/,
|
|
248
452
|
priority: 20
|
|
249
|
-
},
|
|
250
|
-
// Theme code → theme chunk
|
|
251
|
-
{
|
|
252
|
-
name: "theme",
|
|
253
|
-
test: new RegExp(escapedThemeRoot),
|
|
254
|
-
priority: 10
|
|
255
453
|
}
|
|
454
|
+
// Leave theme modules to automatic splitting so dynamic imports keep
|
|
455
|
+
// their boundaries (search providers, comments and optional effects).
|
|
256
456
|
]
|
|
257
457
|
}
|
|
258
458
|
};
|
|
@@ -310,8 +510,9 @@ const defaultSiteConfig = {
|
|
|
310
510
|
subtitle: "Next Generation Static Blog Framework.",
|
|
311
511
|
author: {
|
|
312
512
|
avatar: "https://valaxy.site/valaxy-logo.png",
|
|
313
|
-
|
|
314
|
-
|
|
513
|
+
// Empty so a site that only sets a name does not publish Valaxy's address.
|
|
514
|
+
email: "",
|
|
515
|
+
link: "",
|
|
315
516
|
name: "VALAXY Developer",
|
|
316
517
|
status: {
|
|
317
518
|
emoji: "\u{1F30C}",
|
|
@@ -354,6 +555,11 @@ const defaultSiteConfig = {
|
|
|
354
555
|
auto: false,
|
|
355
556
|
length: 200
|
|
356
557
|
},
|
|
558
|
+
publishing: {
|
|
559
|
+
drafts: false,
|
|
560
|
+
underscore: false,
|
|
561
|
+
readme: false
|
|
562
|
+
},
|
|
357
563
|
frontmatter: {
|
|
358
564
|
time_warning: 180 * 24 * 60 * 60 * 1e3
|
|
359
565
|
},
|
|
@@ -369,10 +575,6 @@ const defaultSiteConfig = {
|
|
|
369
575
|
enable: false,
|
|
370
576
|
options: {}
|
|
371
577
|
},
|
|
372
|
-
floatingVue: options,
|
|
373
|
-
footnote: {
|
|
374
|
-
preview: "reka"
|
|
375
|
-
},
|
|
376
578
|
statistics: {
|
|
377
579
|
enable: false,
|
|
378
580
|
readTime: {
|
|
@@ -404,13 +606,6 @@ const defaultSiteConfig = {
|
|
|
404
606
|
function defineSiteConfig(config) {
|
|
405
607
|
return config;
|
|
406
608
|
}
|
|
407
|
-
function resolveFootnoteConfig(config = {}) {
|
|
408
|
-
const preview = config.footnote?.preview;
|
|
409
|
-
if (config.floatingVue != null) {
|
|
410
|
-
consola.warn(preview === "reka" ? "[Valaxy] siteConfig.floatingVue only configures legacy Floating Vue APIs; Reka footnotes use .va-footnote-popover styles." : "[Valaxy] siteConfig.floatingVue is deprecated for footnotes. Keeping the legacy preview; migrate with footnote: { preview: 'reka' }. See https://valaxy.site/guide/markdown#footnote-preview");
|
|
411
|
-
}
|
|
412
|
-
return { preview: preview ?? (config.floatingVue != null ? "floating-vue" : "reka") };
|
|
413
|
-
}
|
|
414
609
|
async function resolveSiteConfigFromRoot(root) {
|
|
415
610
|
return loadConfigFromFile("site", {
|
|
416
611
|
cwd: root
|
|
@@ -491,7 +686,7 @@ const defaultValaxyConfig = {
|
|
|
491
686
|
}
|
|
492
687
|
},
|
|
493
688
|
vue: {
|
|
494
|
-
browserTemplateCompilation:
|
|
689
|
+
browserTemplateCompilation: "lazy"
|
|
495
690
|
},
|
|
496
691
|
devtools: true,
|
|
497
692
|
mcp: false
|
|
@@ -876,7 +1071,7 @@ async function processValaxyOptions(valaxyOptions, valaxyConfig) {
|
|
|
876
1071
|
consola.debug(` \u251C\u2500 resolveAddonsConfig: ${resolveAddonsTimer()}`);
|
|
877
1072
|
const mergeTimer = countPerformanceTime();
|
|
878
1073
|
valaxyConfig = mergeValaxyConfig(valaxyConfig, addonsValaxyConfig);
|
|
879
|
-
const rolldownOutputOptions = getRolldownOutputOptions(
|
|
1074
|
+
const rolldownOutputOptions = getRolldownOutputOptions();
|
|
880
1075
|
consola.debug(` \u251C\u2500 mergeValaxyConfig + getRolldownOutputOptions: ${mergeTimer()}`);
|
|
881
1076
|
const buildConfig = defaultValaxyConfig.vite.build ??= {};
|
|
882
1077
|
buildConfig.rolldownOptions = {
|
|
@@ -895,7 +1090,6 @@ async function processValaxyOptions(valaxyOptions, valaxyConfig) {
|
|
|
895
1090
|
}
|
|
896
1091
|
};
|
|
897
1092
|
const config = replaceArrMerge(valaxyConfig, defaultValaxyConfig);
|
|
898
|
-
config.siteConfig.footnote = resolveFootnoteConfig(valaxyConfig.siteConfig);
|
|
899
1093
|
valaxyOptions.config = {
|
|
900
1094
|
...config,
|
|
901
1095
|
runtimeConfig: {
|
|
@@ -913,7 +1107,7 @@ async function processValaxyOptions(valaxyOptions, valaxyConfig) {
|
|
|
913
1107
|
const addonRoots = addons.map(({ root }) => root);
|
|
914
1108
|
const addonNames = addons.map(({ name }) => name);
|
|
915
1109
|
valaxyOptions.addonRoots = addonRoots;
|
|
916
|
-
valaxyOptions.roots = uniq([clientRoot, themeRoot, ...addonRoots, userRoot]);
|
|
1110
|
+
valaxyOptions.roots = uniq$1([clientRoot, themeRoot, ...addonRoots, userRoot]);
|
|
917
1111
|
const resolvedBuild = valaxyOptions.config.vite.build ??= {};
|
|
918
1112
|
const rawExternal = resolvedBuild.rolldownOptions?.external ?? resolvedBuild.rollupOptions?.external ?? [];
|
|
919
1113
|
const external = Array.isArray(rawExternal) ? rawExternal.filter((e) => typeof e === "string") : [];
|
|
@@ -926,7 +1120,7 @@ async function processValaxyOptions(valaxyOptions, valaxyConfig) {
|
|
|
926
1120
|
consola.debug(` \u2514\u2500 processSiteConfig: ${siteConfigTimer()}`);
|
|
927
1121
|
return valaxyOptions;
|
|
928
1122
|
}
|
|
929
|
-
async function resolveOptions$
|
|
1123
|
+
async function resolveOptions$2(options = { userRoot: process.cwd() }, mode = "dev") {
|
|
930
1124
|
const pkgRoot = dirname(await resolveImportPath("valaxy/package.json", true));
|
|
931
1125
|
const clientRoot = resolve$1(pkgRoot, "client");
|
|
932
1126
|
const userRoot = resolve$1(options.userRoot || process.cwd());
|
|
@@ -977,7 +1171,7 @@ async function resolveOptions$1(options = { userRoot: process.cwd() }, mode = "d
|
|
|
977
1171
|
configFile: configFile || "",
|
|
978
1172
|
siteConfigFile: siteConfigFile || "",
|
|
979
1173
|
themeConfigFile: themeConfigFile || "",
|
|
980
|
-
pages: pages.sort(),
|
|
1174
|
+
pages: pages.sort().filter((page) => !isUnpublishedPage(page, userValaxyConfig?.siteConfig?.publishing)),
|
|
981
1175
|
addons: [],
|
|
982
1176
|
redirects,
|
|
983
1177
|
env: {
|
|
@@ -1003,44 +1197,6 @@ async function resolveThemeValaxyConfig(options) {
|
|
|
1003
1197
|
return themeValaxyConfig;
|
|
1004
1198
|
}
|
|
1005
1199
|
|
|
1006
|
-
const EXCERPT_SEPARATOR = "<!-- more -->";
|
|
1007
|
-
const PATHNAME_PROTOCOL_RE = /^pathname:\/\//;
|
|
1008
|
-
const ALL_ROUTE = "/:all(.*)*";
|
|
1009
|
-
const customElements = /* @__PURE__ */ new Set([
|
|
1010
|
-
// katex (MathML elements)
|
|
1011
|
-
"annotation",
|
|
1012
|
-
"math",
|
|
1013
|
-
"menclose",
|
|
1014
|
-
"mfrac",
|
|
1015
|
-
"mglyph",
|
|
1016
|
-
"mi",
|
|
1017
|
-
"mlabeledtr",
|
|
1018
|
-
"mn",
|
|
1019
|
-
"mo",
|
|
1020
|
-
"mover",
|
|
1021
|
-
"mpadded",
|
|
1022
|
-
"mphantom",
|
|
1023
|
-
"mroot",
|
|
1024
|
-
"mrow",
|
|
1025
|
-
"mspace",
|
|
1026
|
-
"msqrt",
|
|
1027
|
-
"mstyle",
|
|
1028
|
-
"msub",
|
|
1029
|
-
"msubsup",
|
|
1030
|
-
"msup",
|
|
1031
|
-
"mtable",
|
|
1032
|
-
"mtd",
|
|
1033
|
-
"mtext",
|
|
1034
|
-
"mtr",
|
|
1035
|
-
"munder",
|
|
1036
|
-
"munderover",
|
|
1037
|
-
"semantics",
|
|
1038
|
-
// mathjax (SVG container element)
|
|
1039
|
-
"mjx-container",
|
|
1040
|
-
"mjx-assistive-mml"
|
|
1041
|
-
]);
|
|
1042
|
-
const defaultViteConfig = {};
|
|
1043
|
-
|
|
1044
1200
|
const matterOptions = {
|
|
1045
1201
|
excerpt_separator: EXCERPT_SEPARATOR,
|
|
1046
1202
|
engines: {
|
|
@@ -1132,15 +1288,21 @@ async function generateFuseList(options) {
|
|
|
1132
1288
|
const posts = [];
|
|
1133
1289
|
for await (const i of files) {
|
|
1134
1290
|
const raw = fs.readFileSync(i, "utf-8");
|
|
1135
|
-
const { data,
|
|
1136
|
-
const fmData = data;
|
|
1137
|
-
|
|
1291
|
+
const { data, content: rawContent } = matter(raw, matterOptions);
|
|
1292
|
+
const fmData = { ...options.config.siteConfig.frontmatter, ...data };
|
|
1293
|
+
const content = stripEncryptedContent(rawContent);
|
|
1294
|
+
const separator = content.indexOf(EXCERPT_SEPARATOR);
|
|
1295
|
+
const excerpt = separator < 0 ? "" : content.slice(0, separator);
|
|
1296
|
+
const relative = relativePagePath(i, options.userRoot);
|
|
1297
|
+
if (relative && isUnpublishedPage(relative, options.config.siteConfig.publishing))
|
|
1298
|
+
continue;
|
|
1299
|
+
if (fmData.draft && !options.config.siteConfig.publishing?.drafts) {
|
|
1138
1300
|
consola.warn(`Ignore draft post: ${colors.dim(i)}`);
|
|
1139
1301
|
continue;
|
|
1140
1302
|
}
|
|
1141
1303
|
if (fmData.hide)
|
|
1142
1304
|
continue;
|
|
1143
|
-
if (fmData.password)
|
|
1305
|
+
if (fmData.password || fmData.encrypt === true)
|
|
1144
1306
|
continue;
|
|
1145
1307
|
const extendKeys = options.config.fuse?.extendKeys || [];
|
|
1146
1308
|
const relativeLink = path.join(options.config.vite?.base || "/", getPagePath(i, options.userRoot) || path.relative(path.resolve(options.userRoot, "pages"), i)).replace(/\\/g, "/");
|
|
@@ -1158,7 +1320,10 @@ async function generateFuseList(options) {
|
|
|
1158
1320
|
fuseListItem.content = content;
|
|
1159
1321
|
}
|
|
1160
1322
|
extendKeys.forEach((key) => {
|
|
1161
|
-
|
|
1323
|
+
if (SENSITIVE_FRONTMATTER_KEYS.has(key) || key === "photos" && "gallery_password" in fmData)
|
|
1324
|
+
return;
|
|
1325
|
+
const value = fmData[key] || "";
|
|
1326
|
+
fuseListItem[key] = typeof value === "string" ? stripEncryptedContent(value) : value;
|
|
1162
1327
|
});
|
|
1163
1328
|
posts.push(fuseListItem);
|
|
1164
1329
|
}
|
|
@@ -1200,7 +1365,7 @@ function registerFuseCommand(cli) {
|
|
|
1200
1365
|
(args) => commonOptions(args).strict().help(),
|
|
1201
1366
|
async ({ root }) => {
|
|
1202
1367
|
setEnvProd();
|
|
1203
|
-
const options = await resolveOptions$
|
|
1368
|
+
const options = await resolveOptions$2({ userRoot: root }, "build");
|
|
1204
1369
|
await execFuse(options);
|
|
1205
1370
|
}
|
|
1206
1371
|
);
|
|
@@ -1219,15 +1384,24 @@ const fuseModule = defineValaxyModule({
|
|
|
1219
1384
|
async function scanPageFiles(userRoot, include) {
|
|
1220
1385
|
return [...(await discoverPageFiles(userRoot, include)).values()];
|
|
1221
1386
|
}
|
|
1222
|
-
async function readPostFiles(files) {
|
|
1387
|
+
async function readPostFiles(files, defaults = {}) {
|
|
1223
1388
|
return Promise.all(files.map(async (filePath) => {
|
|
1224
1389
|
const raw = await readFile(filePath, "utf-8");
|
|
1225
1390
|
const { data, content, excerpt } = matter(raw, matterOptions);
|
|
1226
|
-
return { data, content, excerpt, filePath };
|
|
1391
|
+
return { data: { ...defaults, ...data }, content, excerpt, filePath };
|
|
1227
1392
|
}));
|
|
1228
1393
|
}
|
|
1229
|
-
function filterPublicPosts(posts) {
|
|
1230
|
-
return posts.filter(({ data }) =>
|
|
1394
|
+
function filterPublicPosts(posts, publishing, userRoot) {
|
|
1395
|
+
return posts.filter(({ data, filePath }) => {
|
|
1396
|
+
if (data.password || data.encrypt === true || data.hide)
|
|
1397
|
+
return false;
|
|
1398
|
+
if (data.draft && !publishing?.drafts)
|
|
1399
|
+
return false;
|
|
1400
|
+
const relative = relativePagePath(filePath, userRoot);
|
|
1401
|
+
if (relative && isUnpublishedPage(relative, publishing))
|
|
1402
|
+
return false;
|
|
1403
|
+
return true;
|
|
1404
|
+
});
|
|
1231
1405
|
}
|
|
1232
1406
|
function filePathToUrlPath(filePath, userRoot) {
|
|
1233
1407
|
const relativePath = getPagePath(filePath, userRoot) || path.relative(path.join(userRoot, "pages"), filePath);
|
|
@@ -1260,15 +1434,15 @@ async function loadLlmsPosts(options) {
|
|
|
1260
1434
|
loadLocalesYml(path.resolve(options.userRoot, "locales"));
|
|
1261
1435
|
const include = llmsConfig.include || ["posts/**/*.md"];
|
|
1262
1436
|
const files = await scanPageFiles(options.userRoot, include);
|
|
1263
|
-
const rawPosts = await readPostFiles(files);
|
|
1264
|
-
const publicPosts = filterPublicPosts(rawPosts);
|
|
1437
|
+
const rawPosts = await readPostFiles(files, siteConfig.frontmatter);
|
|
1438
|
+
const publicPosts = filterPublicPosts(rawPosts, siteConfig.publishing, options.userRoot);
|
|
1265
1439
|
const posts = publicPosts.map(({ data, content, filePath }) => ({
|
|
1266
1440
|
title: resolveText(data.title, lang) || path.basename(filePath, ".md"),
|
|
1267
1441
|
description: resolveText(data.description, lang) || "",
|
|
1268
1442
|
date: data.date ? new Date(data.date) : /* @__PURE__ */ new Date(0),
|
|
1269
1443
|
urlPath: filePathToUrlPath(filePath, options.userRoot),
|
|
1270
1444
|
sourcePath: getPagePath(filePath, options.userRoot),
|
|
1271
|
-
content,
|
|
1445
|
+
content: stripEncryptedContent(content),
|
|
1272
1446
|
rawFrontmatter: stripSensitiveFrontmatter(data)
|
|
1273
1447
|
}));
|
|
1274
1448
|
posts.sort((a, b) => +b.date - +a.date);
|
|
@@ -1678,7 +1852,7 @@ const llmsModule = defineValaxyModule({
|
|
|
1678
1852
|
(args) => commonOptions(args).strict().help(),
|
|
1679
1853
|
async ({ root }) => {
|
|
1680
1854
|
setEnvProd();
|
|
1681
|
-
const options = await resolveOptions$
|
|
1855
|
+
const options = await resolveOptions$2({ userRoot: root }, "build");
|
|
1682
1856
|
await build$2(options);
|
|
1683
1857
|
}
|
|
1684
1858
|
);
|
|
@@ -1751,11 +1925,7 @@ async function build$1(options) {
|
|
|
1751
1925
|
return;
|
|
1752
1926
|
}
|
|
1753
1927
|
const siteUrl = siteConfig.url;
|
|
1754
|
-
const author =
|
|
1755
|
-
name: siteConfig.author?.name,
|
|
1756
|
-
email: siteConfig.author?.email,
|
|
1757
|
-
link: siteConfig.author?.link
|
|
1758
|
-
};
|
|
1928
|
+
const author = publicAuthor(siteConfig.author);
|
|
1759
1929
|
const ccVersion = siteConfig.license?.type === "zero" ? "1.0" : "4.0";
|
|
1760
1930
|
const feedNameMap = {
|
|
1761
1931
|
atom: siteConfig.feed?.name ? `${siteConfig.feed?.name}.atom` : "atom.xml",
|
|
@@ -1800,15 +1970,19 @@ async function getPosts(params, options) {
|
|
|
1800
1970
|
const readFilePromises = files.map(async (i) => {
|
|
1801
1971
|
const raw = await readFile(i, "utf-8");
|
|
1802
1972
|
const { data, content, excerpt } = matter(raw, matterOptions);
|
|
1803
|
-
|
|
1973
|
+
const frontmatter = { ...siteConfig.frontmatter, ...data };
|
|
1974
|
+
return { data: frontmatter, content, excerpt, path: i };
|
|
1804
1975
|
});
|
|
1805
1976
|
const rawPosts = await Promise.all(readFilePromises);
|
|
1806
1977
|
const draftPosts = [];
|
|
1807
1978
|
const filteredPosts = rawPosts.filter((p) => {
|
|
1808
1979
|
const { data } = p;
|
|
1809
|
-
if (data.password)
|
|
1980
|
+
if (data.password || data.encrypt === true)
|
|
1810
1981
|
return false;
|
|
1811
|
-
|
|
1982
|
+
const relative2 = relativePagePath(p.path, options.userRoot);
|
|
1983
|
+
if (relative2 && isUnpublishedPage(relative2, siteConfig.publishing))
|
|
1984
|
+
return false;
|
|
1985
|
+
if (data.draft && !siteConfig.publishing?.drafts) {
|
|
1812
1986
|
draftPosts.push(p.path);
|
|
1813
1987
|
return false;
|
|
1814
1988
|
}
|
|
@@ -1822,7 +1996,12 @@ ${draftPosts.map((p) => ` ${colors.dim("-")} ${colors.dim(p)}`).join("\n")}`);
|
|
|
1822
1996
|
}
|
|
1823
1997
|
const posts = [];
|
|
1824
1998
|
for (const rawPost of filteredPosts) {
|
|
1825
|
-
const { data, path
|
|
1999
|
+
const { data, path } = rawPost;
|
|
2000
|
+
const content = stripEncryptedContent(rawPost.content);
|
|
2001
|
+
const excerpt = content.includes(EXCERPT_SEPARATOR) ? content.split(EXCERPT_SEPARATOR)[0] : "";
|
|
2002
|
+
const description = tObject(data.description, lang);
|
|
2003
|
+
const manualExcerpt = tObject(data.excerpt, lang);
|
|
2004
|
+
const summaryLength = siteConfig.excerpt?.length || 200;
|
|
1826
2005
|
if (!data.date)
|
|
1827
2006
|
data.date = await getCreatedTime(path);
|
|
1828
2007
|
if (siteConfig.lastUpdated) {
|
|
@@ -1868,7 +2047,7 @@ ${draftPosts.map((p) => ` ${colors.dim("-")} ${colors.dim(p)}`).join("\n")}`);
|
|
|
1868
2047
|
const item = {
|
|
1869
2048
|
...data,
|
|
1870
2049
|
title: tObject(data.title, lang),
|
|
1871
|
-
description:
|
|
2050
|
+
description: typeof description === "string" && description.trim() ? description : plainSeoDescription(typeof manualExcerpt === "string" ? manualExcerpt : "", summaryLength) || plainSeoDescription(excerpt || content, summaryLength),
|
|
1872
2051
|
date: new Date(data.date),
|
|
1873
2052
|
// RSS pubDate / JSON date_published
|
|
1874
2053
|
published: new Date(data.date),
|
|
@@ -1968,7 +2147,7 @@ const rssModule = defineValaxyModule({
|
|
|
1968
2147
|
(args) => commonOptions(args).strict().help(),
|
|
1969
2148
|
async ({ root }) => {
|
|
1970
2149
|
setEnvProd();
|
|
1971
|
-
const options = await resolveOptions$
|
|
2150
|
+
const options = await resolveOptions$2({ userRoot: root }, "build");
|
|
1972
2151
|
await build$1(options);
|
|
1973
2152
|
}
|
|
1974
2153
|
);
|
|
@@ -2266,7 +2445,7 @@ function createValaxyNode(options) {
|
|
|
2266
2445
|
return valaxyNode;
|
|
2267
2446
|
}
|
|
2268
2447
|
|
|
2269
|
-
function toArray(array) {
|
|
2448
|
+
function toArray$1(array) {
|
|
2270
2449
|
array = array ?? [];
|
|
2271
2450
|
return Array.isArray(array) ? array : [array];
|
|
2272
2451
|
}
|
|
@@ -2380,7 +2559,7 @@ function stringifyComponentImport({ as: name, from: path, name: importName, side
|
|
|
2380
2559
|
from: path,
|
|
2381
2560
|
name: importName
|
|
2382
2561
|
})];
|
|
2383
|
-
if (sideEffects) toArray(sideEffects).forEach((i) => imports.push(stringifyImport(i)));
|
|
2562
|
+
if (sideEffects) toArray$1(sideEffects).forEach((i) => imports.push(stringifyImport(i)));
|
|
2384
2563
|
return imports.join(";");
|
|
2385
2564
|
}
|
|
2386
2565
|
function getNameFromFilePath(filePath, options) {
|
|
@@ -2613,7 +2792,7 @@ const defaultOptions = {
|
|
|
2613
2792
|
prefix: ""
|
|
2614
2793
|
};
|
|
2615
2794
|
function normalizeResolvers(resolvers) {
|
|
2616
|
-
return toArray(resolvers).flat().map((r) => typeof r === "function" ? {
|
|
2795
|
+
return toArray$1(resolvers).flat().map((r) => typeof r === "function" ? {
|
|
2617
2796
|
resolve: r,
|
|
2618
2797
|
type: "component"
|
|
2619
2798
|
} : r);
|
|
@@ -2622,16 +2801,16 @@ function resolveGlobsExclude(root, glob2) {
|
|
|
2622
2801
|
const excludeReg = /^!/;
|
|
2623
2802
|
return slash(`${excludeReg.test(glob2) ? "!" : ""}${resolve(root, glob2.replace(excludeReg, ""))}`);
|
|
2624
2803
|
}
|
|
2625
|
-
function resolveOptions(options, root) {
|
|
2804
|
+
function resolveOptions$1(options, root) {
|
|
2626
2805
|
const resolved = Object.assign({}, defaultOptions, options);
|
|
2627
2806
|
resolved.resolvers = normalizeResolvers(resolved.resolvers);
|
|
2628
|
-
resolved.extensions = toArray(resolved.extensions);
|
|
2807
|
+
resolved.extensions = toArray$1(resolved.extensions);
|
|
2629
2808
|
if (resolved.globs) {
|
|
2630
|
-
resolved.globs = toArray(resolved.globs).map((glob2) => resolveGlobsExclude(root, glob2));
|
|
2809
|
+
resolved.globs = toArray$1(resolved.globs).map((glob2) => resolveGlobsExclude(root, glob2));
|
|
2631
2810
|
resolved.resolvedDirs = [];
|
|
2632
2811
|
} else {
|
|
2633
2812
|
const extsGlob = resolved.extensions.length === 1 ? resolved.extensions : `{${resolved.extensions.join(",")}}`;
|
|
2634
|
-
resolved.dirs = toArray(resolved.dirs);
|
|
2813
|
+
resolved.dirs = toArray$1(resolved.dirs);
|
|
2635
2814
|
const globs = resolved.dirs.map((i) => resolveGlobsExclude(root, i));
|
|
2636
2815
|
resolved.resolvedDirs = globs.filter((i) => !i.startsWith("!"));
|
|
2637
2816
|
resolved.globs = globs.map((i) => {
|
|
@@ -2644,7 +2823,7 @@ function resolveOptions(options, root) {
|
|
|
2644
2823
|
});
|
|
2645
2824
|
if (!resolved.extensions.length) throw new Error("[unplugin-vue-components] `extensions` option is required to search for components");
|
|
2646
2825
|
}
|
|
2647
|
-
resolved.globsExclude = toArray(resolved.globsExclude || []).map((i) => resolveGlobsExclude(root, i));
|
|
2826
|
+
resolved.globsExclude = toArray$1(resolved.globsExclude || []).map((i) => resolveGlobsExclude(root, i));
|
|
2648
2827
|
resolved.globs = resolved.globs.filter((i) => {
|
|
2649
2828
|
if (!i.startsWith("!")) return true;
|
|
2650
2829
|
resolved.globsExclude.push(i.slice(1));
|
|
@@ -2775,7 +2954,7 @@ var Context = class {
|
|
|
2775
2954
|
dumpComponentsInfoPath;
|
|
2776
2955
|
constructor(rawOptions) {
|
|
2777
2956
|
this.rawOptions = rawOptions;
|
|
2778
|
-
this.options = resolveOptions(rawOptions, this.root);
|
|
2957
|
+
this.options = resolveOptions$1(rawOptions, this.root);
|
|
2779
2958
|
this.sourcemap = rawOptions.sourcemap ?? true;
|
|
2780
2959
|
this.generateDeclaration = throttle(500, this._generateDeclaration.bind(this), { noLeading: false });
|
|
2781
2960
|
this._removeUnused = this.options.syncMode !== "append";
|
|
@@ -2790,7 +2969,7 @@ var Context = class {
|
|
|
2790
2969
|
if (this.root === root) return;
|
|
2791
2970
|
debug$5.env("root", root);
|
|
2792
2971
|
this.root = root;
|
|
2793
|
-
this.options = resolveOptions(this.rawOptions, this.root);
|
|
2972
|
+
this.options = resolveOptions$1(this.rawOptions, this.root);
|
|
2794
2973
|
}
|
|
2795
2974
|
transform(code, id) {
|
|
2796
2975
|
const { path, query } = parseId(id);
|
|
@@ -2851,7 +3030,7 @@ var Context = class {
|
|
|
2851
3030
|
addComponents(paths) {
|
|
2852
3031
|
debug$5.components("add", paths);
|
|
2853
3032
|
const size = this._componentPaths.size;
|
|
2854
|
-
toArray(paths).forEach((p) => this._componentPaths.add(p));
|
|
3033
|
+
toArray$1(paths).forEach((p) => this._componentPaths.add(p));
|
|
2855
3034
|
if (this._componentPaths.size !== size) {
|
|
2856
3035
|
this.updateComponentNameMap();
|
|
2857
3036
|
return true;
|
|
@@ -2867,7 +3046,7 @@ var Context = class {
|
|
|
2867
3046
|
removeComponents(paths) {
|
|
2868
3047
|
debug$5.components("remove", paths);
|
|
2869
3048
|
const size = this._componentPaths.size;
|
|
2870
|
-
toArray(paths).forEach((p) => this._componentPaths.delete(p));
|
|
3049
|
+
toArray$1(paths).forEach((p) => this._componentPaths.delete(p));
|
|
2871
3050
|
if (this._componentPaths.size !== size) {
|
|
2872
3051
|
this.updateComponentNameMap();
|
|
2873
3052
|
return true;
|
|
@@ -3455,35 +3634,43 @@ export default new Map([${entries.join(",\n")}])`;
|
|
|
3455
3634
|
|
|
3456
3635
|
function foucGuardHtml(maxDuration) {
|
|
3457
3636
|
return [
|
|
3458
|
-
`<style id="valaxy-fouc">body{opacity:0!important}</style>`,
|
|
3459
|
-
`<style>body{transition:opacity .15s ease}</style>`,
|
|
3637
|
+
`<style id="valaxy-fouc">body{margin:0;opacity:0!important}</style>`,
|
|
3460
3638
|
`<noscript><style>body{opacity:1!important}</style></noscript>`,
|
|
3461
3639
|
`<script>(${foucGuardScript.toString()})(${maxDuration})<\/script>`
|
|
3462
3640
|
].join("");
|
|
3463
3641
|
}
|
|
3464
3642
|
function foucGuardScript(maxDuration) {
|
|
3465
3643
|
var done = 0;
|
|
3644
|
+
var observer = new MutationObserver(check);
|
|
3645
|
+
var timer = maxDuration ? setTimeout(reveal, maxDuration) : void 0;
|
|
3466
3646
|
function reveal() {
|
|
3467
3647
|
if (done) return;
|
|
3468
3648
|
done = 1;
|
|
3649
|
+
observer.disconnect();
|
|
3650
|
+
clearTimeout(timer);
|
|
3651
|
+
document.removeEventListener("load", check, true);
|
|
3652
|
+
removeEventListener("load", reveal);
|
|
3469
3653
|
var s = document.getElementById("valaxy-fouc");
|
|
3470
3654
|
if (s) s.remove();
|
|
3471
3655
|
}
|
|
3472
3656
|
function check() {
|
|
3473
|
-
|
|
3657
|
+
if (!document.body) return;
|
|
3658
|
+
var links = document.head.querySelectorAll('link[rel~="stylesheet"]');
|
|
3474
3659
|
for (var i = 0; i < links.length; i++) {
|
|
3475
|
-
|
|
3660
|
+
var link = links[i];
|
|
3661
|
+
if (!link.disabled && !link.sheet) return;
|
|
3476
3662
|
}
|
|
3477
3663
|
reveal();
|
|
3478
3664
|
}
|
|
3479
|
-
|
|
3665
|
+
observer.observe(document.documentElement, { childList: true });
|
|
3666
|
+
observer.observe(document.head, {
|
|
3480
3667
|
childList: true,
|
|
3668
|
+
subtree: true,
|
|
3481
3669
|
attributes: true,
|
|
3482
|
-
attributeFilter: ["media", "rel"]
|
|
3670
|
+
attributeFilter: ["media", "rel", "disabled"]
|
|
3483
3671
|
});
|
|
3672
|
+
document.addEventListener("load", check, true);
|
|
3484
3673
|
addEventListener("load", reveal);
|
|
3485
|
-
if (maxDuration)
|
|
3486
|
-
setTimeout(reveal, maxDuration);
|
|
3487
3674
|
}
|
|
3488
3675
|
|
|
3489
3676
|
async function mergeViteConfigs({ userRoot, themeRoot }, command) {
|
|
@@ -3492,7 +3679,7 @@ async function mergeViteConfigs({ userRoot, themeRoot }, command) {
|
|
|
3492
3679
|
command
|
|
3493
3680
|
};
|
|
3494
3681
|
let resolvedConfig = {};
|
|
3495
|
-
const files = uniq([themeRoot, userRoot]).map((i) => join(i, "vite.config.ts"));
|
|
3682
|
+
const files = uniq$1([themeRoot, userRoot]).map((i) => join(i, "vite.config.ts"));
|
|
3496
3683
|
const loadViteConfigPromiseArr = files.map(async (file) => {
|
|
3497
3684
|
if (!await fs.exists(file))
|
|
3498
3685
|
return;
|
|
@@ -3619,13 +3806,16 @@ function createConfigPlugin(options) {
|
|
|
3619
3806
|
const addonDeps = options.addons.map((i) => Object.keys(i.pkg.dependencies || {})).flat();
|
|
3620
3807
|
const cdnModuleNames = options.mode === "build" ? (options.config.cdn?.modules || []).map((m) => m.name) : [];
|
|
3621
3808
|
const katexEnabled = isKatexPluginNeeded(options.config);
|
|
3809
|
+
const searchRoot = normalizePath(resolve(options.clientRoot, "composables/search"));
|
|
3622
3810
|
const depsToInclude = [...clientDeps];
|
|
3811
|
+
if (options.config.vue?.browserTemplateCompilation !== false)
|
|
3812
|
+
depsToInclude.push("vue/dist/vue.esm-bundler.js");
|
|
3623
3813
|
if (!katexEnabled) {
|
|
3624
3814
|
const katexIdx = depsToInclude.indexOf("katex");
|
|
3625
3815
|
if (katexIdx !== -1)
|
|
3626
3816
|
depsToInclude.splice(katexIdx, 1);
|
|
3627
3817
|
}
|
|
3628
|
-
const includedDeps = uniq([
|
|
3818
|
+
const includedDeps = uniq$1([
|
|
3629
3819
|
...depsToInclude,
|
|
3630
3820
|
// remove theme deps, for primevue parse entry
|
|
3631
3821
|
// ...themeDeps,
|
|
@@ -3671,11 +3861,11 @@ function createConfigPlugin(options) {
|
|
|
3671
3861
|
entries: [resolve(options.clientRoot, "main.ts")],
|
|
3672
3862
|
// must need it
|
|
3673
3863
|
include: includedDeps,
|
|
3674
|
-
exclude: uniq([...EXCLUDE, ...addonNames])
|
|
3864
|
+
exclude: uniq$1([...EXCLUDE, ...addonNames])
|
|
3675
3865
|
},
|
|
3676
3866
|
server: {
|
|
3677
3867
|
fs: {
|
|
3678
|
-
allow: uniq(fsAllow)
|
|
3868
|
+
allow: uniq$1(fsAllow)
|
|
3679
3869
|
}
|
|
3680
3870
|
}
|
|
3681
3871
|
};
|
|
@@ -3684,6 +3874,13 @@ function createConfigPlugin(options) {
|
|
|
3684
3874
|
}
|
|
3685
3875
|
return injection;
|
|
3686
3876
|
},
|
|
3877
|
+
transform: {
|
|
3878
|
+
filter: { id: new RegExp(`^${escapeRegExp(searchRoot)}/[^/]+\\.ts$`) },
|
|
3879
|
+
handler() {
|
|
3880
|
+
if (options.mode === "build")
|
|
3881
|
+
return { moduleSideEffects: false };
|
|
3882
|
+
}
|
|
3883
|
+
},
|
|
3687
3884
|
async transformIndexHtml(html, ctx) {
|
|
3688
3885
|
html = await getIndexHtml(options, html);
|
|
3689
3886
|
return {
|
|
@@ -3719,10 +3916,14 @@ async function getAlias(options) {
|
|
|
3719
3916
|
{ find: `valaxy-theme-${options.theme}/`, replacement: `${toAtFS(resolve(options.themeRoot))}/` },
|
|
3720
3917
|
{ find: `valaxy-theme-${options.theme}`, replacement: `${toAtFS(resolve(options.themeRoot))}/client/index.ts` }
|
|
3721
3918
|
];
|
|
3722
|
-
if (options.config.vue?.browserTemplateCompilation) {
|
|
3919
|
+
if (options.config.vue?.browserTemplateCompilation === true) {
|
|
3723
3920
|
alias.push(
|
|
3724
3921
|
{ find: /^vue$/, replacement: await resolveImportPath("vue/dist/vue.esm-bundler.js", true) }
|
|
3725
3922
|
);
|
|
3923
|
+
} else if (options.config.vue?.browserTemplateCompilation === false) {
|
|
3924
|
+
alias.push(
|
|
3925
|
+
{ find: "vue/dist/vue.esm-bundler.js", replacement: await resolveImportPath("vue/dist/vue.runtime.esm-bundler.js", true) }
|
|
3926
|
+
);
|
|
3726
3927
|
}
|
|
3727
3928
|
const vueRouterPkg = await resolveImportPath("vue-router/package.json");
|
|
3728
3929
|
if (vueRouterPkg)
|
|
@@ -3755,8 +3956,6 @@ async function getAlias(options) {
|
|
|
3755
3956
|
const LAYOUTS_MODULE_ID = "virtual:generated-layouts";
|
|
3756
3957
|
const RESOLVED_LAYOUTS_MODULE_ID = `\0${LAYOUTS_MODULE_ID}`;
|
|
3757
3958
|
function defaultImportMode(name) {
|
|
3758
|
-
if (process.env.VITE_SSG)
|
|
3759
|
-
return "sync";
|
|
3760
3959
|
return name === "default" ? "sync" : "async";
|
|
3761
3960
|
}
|
|
3762
3961
|
const REGEX_BACKSLASH = /\\/g;
|
|
@@ -3860,11 +4059,9 @@ function resolveLayoutsOptions(options, userOptions = {}) {
|
|
|
3860
4059
|
extensions: ["vue"],
|
|
3861
4060
|
exclude: [],
|
|
3862
4061
|
defaultLayout: "default",
|
|
3863
|
-
//
|
|
3864
|
-
//
|
|
3865
|
-
|
|
3866
|
-
// hydration starts, causing a mismatch.
|
|
3867
|
-
importMode: options.mode === "build" ? () => "sync" : defaultImportMode,
|
|
4062
|
+
// LayoutWrapper waits for the active layout in its navigation guards,
|
|
4063
|
+
// before router.isReady() allows SSR or client hydration to begin.
|
|
4064
|
+
importMode: defaultImportMode,
|
|
3868
4065
|
inheritDefaultLayout: true
|
|
3869
4066
|
};
|
|
3870
4067
|
for (const [key, value] of Object.entries(userOptions)) {
|
|
@@ -4028,16 +4225,21 @@ async function resolveRawMd(url, options) {
|
|
|
4028
4225
|
if (!filePath)
|
|
4029
4226
|
return null;
|
|
4030
4227
|
const raw = await fs.readFile(filePath, "utf-8");
|
|
4031
|
-
const
|
|
4032
|
-
|
|
4228
|
+
const parsed = matter(raw, matterOptions);
|
|
4229
|
+
const data = { ...options.config.siteConfig.frontmatter, ...parsed.data };
|
|
4230
|
+
const content = stripEncryptedContent(parsed.content);
|
|
4231
|
+
const publishing = options.config.siteConfig.publishing;
|
|
4232
|
+
const relative = relativePagePath(filePath, options.userRoot);
|
|
4233
|
+
if (data.password || data.encrypt === true || data.hide || data.draft && !publishing?.drafts)
|
|
4234
|
+
return null;
|
|
4235
|
+
if (relative && isUnpublishedPage(relative, publishing))
|
|
4033
4236
|
return null;
|
|
4034
4237
|
const lang = options.config.siteConfig.lang || "en";
|
|
4035
4238
|
url.replace(/\.md$/, "");
|
|
4036
4239
|
const cleanedFrontmatter = stripSensitiveFrontmatter(data);
|
|
4037
4240
|
const post = {
|
|
4038
|
-
title: resolveText(data.title, lang) || path.basename(filePath, ".md"),
|
|
4039
|
-
description: resolveText(data.description, lang) || "",
|
|
4040
|
-
date: data.date ? new Date(data.date) : /* @__PURE__ */ new Date(0),
|
|
4241
|
+
title: resolveText(data.title || "", lang) || path.basename(filePath, ".md"),
|
|
4242
|
+
description: resolveText(data.description || "", lang) || "",
|
|
4041
4243
|
sourcePath: getPagePath(filePath, options.userRoot),
|
|
4042
4244
|
rawFrontmatter: cleanedFrontmatter
|
|
4043
4245
|
};
|
|
@@ -5473,6 +5675,664 @@ async function setupMarkdownPlugins(md, options, base = options?.config.vite?.ba
|
|
|
5473
5675
|
return md;
|
|
5474
5676
|
}
|
|
5475
5677
|
|
|
5678
|
+
//#region src/html-re.ts
|
|
5679
|
+
const attr_name = "[a-zA-Z_:@][a-zA-Z0-9:._-]*";
|
|
5680
|
+
const attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)";
|
|
5681
|
+
const open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>";
|
|
5682
|
+
const HTML_TAG_RE = /* @__PURE__ */ new RegExp("^(?:" + open_tag + "|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->|<[?][\\s\\S]*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)");
|
|
5683
|
+
const HTML_OPEN_CLOSE_TAG_RE = /* @__PURE__ */ new RegExp("^(?:" + open_tag + "|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)");
|
|
5684
|
+
const HTML_SELF_CLOSING_TAG_RE = /* @__PURE__ */ new RegExp("^<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/>");
|
|
5685
|
+
const HTML_OPEN_AND_CLOSE_TAG_IN_THE_SAME_LINE_RE = /* @__PURE__ */ new RegExp("^<([A-Za-z][A-Za-z0-9\\-]*)" + attribute + "*\\s*>.*<\\/\\1\\s*>");
|
|
5686
|
+
|
|
5687
|
+
//#endregion
|
|
5688
|
+
//#region src/tags.ts
|
|
5689
|
+
/**
|
|
5690
|
+
* List of block tags
|
|
5691
|
+
*
|
|
5692
|
+
* @see https://spec.commonmark.org/0.30/#html-blocks
|
|
5693
|
+
* @see https://github.com/markdown-it/markdown-it/blob/master/lib/common/html_blocks.mjs
|
|
5694
|
+
*/
|
|
5695
|
+
const TAGS_BLOCK = [
|
|
5696
|
+
"address",
|
|
5697
|
+
"article",
|
|
5698
|
+
"aside",
|
|
5699
|
+
"base",
|
|
5700
|
+
"basefont",
|
|
5701
|
+
"blockquote",
|
|
5702
|
+
"body",
|
|
5703
|
+
"caption",
|
|
5704
|
+
"center",
|
|
5705
|
+
"col",
|
|
5706
|
+
"colgroup",
|
|
5707
|
+
"dd",
|
|
5708
|
+
"details",
|
|
5709
|
+
"dialog",
|
|
5710
|
+
"dir",
|
|
5711
|
+
"div",
|
|
5712
|
+
"dl",
|
|
5713
|
+
"dt",
|
|
5714
|
+
"fieldset",
|
|
5715
|
+
"figcaption",
|
|
5716
|
+
"figure",
|
|
5717
|
+
"footer",
|
|
5718
|
+
"form",
|
|
5719
|
+
"frame",
|
|
5720
|
+
"frameset",
|
|
5721
|
+
"h1",
|
|
5722
|
+
"h2",
|
|
5723
|
+
"h3",
|
|
5724
|
+
"h4",
|
|
5725
|
+
"h5",
|
|
5726
|
+
"h6",
|
|
5727
|
+
"head",
|
|
5728
|
+
"header",
|
|
5729
|
+
"hr",
|
|
5730
|
+
"html",
|
|
5731
|
+
"iframe",
|
|
5732
|
+
"legend",
|
|
5733
|
+
"li",
|
|
5734
|
+
"link",
|
|
5735
|
+
"main",
|
|
5736
|
+
"menu",
|
|
5737
|
+
"menuitem",
|
|
5738
|
+
"nav",
|
|
5739
|
+
"noframes",
|
|
5740
|
+
"ol",
|
|
5741
|
+
"optgroup",
|
|
5742
|
+
"option",
|
|
5743
|
+
"p",
|
|
5744
|
+
"param",
|
|
5745
|
+
"search",
|
|
5746
|
+
"section",
|
|
5747
|
+
"summary",
|
|
5748
|
+
"table",
|
|
5749
|
+
"tbody",
|
|
5750
|
+
"td",
|
|
5751
|
+
"tfoot",
|
|
5752
|
+
"th",
|
|
5753
|
+
"thead",
|
|
5754
|
+
"title",
|
|
5755
|
+
"tr",
|
|
5756
|
+
"track",
|
|
5757
|
+
"ul"
|
|
5758
|
+
];
|
|
5759
|
+
/**
|
|
5760
|
+
* According to markdown spec, all non-block html tags are treated as "inline"
|
|
5761
|
+
* tags (wrapped with <p></p>), including those "unknown" tags
|
|
5762
|
+
*
|
|
5763
|
+
* Therefore, markdown-it processes "inline" tags and "unknown" tags in the same
|
|
5764
|
+
* way, and does not care if a tag is "inline" or "unknown"
|
|
5765
|
+
*
|
|
5766
|
+
* As we want to take those "unknown" tags as custom components, we should
|
|
5767
|
+
* treat them as "block" tags
|
|
5768
|
+
*
|
|
5769
|
+
* So we have to distinguish between "inline" and "unknown" tags ourselves
|
|
5770
|
+
*
|
|
5771
|
+
* The inline tags list comes from MDN
|
|
5772
|
+
*
|
|
5773
|
+
* @see https://spec.commonmark.org/0.30/#raw-html
|
|
5774
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
|
|
5775
|
+
*/
|
|
5776
|
+
const TAGS_INLINE = [
|
|
5777
|
+
"a",
|
|
5778
|
+
"abbr",
|
|
5779
|
+
"acronym",
|
|
5780
|
+
"audio",
|
|
5781
|
+
"b",
|
|
5782
|
+
"bdi",
|
|
5783
|
+
"bdo",
|
|
5784
|
+
"big",
|
|
5785
|
+
"br",
|
|
5786
|
+
"button",
|
|
5787
|
+
"canvas",
|
|
5788
|
+
"cite",
|
|
5789
|
+
"code",
|
|
5790
|
+
"data",
|
|
5791
|
+
"datalist",
|
|
5792
|
+
"del",
|
|
5793
|
+
"dfn",
|
|
5794
|
+
"em",
|
|
5795
|
+
"embed",
|
|
5796
|
+
"i",
|
|
5797
|
+
"iframe",
|
|
5798
|
+
"img",
|
|
5799
|
+
"input",
|
|
5800
|
+
"ins",
|
|
5801
|
+
"kbd",
|
|
5802
|
+
"label",
|
|
5803
|
+
"map",
|
|
5804
|
+
"mark",
|
|
5805
|
+
"meter",
|
|
5806
|
+
"noscript",
|
|
5807
|
+
"object",
|
|
5808
|
+
"output",
|
|
5809
|
+
"picture",
|
|
5810
|
+
"progress",
|
|
5811
|
+
"q",
|
|
5812
|
+
"ruby",
|
|
5813
|
+
"s",
|
|
5814
|
+
"samp",
|
|
5815
|
+
"script",
|
|
5816
|
+
"select",
|
|
5817
|
+
"slot",
|
|
5818
|
+
"small",
|
|
5819
|
+
"span",
|
|
5820
|
+
"strong",
|
|
5821
|
+
"sub",
|
|
5822
|
+
"sup",
|
|
5823
|
+
"svg",
|
|
5824
|
+
"template",
|
|
5825
|
+
"textarea",
|
|
5826
|
+
"time",
|
|
5827
|
+
"u",
|
|
5828
|
+
"tt",
|
|
5829
|
+
"var",
|
|
5830
|
+
"video",
|
|
5831
|
+
"wbr"
|
|
5832
|
+
];
|
|
5833
|
+
/**
|
|
5834
|
+
* Tags of Vue built-in components
|
|
5835
|
+
*
|
|
5836
|
+
* @see https://vuejs.org/api/built-in-components.html
|
|
5837
|
+
* @see https://vuejs.org/api/built-in-special-elements.html
|
|
5838
|
+
*/
|
|
5839
|
+
const TAGS_VUE_RESERVED = [
|
|
5840
|
+
"template",
|
|
5841
|
+
"component",
|
|
5842
|
+
"transition",
|
|
5843
|
+
"transition-group",
|
|
5844
|
+
"keep-alive",
|
|
5845
|
+
"slot",
|
|
5846
|
+
"teleport"
|
|
5847
|
+
];
|
|
5848
|
+
|
|
5849
|
+
//#endregion
|
|
5850
|
+
//#region src/html-block-rule.ts
|
|
5851
|
+
/**
|
|
5852
|
+
* ADDED: wrap the `HTML_SEQUENCES` with a function, because we allow user options
|
|
5853
|
+
* to customize the block tags and inline tags
|
|
5854
|
+
*/
|
|
5855
|
+
const createHtmlSequences = ({ blockTags, inlineTags }) => {
|
|
5856
|
+
const forceBlockTags = [...blockTags, ...TAGS_BLOCK];
|
|
5857
|
+
const forceInlineTags = [...inlineTags, ...TAGS_INLINE.filter((item) => !TAGS_VUE_RESERVED.includes(item))];
|
|
5858
|
+
const HTML_SEQUENCES = [
|
|
5859
|
+
[
|
|
5860
|
+
/^<(script|pre|style)(?=(\s|>|$))/i,
|
|
5861
|
+
/<\/(script|pre|style)>/i,
|
|
5862
|
+
true
|
|
5863
|
+
],
|
|
5864
|
+
[
|
|
5865
|
+
/^<!--/,
|
|
5866
|
+
/-->/,
|
|
5867
|
+
true
|
|
5868
|
+
],
|
|
5869
|
+
[
|
|
5870
|
+
/^<\?/,
|
|
5871
|
+
/\?>/,
|
|
5872
|
+
true
|
|
5873
|
+
],
|
|
5874
|
+
[
|
|
5875
|
+
/^<![A-Z]/,
|
|
5876
|
+
/>/,
|
|
5877
|
+
true
|
|
5878
|
+
],
|
|
5879
|
+
[
|
|
5880
|
+
/^<!\[CDATA\[/,
|
|
5881
|
+
/\]\]>/,
|
|
5882
|
+
true
|
|
5883
|
+
],
|
|
5884
|
+
[
|
|
5885
|
+
new RegExp("^</?(" + forceBlockTags.join("|") + ")(?=(\\s|/?>|$))", "i"),
|
|
5886
|
+
/^$/,
|
|
5887
|
+
true
|
|
5888
|
+
],
|
|
5889
|
+
[
|
|
5890
|
+
/* @__PURE__ */ new RegExp("^</?(?!(" + forceInlineTags.join("|") + ")(?![\\w-]))[A-Za-z][A-Za-z0-9\\-]*(?=(\\s|/?>|$))"),
|
|
5891
|
+
/^$/,
|
|
5892
|
+
true
|
|
5893
|
+
],
|
|
5894
|
+
[
|
|
5895
|
+
/* @__PURE__ */ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + "\\s*$"),
|
|
5896
|
+
/^$/,
|
|
5897
|
+
false
|
|
5898
|
+
]
|
|
5899
|
+
];
|
|
5900
|
+
return HTML_SEQUENCES;
|
|
5901
|
+
};
|
|
5902
|
+
const createHtmlBlockRule = (options) => {
|
|
5903
|
+
const HTML_SEQUENCES = createHtmlSequences(options);
|
|
5904
|
+
return (state, startLine, endLine, silent) => {
|
|
5905
|
+
let i;
|
|
5906
|
+
let nextLine;
|
|
5907
|
+
let lineText;
|
|
5908
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
5909
|
+
let max = state.eMarks[startLine];
|
|
5910
|
+
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
5911
|
+
if (!state.md.options.html) return false;
|
|
5912
|
+
if (state.src.charCodeAt(pos) !== 60) return false;
|
|
5913
|
+
lineText = state.src.slice(pos, max);
|
|
5914
|
+
for (i = 0; i < HTML_SEQUENCES.length; i++) if (HTML_SEQUENCES[i][0].test(lineText)) break;
|
|
5915
|
+
if (i === HTML_SEQUENCES.length) return false;
|
|
5916
|
+
if (silent) return HTML_SEQUENCES[i][2];
|
|
5917
|
+
if (i === 6) {
|
|
5918
|
+
const match = lineText.match(HTML_SELF_CLOSING_TAG_RE) ?? lineText.match(HTML_OPEN_AND_CLOSE_TAG_IN_THE_SAME_LINE_RE);
|
|
5919
|
+
if (match) {
|
|
5920
|
+
state.line = startLine + 1;
|
|
5921
|
+
let token$1 = state.push("html_inline", "", 0);
|
|
5922
|
+
token$1.content = match[0];
|
|
5923
|
+
token$1.map = [startLine, state.line];
|
|
5924
|
+
token$1 = state.push("inline", "", 0);
|
|
5925
|
+
token$1.content = lineText.slice(match[0].length);
|
|
5926
|
+
token$1.map = [startLine, state.line];
|
|
5927
|
+
token$1.children = [];
|
|
5928
|
+
return true;
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
nextLine = startLine + 1;
|
|
5932
|
+
if (!HTML_SEQUENCES[i][1].test(lineText)) for (; nextLine < endLine; nextLine++) {
|
|
5933
|
+
if (state.sCount[nextLine] < state.blkIndent) break;
|
|
5934
|
+
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
5935
|
+
max = state.eMarks[nextLine];
|
|
5936
|
+
lineText = state.src.slice(pos, max);
|
|
5937
|
+
if (HTML_SEQUENCES[i][1].test(lineText)) {
|
|
5938
|
+
if (lineText.length !== 0) nextLine++;
|
|
5939
|
+
break;
|
|
5940
|
+
}
|
|
5941
|
+
}
|
|
5942
|
+
state.line = nextLine;
|
|
5943
|
+
const token = state.push("html_block", "", 0);
|
|
5944
|
+
token.map = [startLine, nextLine];
|
|
5945
|
+
token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
|
|
5946
|
+
return true;
|
|
5947
|
+
};
|
|
5948
|
+
};
|
|
5949
|
+
|
|
5950
|
+
//#endregion
|
|
5951
|
+
//#region src/html-inline-rule.ts
|
|
5952
|
+
const isLetter = (ch) => {
|
|
5953
|
+
const lc = ch | 32;
|
|
5954
|
+
return lc >= 97 && lc <= 122;
|
|
5955
|
+
};
|
|
5956
|
+
const htmlInlineRule = (state, silent) => {
|
|
5957
|
+
const { pos } = state;
|
|
5958
|
+
if (!state.md.options.html) return false;
|
|
5959
|
+
const max = state.posMax;
|
|
5960
|
+
if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
|
|
5961
|
+
const ch = state.src.charCodeAt(pos + 1);
|
|
5962
|
+
if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter(ch)) return false;
|
|
5963
|
+
const match = state.src.slice(pos).match(HTML_TAG_RE);
|
|
5964
|
+
if (!match) return false;
|
|
5965
|
+
if (!silent) {
|
|
5966
|
+
const token = state.push("html_inline", "", 0);
|
|
5967
|
+
token.content = state.src.slice(pos, pos + match[0].length);
|
|
5968
|
+
}
|
|
5969
|
+
state.pos += match[0].length;
|
|
5970
|
+
return true;
|
|
5971
|
+
};
|
|
5972
|
+
|
|
5973
|
+
//#endregion
|
|
5974
|
+
//#region src/component-plugin.ts
|
|
5975
|
+
/**
|
|
5976
|
+
* Allows better use of Vue components in Markdown
|
|
5977
|
+
*/
|
|
5978
|
+
const componentPlugin = (md, { blockTags = [], inlineTags = [] } = {}) => {
|
|
5979
|
+
const htmlBlockRule = createHtmlBlockRule({
|
|
5980
|
+
blockTags,
|
|
5981
|
+
inlineTags
|
|
5982
|
+
});
|
|
5983
|
+
md.block.ruler.at("html_block", htmlBlockRule, { alt: [
|
|
5984
|
+
"paragraph",
|
|
5985
|
+
"reference",
|
|
5986
|
+
"blockquote"
|
|
5987
|
+
] });
|
|
5988
|
+
md.inline.ruler.at("html_inline", htmlInlineRule);
|
|
5989
|
+
};
|
|
5990
|
+
|
|
5991
|
+
//#region src/frontmatter-plugin.ts
|
|
5992
|
+
/**
|
|
5993
|
+
* Get markdown frontmatter and excerpt
|
|
5994
|
+
*
|
|
5995
|
+
* Extract them into env
|
|
5996
|
+
*/
|
|
5997
|
+
const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = true } = {}) => {
|
|
5998
|
+
const parse = md.parse.bind(md);
|
|
5999
|
+
md.parse = (src, env = {}) => {
|
|
6000
|
+
const { data, content, excerpt = "" } = matter(src, grayMatterOptions);
|
|
6001
|
+
env.content = content;
|
|
6002
|
+
env.frontmatter = {
|
|
6003
|
+
...env.frontmatter,
|
|
6004
|
+
...data
|
|
6005
|
+
};
|
|
6006
|
+
env.excerpt = renderExcerpt && excerpt ? md.render(excerpt, { ...env }) : excerpt;
|
|
6007
|
+
return parse(content, env);
|
|
6008
|
+
};
|
|
6009
|
+
};
|
|
6010
|
+
|
|
6011
|
+
//#region \0rolldown/runtime.js
|
|
6012
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
6013
|
+
//#endregion
|
|
6014
|
+
//#region node_modules/.pnpm/@antfu+utils@9.3.0/node_modules/@antfu/utils/dist/index.mjs
|
|
6015
|
+
function toArray(array) {
|
|
6016
|
+
array = array ?? [];
|
|
6017
|
+
return Array.isArray(array) ? array : [array];
|
|
6018
|
+
}
|
|
6019
|
+
function uniq(array) {
|
|
6020
|
+
return Array.from(new Set(array));
|
|
6021
|
+
}
|
|
6022
|
+
//#endregion
|
|
6023
|
+
//#region src/core/head.ts
|
|
6024
|
+
const headProperties = [
|
|
6025
|
+
"title",
|
|
6026
|
+
"meta",
|
|
6027
|
+
"link",
|
|
6028
|
+
"base",
|
|
6029
|
+
"style",
|
|
6030
|
+
"script",
|
|
6031
|
+
"htmlAttrs",
|
|
6032
|
+
"bodyAttrs"
|
|
6033
|
+
];
|
|
6034
|
+
function preprocessHead(frontmatter, options) {
|
|
6035
|
+
if (!options.headEnabled) return frontmatter;
|
|
6036
|
+
const head = options.headField ? frontmatter[options.headField] || {} : frontmatter;
|
|
6037
|
+
const meta = head.meta = head.meta || [];
|
|
6038
|
+
if (head.title) {
|
|
6039
|
+
if (!meta.some((i) => i.property === "og:title")) meta.push({
|
|
6040
|
+
property: "og:title",
|
|
6041
|
+
content: head.title
|
|
6042
|
+
});
|
|
6043
|
+
if (!meta.some((i) => i.name === "twitter:title")) meta.push({
|
|
6044
|
+
name: "twitter:title",
|
|
6045
|
+
content: head.title
|
|
6046
|
+
});
|
|
6047
|
+
}
|
|
6048
|
+
if (head.description) {
|
|
6049
|
+
if (!meta.some((i) => i.name === "description")) meta.push({
|
|
6050
|
+
name: "description",
|
|
6051
|
+
content: head.description
|
|
6052
|
+
});
|
|
6053
|
+
if (!meta.some((i) => i.property === "og:description")) meta.push({
|
|
6054
|
+
property: "og:description",
|
|
6055
|
+
content: head.description
|
|
6056
|
+
});
|
|
6057
|
+
if (!meta.some((i) => i.name === "twitter:description")) meta.push({
|
|
6058
|
+
name: "twitter:description",
|
|
6059
|
+
content: head.description
|
|
6060
|
+
});
|
|
6061
|
+
}
|
|
6062
|
+
if (head.image) {
|
|
6063
|
+
if (!meta.some((i) => i.property === "og:image")) meta.push({
|
|
6064
|
+
property: "og:image",
|
|
6065
|
+
content: head.image
|
|
6066
|
+
});
|
|
6067
|
+
if (!meta.some((i) => i.name === "twitter:image")) meta.push({
|
|
6068
|
+
name: "twitter:image",
|
|
6069
|
+
content: head.image
|
|
6070
|
+
});
|
|
6071
|
+
if (!meta.some((i) => i.property === "twitter:card")) meta.push({
|
|
6072
|
+
name: "twitter:card",
|
|
6073
|
+
content: "summary_large_image"
|
|
6074
|
+
});
|
|
6075
|
+
}
|
|
6076
|
+
const result = {};
|
|
6077
|
+
for (const [key, value] of Object.entries(head)) if (headProperties.includes(key)) result[key] = value;
|
|
6078
|
+
return Object.entries(result).length === 0 ? null : result;
|
|
6079
|
+
}
|
|
6080
|
+
//#endregion
|
|
6081
|
+
//#region src/core/markdown.ts
|
|
6082
|
+
const scriptSetupRE = /<\s*script([^>]*)\bsetup\b([^>]*)>([\s\S]*)<\/script>/g;
|
|
6083
|
+
const defineExposeRE = /defineExpose\s*\(/g;
|
|
6084
|
+
const EXPORTS_KEYWORDS = [
|
|
6085
|
+
"class",
|
|
6086
|
+
"default",
|
|
6087
|
+
"export",
|
|
6088
|
+
"function",
|
|
6089
|
+
"import",
|
|
6090
|
+
"let",
|
|
6091
|
+
"var",
|
|
6092
|
+
"const",
|
|
6093
|
+
"from",
|
|
6094
|
+
"as",
|
|
6095
|
+
"return",
|
|
6096
|
+
"if",
|
|
6097
|
+
"else",
|
|
6098
|
+
"switch",
|
|
6099
|
+
"case",
|
|
6100
|
+
"break",
|
|
6101
|
+
"for",
|
|
6102
|
+
"while",
|
|
6103
|
+
"do"
|
|
6104
|
+
];
|
|
6105
|
+
function extractScriptSetup(html) {
|
|
6106
|
+
const scripts = [];
|
|
6107
|
+
html = html.replace(scriptSetupRE, (_, attr1, attr2, code) => {
|
|
6108
|
+
scripts.push({
|
|
6109
|
+
code,
|
|
6110
|
+
attr: `${attr1} ${attr2}`.trim()
|
|
6111
|
+
});
|
|
6112
|
+
return "";
|
|
6113
|
+
});
|
|
6114
|
+
return {
|
|
6115
|
+
html,
|
|
6116
|
+
scripts
|
|
6117
|
+
};
|
|
6118
|
+
}
|
|
6119
|
+
function extractCustomBlock(html, options) {
|
|
6120
|
+
const blocks = [];
|
|
6121
|
+
for (const tag of options.customSfcBlocks) html = html.replace(new RegExp(`<${tag}[^>]*\\b[^>]*>[^<]*<\\/${tag}>`, "gm"), (code) => {
|
|
6122
|
+
blocks.push(code);
|
|
6123
|
+
return "";
|
|
6124
|
+
});
|
|
6125
|
+
return {
|
|
6126
|
+
html,
|
|
6127
|
+
blocks
|
|
6128
|
+
};
|
|
6129
|
+
}
|
|
6130
|
+
function createMarkdown(options) {
|
|
6131
|
+
const isVue2 = options.vueVersion.startsWith("2.");
|
|
6132
|
+
const setupPromise = (async () => {
|
|
6133
|
+
const md = createMarkdownExit({
|
|
6134
|
+
html: true,
|
|
6135
|
+
linkify: true,
|
|
6136
|
+
typographer: true,
|
|
6137
|
+
...options.markdownOptions
|
|
6138
|
+
});
|
|
6139
|
+
md.use(componentPlugin, options.componentOptions);
|
|
6140
|
+
if (options.frontmatter || options.excerpt) md.use(frontmatterPlugin, {
|
|
6141
|
+
...options.frontmatterOptions,
|
|
6142
|
+
grayMatterOptions: {
|
|
6143
|
+
excerpt: options.excerpt,
|
|
6144
|
+
...options.frontmatterOptions.grayMatterOptions
|
|
6145
|
+
}
|
|
6146
|
+
});
|
|
6147
|
+
md.linkify.set({ fuzzyLink: false });
|
|
6148
|
+
options.markdownUses.forEach((e) => {
|
|
6149
|
+
const [plugin, options] = toArray(e);
|
|
6150
|
+
md.use(plugin, options);
|
|
6151
|
+
});
|
|
6152
|
+
await options.markdownSetup(md);
|
|
6153
|
+
return md;
|
|
6154
|
+
})();
|
|
6155
|
+
return async (id, raw) => {
|
|
6156
|
+
const md = await setupPromise;
|
|
6157
|
+
const { wrapperDiv, wrapperClasses, wrapperComponent, transforms, headEnabled, frontmatterPreprocess } = options;
|
|
6158
|
+
raw = raw.trimStart();
|
|
6159
|
+
raw = await transforms.before?.(raw, id) ?? raw;
|
|
6160
|
+
const env = { id };
|
|
6161
|
+
let html = await md.renderAsync(raw, env);
|
|
6162
|
+
const { excerpt = "", frontmatter: data = null } = env;
|
|
6163
|
+
if (wrapperDiv) {
|
|
6164
|
+
const wrapperClassesResolved = toArray(typeof wrapperClasses === "function" ? wrapperClasses(id, raw) : wrapperClasses).filter(Boolean).join(" ");
|
|
6165
|
+
if (wrapperClassesResolved) html = `<div class="${wrapperClassesResolved}">${html}</div>`;
|
|
6166
|
+
else html = `<div>${html}</div>`;
|
|
6167
|
+
}
|
|
6168
|
+
const wrapperComponentName = typeof wrapperComponent === "function" ? wrapperComponent(id, raw) : wrapperComponent;
|
|
6169
|
+
if (wrapperComponentName) html = `<${wrapperComponentName} ${[options.frontmatter && ":frontmatter=\"frontmatter\"", options.excerpt && ":excerpt=\"excerpt\""].filter(Boolean).join(" ")}>${html}</${wrapperComponentName}>`;
|
|
6170
|
+
html = await transforms.after?.(html, id) ?? html;
|
|
6171
|
+
if (options.escapeCodeTagInterpolation) html = html.replace(/<code(.*?)>/g, "<code$1 v-pre>");
|
|
6172
|
+
const hoistScripts = extractScriptSetup(html);
|
|
6173
|
+
html = hoistScripts.html;
|
|
6174
|
+
const customBlocks = extractCustomBlock(html, options);
|
|
6175
|
+
html = customBlocks.html;
|
|
6176
|
+
const scriptLines = [];
|
|
6177
|
+
let frontmatterExportsLines = [];
|
|
6178
|
+
let excerptExportsLine = "";
|
|
6179
|
+
let excerptKeyOverlapping = false;
|
|
6180
|
+
function hasExplicitExports() {
|
|
6181
|
+
return defineExposeRE.test(hoistScripts.scripts.map((i) => i.code).join(""));
|
|
6182
|
+
}
|
|
6183
|
+
if (options.frontmatter) {
|
|
6184
|
+
if (options.excerpt && data) {
|
|
6185
|
+
if (data.excerpt !== void 0) excerptKeyOverlapping = true;
|
|
6186
|
+
data.excerpt = excerpt;
|
|
6187
|
+
}
|
|
6188
|
+
const { head, frontmatter } = frontmatterPreprocess(data || {}, options, id, preprocessHead);
|
|
6189
|
+
if (options.excerpt && !excerptKeyOverlapping && frontmatter.excerpt !== void 0) delete frontmatter.excerpt;
|
|
6190
|
+
scriptLines.push(`const frontmatter = ${JSON.stringify(frontmatter)}`);
|
|
6191
|
+
if (options.exportFrontmatter) frontmatterExportsLines = Object.entries(frontmatter).map(([key, value]) => {
|
|
6192
|
+
if (EXPORTS_KEYWORDS.includes(key)) key = `_${key}`;
|
|
6193
|
+
return `export const ${key} = ${JSON.stringify(value)}`;
|
|
6194
|
+
});
|
|
6195
|
+
if (!isVue2 && options.exposeFrontmatter && !hasExplicitExports()) scriptLines.push("defineExpose({ frontmatter })");
|
|
6196
|
+
if (!isVue2 && headEnabled && head) {
|
|
6197
|
+
if (headEnabled === "vueuse") throw new Error("unplugin-vue-markdown no longer supports @vueuse/head. Change `headEnabled` to `true` and install `@unhead/vue` instead.");
|
|
6198
|
+
scriptLines.push(`const head = ${JSON.stringify(head)}`);
|
|
6199
|
+
scriptLines.unshift(`import { useHead } from "@unhead/vue"`);
|
|
6200
|
+
scriptLines.push("useHead(head)");
|
|
6201
|
+
}
|
|
6202
|
+
scriptLines.push(...await transforms.extraScripts?.(frontmatter, id) || []);
|
|
6203
|
+
}
|
|
6204
|
+
if (options.excerpt) {
|
|
6205
|
+
scriptLines.push(`const excerpt = ${JSON.stringify(excerpt)}`);
|
|
6206
|
+
if (!excerptKeyOverlapping) excerptExportsLine = `export const excerpt = ${JSON.stringify(excerpt)}\n`;
|
|
6207
|
+
if (!isVue2 && options.exposeExcerpt && !hasExplicitExports()) scriptLines.push("defineExpose({ excerpt })");
|
|
6208
|
+
}
|
|
6209
|
+
scriptLines.push(...hoistScripts.scripts.map((i) => i.code));
|
|
6210
|
+
let attrs = uniq(hoistScripts.scripts.map((i) => i.attr)).join(" ").trim();
|
|
6211
|
+
if (attrs) attrs = ` ${attrs}`;
|
|
6212
|
+
const scripts = isVue2 ? [
|
|
6213
|
+
`<script${attrs}>`,
|
|
6214
|
+
...scriptLines,
|
|
6215
|
+
...frontmatterExportsLines,
|
|
6216
|
+
excerptExportsLine,
|
|
6217
|
+
"export default { data() { return { frontmatter } } }",
|
|
6218
|
+
"<\/script>"
|
|
6219
|
+
] : [
|
|
6220
|
+
`<script setup${attrs}>`,
|
|
6221
|
+
...scriptLines,
|
|
6222
|
+
"<\/script>",
|
|
6223
|
+
...frontmatterExportsLines.length || excerptExportsLine ? [
|
|
6224
|
+
`<script${attrs}>`,
|
|
6225
|
+
...frontmatterExportsLines,
|
|
6226
|
+
excerptExportsLine,
|
|
6227
|
+
"<\/script>"
|
|
6228
|
+
] : []
|
|
6229
|
+
];
|
|
6230
|
+
return {
|
|
6231
|
+
code: [
|
|
6232
|
+
`<template>${html}</template>`,
|
|
6233
|
+
...scripts.map((i) => i.trim()).filter(Boolean),
|
|
6234
|
+
...customBlocks.blocks
|
|
6235
|
+
].join("\n"),
|
|
6236
|
+
map: { mappings: "" }
|
|
6237
|
+
};
|
|
6238
|
+
};
|
|
6239
|
+
}
|
|
6240
|
+
//#endregion
|
|
6241
|
+
//#region src/core/utils.ts
|
|
6242
|
+
const _require = typeof __require === "undefined" ? createRequire(import.meta.url) : __require;
|
|
6243
|
+
function getVueVersion(defaultVersion = "3.2.0") {
|
|
6244
|
+
try {
|
|
6245
|
+
let v = _require("vue");
|
|
6246
|
+
if (v.default) v = v.default;
|
|
6247
|
+
return v.version || defaultVersion;
|
|
6248
|
+
} catch {
|
|
6249
|
+
return defaultVersion;
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
//#endregion
|
|
6253
|
+
//#region src/core/options.ts
|
|
6254
|
+
function resolveOptions(userOptions) {
|
|
6255
|
+
const noop = () => {};
|
|
6256
|
+
const markdownOptions = userOptions.markdownOptions ?? userOptions.markdownItOptions ?? {};
|
|
6257
|
+
const markdownUses = userOptions.markdownUses ?? userOptions.markdownItUses ?? [];
|
|
6258
|
+
const markdownSetup = userOptions.markdownSetup ?? userOptions.markdownItSetup ?? noop;
|
|
6259
|
+
return {
|
|
6260
|
+
headEnabled: false,
|
|
6261
|
+
headField: "",
|
|
6262
|
+
frontmatter: true,
|
|
6263
|
+
excerpt: false,
|
|
6264
|
+
exposeFrontmatter: true,
|
|
6265
|
+
exposeExcerpt: false,
|
|
6266
|
+
exportFrontmatter: true,
|
|
6267
|
+
escapeCodeTagInterpolation: true,
|
|
6268
|
+
customSfcBlocks: [
|
|
6269
|
+
"route",
|
|
6270
|
+
"i18n",
|
|
6271
|
+
"style"
|
|
6272
|
+
],
|
|
6273
|
+
componentOptions: {},
|
|
6274
|
+
frontmatterOptions: {},
|
|
6275
|
+
markdownOptions: {},
|
|
6276
|
+
markdownUses: [],
|
|
6277
|
+
markdownSetup: noop,
|
|
6278
|
+
markdownItOptions: {},
|
|
6279
|
+
markdownItUses: [],
|
|
6280
|
+
markdownItSetup: noop,
|
|
6281
|
+
wrapperDiv: true,
|
|
6282
|
+
wrapperComponent: null,
|
|
6283
|
+
transforms: {},
|
|
6284
|
+
vueVersion: userOptions.vueVersion || getVueVersion(),
|
|
6285
|
+
wrapperClasses: "markdown-body",
|
|
6286
|
+
include: null,
|
|
6287
|
+
exclude: null,
|
|
6288
|
+
frontmatterPreprocess: (frontmatter, options, _id, defaults) => {
|
|
6289
|
+
return {
|
|
6290
|
+
head: defaults(frontmatter, options),
|
|
6291
|
+
frontmatter
|
|
6292
|
+
};
|
|
6293
|
+
},
|
|
6294
|
+
...userOptions,
|
|
6295
|
+
markdownOptions,
|
|
6296
|
+
markdownUses,
|
|
6297
|
+
markdownSetup,
|
|
6298
|
+
markdownItOptions: markdownOptions,
|
|
6299
|
+
markdownItUses: markdownUses,
|
|
6300
|
+
markdownItSetup: markdownSetup
|
|
6301
|
+
};
|
|
6302
|
+
}
|
|
6303
|
+
//#endregion
|
|
6304
|
+
//#region src/index.ts
|
|
6305
|
+
const cssIdRE = /\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;
|
|
6306
|
+
const unpluginFactory = (userOptions = {}) => {
|
|
6307
|
+
const markdownToVue = createMarkdown(resolveOptions(userOptions));
|
|
6308
|
+
const filter = createFilter(userOptions.include || /\.md$|\.md\?vue/, userOptions.exclude || cssIdRE);
|
|
6309
|
+
return {
|
|
6310
|
+
name: "unplugin-vue-markdown",
|
|
6311
|
+
enforce: "pre",
|
|
6312
|
+
transformInclude(id) {
|
|
6313
|
+
return filter(id);
|
|
6314
|
+
},
|
|
6315
|
+
async transform(raw, id) {
|
|
6316
|
+
if (id.includes("?vue&type=")) return null;
|
|
6317
|
+
try {
|
|
6318
|
+
return await markdownToVue(id, raw);
|
|
6319
|
+
} catch (e) {
|
|
6320
|
+
this.error(e);
|
|
6321
|
+
}
|
|
6322
|
+
},
|
|
6323
|
+
vite: { async handleHotUpdate(ctx) {
|
|
6324
|
+
if (!filter(ctx.file)) return;
|
|
6325
|
+
const defaultRead = ctx.read;
|
|
6326
|
+
ctx.read = async function() {
|
|
6327
|
+
return (await markdownToVue(ctx.file, await defaultRead())).code;
|
|
6328
|
+
};
|
|
6329
|
+
} }
|
|
6330
|
+
};
|
|
6331
|
+
};
|
|
6332
|
+
|
|
6333
|
+
//#region src/vite.ts
|
|
6334
|
+
var vite_default = createVitePlugin(unpluginFactory);
|
|
6335
|
+
|
|
5476
6336
|
function cacheMarkdownRender(md, state, base, fileInfoFor) {
|
|
5477
6337
|
const cache = new LRUCache({
|
|
5478
6338
|
max: 2048,
|
|
@@ -5585,8 +6445,6 @@ function disposeMdItInstance() {
|
|
|
5585
6445
|
Valaxy.state.dispose();
|
|
5586
6446
|
}
|
|
5587
6447
|
async function createMarkdownPlugin(options, base, state = Valaxy.state) {
|
|
5588
|
-
await ensureGrayMatterRedirect();
|
|
5589
|
-
const { default: Markdown } = await import('unplugin-vue-markdown/vite');
|
|
5590
6448
|
const mdOptions = options?.config.markdown || {};
|
|
5591
6449
|
const theme = mdOptions.theme ?? defaultCodeTheme;
|
|
5592
6450
|
const transformIncludes = createTransformIncludes(options);
|
|
@@ -5595,17 +6453,32 @@ async function createMarkdownPlugin(options, base, state = Valaxy.state) {
|
|
|
5595
6453
|
state.onDispose(dispose);
|
|
5596
6454
|
const {
|
|
5597
6455
|
transforms: userTransforms,
|
|
6456
|
+
frontmatterPreprocess: userFrontmatterPreprocess,
|
|
5598
6457
|
markdownSetup: userMarkdownSetup,
|
|
5599
6458
|
markdownItSetup: userMarkdownItSetup,
|
|
5600
6459
|
...restMdOptions
|
|
5601
6460
|
} = mdOptions;
|
|
5602
6461
|
const setupUserMarkdown = userMarkdownSetup ?? userMarkdownItSetup;
|
|
5603
|
-
return
|
|
6462
|
+
return vite_default({
|
|
5604
6463
|
include: [/\.md$/],
|
|
5605
6464
|
wrapperClasses: "",
|
|
5606
6465
|
// headEnabled: false,
|
|
5607
6466
|
frontmatter: true,
|
|
5608
6467
|
exportFrontmatter: false,
|
|
6468
|
+
frontmatterPreprocess(frontmatter, markdownOptions, id, defaultHeadProcess) {
|
|
6469
|
+
const publicFrontmatter = { ...frontmatter };
|
|
6470
|
+
if (options.config.siteConfig.encrypt?.enable) {
|
|
6471
|
+
delete publicFrontmatter.password;
|
|
6472
|
+
if (publicFrontmatter.gallery_password) {
|
|
6473
|
+
delete publicFrontmatter.gallery_password;
|
|
6474
|
+
delete publicFrontmatter.photos;
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
return userFrontmatterPreprocess?.(publicFrontmatter, markdownOptions, id, defaultHeadProcess) ?? {
|
|
6478
|
+
head: defaultHeadProcess(publicFrontmatter, markdownOptions),
|
|
6479
|
+
frontmatter: publicFrontmatter
|
|
6480
|
+
};
|
|
6481
|
+
},
|
|
5609
6482
|
frontmatterOptions: {
|
|
5610
6483
|
// Disable excerpt rendering in @mdit-vue/plugin-frontmatter because it
|
|
5611
6484
|
// uses sync md.render() which throws with async highlight (markdown-exit:
|
|
@@ -5743,12 +6616,17 @@ async function localSearchPlugin(options, base) {
|
|
|
5743
6616
|
if (!fs.existsSync(file))
|
|
5744
6617
|
return { html: "", shared: false };
|
|
5745
6618
|
const relativePath = getPagePath(file, options.userRoot) || slash$1(path.relative(srcDir, file));
|
|
6619
|
+
if (isUnpublishedPage(relativePath, siteConfig.publishing))
|
|
6620
|
+
return { html: "", shared: false };
|
|
5746
6621
|
const env = { path: file, relativePath };
|
|
5747
6622
|
const mdRaw = await fs.promises.readFile(file, "utf-8");
|
|
5748
|
-
const { data
|
|
5749
|
-
const
|
|
6623
|
+
const { data, content } = matter(mdRaw, matterOptions);
|
|
6624
|
+
const fm = { ...siteConfig.frontmatter, ...data };
|
|
6625
|
+
if (fm.search === false || fm.draft && !siteConfig.publishing?.drafts || fm.hide || fm.password || fm.encrypt === true)
|
|
6626
|
+
return { html: "", shared: false };
|
|
6627
|
+
const mdSrc = stripEncryptedContent(processIncludes(srcDir, stripEncryptedContent(content), file));
|
|
5750
6628
|
const html = await md.renderAsync(mdSrc, env);
|
|
5751
|
-
return { html
|
|
6629
|
+
return { html, shared: fm.sharedLocale === true };
|
|
5752
6630
|
}
|
|
5753
6631
|
const indexByLocales = /* @__PURE__ */ new Map();
|
|
5754
6632
|
const fileToDocIds = /* @__PURE__ */ new Map();
|
|
@@ -5827,7 +6705,7 @@ async function localSearchPlugin(options, base) {
|
|
|
5827
6705
|
}
|
|
5828
6706
|
fileToDocIds.set(page, { locales, ids: docIds });
|
|
5829
6707
|
}
|
|
5830
|
-
function discardFile(page) {
|
|
6708
|
+
async function discardFile(page) {
|
|
5831
6709
|
const entry = fileToDocIds.get(page);
|
|
5832
6710
|
if (!entry)
|
|
5833
6711
|
return true;
|
|
@@ -5844,6 +6722,7 @@ async function localSearchPlugin(options, base) {
|
|
|
5844
6722
|
}
|
|
5845
6723
|
}
|
|
5846
6724
|
}
|
|
6725
|
+
await Promise.all(entry.locales.map((locale) => indexByLocales.get(locale)?.vacuum()));
|
|
5847
6726
|
fileToDocIds.delete(page);
|
|
5848
6727
|
return true;
|
|
5849
6728
|
}
|
|
@@ -5865,7 +6744,7 @@ async function localSearchPlugin(options, base) {
|
|
|
5865
6744
|
changedPages.clear();
|
|
5866
6745
|
pendingUpdate = pendingUpdate.catch((error) => server?.config.logger.error(String(error))).then(async () => {
|
|
5867
6746
|
for (const page of pages) {
|
|
5868
|
-
if (!discardFile(page)) {
|
|
6747
|
+
if (!await discardFile(page)) {
|
|
5869
6748
|
await scanForBuild();
|
|
5870
6749
|
break;
|
|
5871
6750
|
}
|
|
@@ -6168,6 +7047,85 @@ function transformHexoTags(code, id) {
|
|
|
6168
7047
|
return code;
|
|
6169
7048
|
}
|
|
6170
7049
|
|
|
7050
|
+
function getHeadMetaContent(head, name) {
|
|
7051
|
+
if (!head || !head.length)
|
|
7052
|
+
return void 0;
|
|
7053
|
+
const meta = head.find(([tag, attrs = {}]) => {
|
|
7054
|
+
return tag === "meta" && attrs.name === name && attrs.content;
|
|
7055
|
+
});
|
|
7056
|
+
return meta && meta[1].content;
|
|
7057
|
+
}
|
|
7058
|
+
function inferDescription(frontmatter) {
|
|
7059
|
+
const { description, head } = frontmatter;
|
|
7060
|
+
if (description !== void 0)
|
|
7061
|
+
return description;
|
|
7062
|
+
return head && getHeadMetaContent(head, "description") || "";
|
|
7063
|
+
}
|
|
7064
|
+
function extractFirstImage(code) {
|
|
7065
|
+
return extractMarkdownImage(code);
|
|
7066
|
+
}
|
|
7067
|
+
function filterPublicHeaders(headers, publicHeadingIds) {
|
|
7068
|
+
return headers.flatMap((header) => {
|
|
7069
|
+
const children = header.children ? filterPublicHeaders(header.children, publicHeadingIds) : [];
|
|
7070
|
+
if (!publicHeadingIds.has(header.slug))
|
|
7071
|
+
return children;
|
|
7072
|
+
return [{ ...header, ...header.children ? { children } : {} }];
|
|
7073
|
+
});
|
|
7074
|
+
}
|
|
7075
|
+
async function generatePageData(code, context, options) {
|
|
7076
|
+
const { id, fileInfo } = context;
|
|
7077
|
+
const relativePath = path$1.relative(options.userRoot, id);
|
|
7078
|
+
const fm = fileInfo?.frontmatter ? JSON.parse(JSON.stringify(fileInfo.frontmatter)) : {};
|
|
7079
|
+
if (options.config.features?.extractFirstImage !== false && !fm.password && fm.encrypt !== true && !pickPageShareImage(fm)) {
|
|
7080
|
+
const firstImage = extractFirstImage(code);
|
|
7081
|
+
if (firstImage)
|
|
7082
|
+
fm.firstImage = firstImage;
|
|
7083
|
+
}
|
|
7084
|
+
const isPrivate = !!fm.password || fm.encrypt === true;
|
|
7085
|
+
const publicCode = stripEncryptedContent(code);
|
|
7086
|
+
const hasPrivateContent = isPrivate || publicCode !== code;
|
|
7087
|
+
const publicHeadingIds = new Set(Array.from(publicCode.matchAll(/<h[1-6]\s[^>]*\bid=["']([^"']+)["'][^>]*>/g), (match) => match[1]));
|
|
7088
|
+
const publicHeaders = filterPublicHeaders(fileInfo?.headers || [], publicHeadingIds);
|
|
7089
|
+
const firstHeading = code.match(/<h1\b[^>]*>[\s\S]*?<\/h1>/)?.[0];
|
|
7090
|
+
const hasPublicTitle = !isPrivate && (!hasPrivateContent || firstHeading && publicCode.includes(firstHeading));
|
|
7091
|
+
const pageData = {
|
|
7092
|
+
title: fm.title || hasPublicTitle && fileInfo?.title || "",
|
|
7093
|
+
titleTemplate: fm.titleTemplate,
|
|
7094
|
+
description: inferDescription(fm),
|
|
7095
|
+
frontmatter: fm,
|
|
7096
|
+
// not be used
|
|
7097
|
+
headers: isPrivate ? [] : hasPrivateContent ? publicHeaders : fileInfo?.headers || [],
|
|
7098
|
+
relativePath,
|
|
7099
|
+
filePath: id
|
|
7100
|
+
};
|
|
7101
|
+
if (options.config.siteConfig.lastUpdated && fm.lastUpdated !== false)
|
|
7102
|
+
pageData.lastUpdated = await getGitTimestamp(id);
|
|
7103
|
+
return pageData;
|
|
7104
|
+
}
|
|
7105
|
+
function resolvePageImageImports(frontmatter, id) {
|
|
7106
|
+
const imports = [];
|
|
7107
|
+
const assignments = [];
|
|
7108
|
+
for (const key of ["ogImage", "image", "cover", "firstImage"]) {
|
|
7109
|
+
const src = pickShareImage([frontmatter[key]]);
|
|
7110
|
+
if (!src || src.startsWith("/") || /^[a-z][\w+.-]*:/i.test(src))
|
|
7111
|
+
continue;
|
|
7112
|
+
const [urlPath] = src.split(/[?#]/);
|
|
7113
|
+
const suffix = src.slice(urlPath.length);
|
|
7114
|
+
let filename = urlPath;
|
|
7115
|
+
try {
|
|
7116
|
+
filename = decodeURI(urlPath);
|
|
7117
|
+
} catch {
|
|
7118
|
+
}
|
|
7119
|
+
if (!existsSync(path$1.resolve(path$1.dirname(id), filename)))
|
|
7120
|
+
continue;
|
|
7121
|
+
const name = `__valaxy_${key}`;
|
|
7122
|
+
const request = `${filename.startsWith(".") ? filename : `./${filename}`}?url&no-inline`;
|
|
7123
|
+
imports.push(`import ${name} from ${JSON.stringify(request)}`);
|
|
7124
|
+
assignments.push(`pageData.value.frontmatter.${key} = ${name} + ${JSON.stringify(suffix)}`);
|
|
7125
|
+
}
|
|
7126
|
+
return { imports, assignments };
|
|
7127
|
+
}
|
|
7128
|
+
|
|
6171
7129
|
function genProvideCode(name, data) {
|
|
6172
7130
|
return [
|
|
6173
7131
|
`const $${name} = ${transformObject(data)}`,
|
|
@@ -6176,13 +7134,16 @@ function genProvideCode(name, data) {
|
|
|
6176
7134
|
];
|
|
6177
7135
|
}
|
|
6178
7136
|
const encryptedKeys = ["encryptedContent", "partiallyEncryptedContents", "encryptedPhotos"];
|
|
6179
|
-
function injectPageDataCode(pageData) {
|
|
7137
|
+
function injectPageDataCode(pageData, id) {
|
|
7138
|
+
const images = id ? resolvePageImageImports(pageData.frontmatter, id) : { imports: [], assignments: [] };
|
|
6180
7139
|
const staticPageData = transformObject(pageData);
|
|
6181
7140
|
const vueContextImports = [
|
|
6182
7141
|
`import { provide, shallowRef } from 'vue'`,
|
|
6183
7142
|
`import { useRoute, useRouter } from 'vue-router'`,
|
|
7143
|
+
...images.imports,
|
|
6184
7144
|
// Use static page data instead of data loader
|
|
6185
7145
|
`const pageData = shallowRef(${staticPageData})`,
|
|
7146
|
+
...images.assignments,
|
|
6186
7147
|
"const router = useRouter()",
|
|
6187
7148
|
"const route = useRoute()",
|
|
6188
7149
|
// $frontmatter contain runtime added data, will be deleted (for example, $frontmatter.partiallyEncryptedContents)
|
|
@@ -6205,7 +7166,7 @@ function createTransformMarkdown(options) {
|
|
|
6205
7166
|
if (!isDev) {
|
|
6206
7167
|
delete pageData.filePath;
|
|
6207
7168
|
}
|
|
6208
|
-
const dataCode = injectPageDataCode(pageData);
|
|
7169
|
+
const dataCode = injectPageDataCode(pageData, id);
|
|
6209
7170
|
const imports = [
|
|
6210
7171
|
...dataCode,
|
|
6211
7172
|
isDev ? `globalThis.$pageData = pageData` : "",
|
|
@@ -6234,53 +7195,6 @@ ${code.slice(injectB)}`;
|
|
|
6234
7195
|
};
|
|
6235
7196
|
}
|
|
6236
7197
|
|
|
6237
|
-
function getHeadMetaContent(head, name) {
|
|
6238
|
-
if (!head || !head.length)
|
|
6239
|
-
return void 0;
|
|
6240
|
-
const meta = head.find(([tag, attrs = {}]) => {
|
|
6241
|
-
return tag === "meta" && attrs.name === name && attrs.content;
|
|
6242
|
-
});
|
|
6243
|
-
return meta && meta[1].content;
|
|
6244
|
-
}
|
|
6245
|
-
function inferDescription(frontmatter) {
|
|
6246
|
-
const { description, head } = frontmatter;
|
|
6247
|
-
if (description !== void 0)
|
|
6248
|
-
return description;
|
|
6249
|
-
return head && getHeadMetaContent(head, "description") || "";
|
|
6250
|
-
}
|
|
6251
|
-
function extractFirstImage(code) {
|
|
6252
|
-
const mdImageMatch = code.match(/!\[.*?\]\((.+?)\)/);
|
|
6253
|
-
if (mdImageMatch)
|
|
6254
|
-
return mdImageMatch[1];
|
|
6255
|
-
const htmlImageMatch = code.match(/<img\s[^>]*?src=["'](.+?)["']/);
|
|
6256
|
-
if (htmlImageMatch)
|
|
6257
|
-
return htmlImageMatch[1];
|
|
6258
|
-
return void 0;
|
|
6259
|
-
}
|
|
6260
|
-
async function generatePageData(code, context, options) {
|
|
6261
|
-
const { id, fileInfo } = context;
|
|
6262
|
-
const relativePath = path$1.relative(options.userRoot, id);
|
|
6263
|
-
const fm = fileInfo?.frontmatter ? JSON.parse(JSON.stringify(fileInfo.frontmatter)) : {};
|
|
6264
|
-
if (options.config.features?.extractFirstImage !== false && !fm.ogImage && !fm.cover) {
|
|
6265
|
-
const firstImage = extractFirstImage(code);
|
|
6266
|
-
if (firstImage)
|
|
6267
|
-
fm.firstImage = firstImage;
|
|
6268
|
-
}
|
|
6269
|
-
const pageData = {
|
|
6270
|
-
title: fm.title || fileInfo?.title || "",
|
|
6271
|
-
titleTemplate: fm.titleTemplate,
|
|
6272
|
-
description: inferDescription(fm),
|
|
6273
|
-
frontmatter: fm,
|
|
6274
|
-
// not be used
|
|
6275
|
-
headers: fileInfo?.headers || [],
|
|
6276
|
-
relativePath,
|
|
6277
|
-
filePath: id
|
|
6278
|
-
};
|
|
6279
|
-
if (options.config.siteConfig.lastUpdated && fm.lastUpdated !== false)
|
|
6280
|
-
pageData.lastUpdated = await getGitTimestamp(id);
|
|
6281
|
-
return pageData;
|
|
6282
|
-
}
|
|
6283
|
-
|
|
6284
7198
|
const debug = _debug("valaxy:md");
|
|
6285
7199
|
const caches = /* @__PURE__ */ new WeakMap();
|
|
6286
7200
|
function getMarkdownCache(state) {
|
|
@@ -6360,6 +7274,7 @@ async function createMarkdownToVueRenderFn(options, state = Valaxy.state) {
|
|
|
6360
7274
|
const includes = data.includes;
|
|
6361
7275
|
code = data.code;
|
|
6362
7276
|
code = transformCodeBlock(code, context);
|
|
7277
|
+
const hasPrivateSource = !!(pageData.frontmatter.password || pageData.frontmatter.encrypt || pageData.frontmatter.gallery_password || code.includes("valaxy-encrypt-start:"));
|
|
6363
7278
|
code = await transformEncrypt(code, id, pageData);
|
|
6364
7279
|
code = transformFootnoteTooltip(code);
|
|
6365
7280
|
code = transformMarkdown(code, id, pageData);
|
|
@@ -6368,7 +7283,8 @@ async function createMarkdownToVueRenderFn(options, state = Valaxy.state) {
|
|
|
6368
7283
|
code,
|
|
6369
7284
|
pageData,
|
|
6370
7285
|
deadLinks,
|
|
6371
|
-
includes
|
|
7286
|
+
includes,
|
|
7287
|
+
hasPrivateSource
|
|
6372
7288
|
};
|
|
6373
7289
|
if (isBuild)
|
|
6374
7290
|
cache.set(cacheKey, result);
|
|
@@ -6399,7 +7315,7 @@ function createClientSetupPlugin(options) {
|
|
|
6399
7315
|
const name = id.slice(setupEntry.length + 1).replace(/\?.*$/, "");
|
|
6400
7316
|
const imports = [];
|
|
6401
7317
|
const injections = [];
|
|
6402
|
-
const setups = uniq([
|
|
7318
|
+
const setups = uniq$1([
|
|
6403
7319
|
themeRoot,
|
|
6404
7320
|
userRoot
|
|
6405
7321
|
]).map((i) => join(i, "setup", name));
|
|
@@ -6722,6 +7638,8 @@ async function createValaxyPlugin(options, serverOptions = {}, state = Valaxy.st
|
|
|
6722
7638
|
let { config: valaxyConfig } = options;
|
|
6723
7639
|
const valaxyPrefix = "/@valaxy";
|
|
6724
7640
|
let hasDeadLinks = false;
|
|
7641
|
+
const protectedMarkdown = /* @__PURE__ */ new Set();
|
|
7642
|
+
const protectedSourceAliases = /* @__PURE__ */ new Set();
|
|
6725
7643
|
let markdownToVue;
|
|
6726
7644
|
return [
|
|
6727
7645
|
{
|
|
@@ -6777,7 +7695,7 @@ async function createValaxyPlugin(options, serverOptions = {}, state = Valaxy.st
|
|
|
6777
7695
|
},
|
|
6778
7696
|
async transform(code, id) {
|
|
6779
7697
|
if (id.endsWith(".md")) {
|
|
6780
|
-
const { code: newCode, deadLinks, includes } = await markdownToVue(code, id);
|
|
7698
|
+
const { code: newCode, deadLinks, includes, hasPrivateSource } = await markdownToVue(code, id);
|
|
6781
7699
|
if (deadLinks.length) {
|
|
6782
7700
|
hasDeadLinks = true;
|
|
6783
7701
|
consola.error(`Dead links found in ${id}`);
|
|
@@ -6788,6 +7706,10 @@ async function createValaxyPlugin(options, serverOptions = {}, state = Valaxy.st
|
|
|
6788
7706
|
this.addWatchFile(i);
|
|
6789
7707
|
});
|
|
6790
7708
|
}
|
|
7709
|
+
if (hasPrivateSource) {
|
|
7710
|
+
protectedMarkdown.add(resolve$1(id));
|
|
7711
|
+
includes.forEach((file) => protectedMarkdown.add(resolve$1(file)));
|
|
7712
|
+
}
|
|
6791
7713
|
return newCode;
|
|
6792
7714
|
}
|
|
6793
7715
|
},
|
|
@@ -6813,7 +7735,7 @@ async function createValaxyPlugin(options, serverOptions = {}, state = Valaxy.st
|
|
|
6813
7735
|
};
|
|
6814
7736
|
const configFiles = [options.configFile, options.siteConfigFile, resolve$1(options.themeRoot, "valaxy.config.ts")];
|
|
6815
7737
|
if (configFiles.includes(file)) {
|
|
6816
|
-
const { config } = await resolveOptions$
|
|
7738
|
+
const { config } = await resolveOptions$2({ userRoot: options.userRoot });
|
|
6817
7739
|
return reloadConfigAndEntries(config);
|
|
6818
7740
|
}
|
|
6819
7741
|
if (file === options.themeConfigFile) {
|
|
@@ -6842,6 +7764,54 @@ async function createValaxyPlugin(options, serverOptions = {}, state = Valaxy.st
|
|
|
6842
7764
|
}
|
|
6843
7765
|
}
|
|
6844
7766
|
},
|
|
7767
|
+
{
|
|
7768
|
+
name: "valaxy:private-sourcemaps",
|
|
7769
|
+
enforce: "post",
|
|
7770
|
+
outputOptions(output) {
|
|
7771
|
+
const transformPath = output.sourcemapPathTransform;
|
|
7772
|
+
if (!transformPath)
|
|
7773
|
+
return;
|
|
7774
|
+
return {
|
|
7775
|
+
...output,
|
|
7776
|
+
sourcemapPathTransform(source, sourcemapPath) {
|
|
7777
|
+
const transformed = transformPath(source, sourcemapPath);
|
|
7778
|
+
if (protectedMarkdown.has(resolve$1(dirname$1(sourcemapPath), source.split("?")[0])))
|
|
7779
|
+
protectedSourceAliases.add(transformed.replaceAll("\\", "/"));
|
|
7780
|
+
return transformed;
|
|
7781
|
+
}
|
|
7782
|
+
};
|
|
7783
|
+
},
|
|
7784
|
+
generateBundle: {
|
|
7785
|
+
order: "post",
|
|
7786
|
+
handler(outputOptions, bundle) {
|
|
7787
|
+
if (!protectedMarkdown.size)
|
|
7788
|
+
return;
|
|
7789
|
+
const outputDir = outputOptions.dir || dirname$1(outputOptions.file || ".");
|
|
7790
|
+
const sanitize = (map, fileName) => {
|
|
7791
|
+
map.sourcesContent?.forEach((_content, index, contents) => {
|
|
7792
|
+
const source = map.sources?.[index];
|
|
7793
|
+
if (source && (protectedSourceAliases.has(source.replaceAll("\\", "/")) || protectedMarkdown.has(resolve$1(outputDir, dirname$1(fileName), map.sourceRoot || "", source.split("?")[0]))))
|
|
7794
|
+
contents[index] = null;
|
|
7795
|
+
});
|
|
7796
|
+
};
|
|
7797
|
+
for (const output of Object.values(bundle)) {
|
|
7798
|
+
if (output.type === "asset" && output.fileName.endsWith(".map")) {
|
|
7799
|
+
const map = JSON.parse(typeof output.source === "string" ? output.source : Buffer$1.from(output.source).toString());
|
|
7800
|
+
sanitize(map, output.fileName);
|
|
7801
|
+
output.source = JSON.stringify(map);
|
|
7802
|
+
} else if (output.type === "chunk") {
|
|
7803
|
+
if (output.map)
|
|
7804
|
+
sanitize(output.map, output.fileName);
|
|
7805
|
+
output.code = output.code.replace(/(\/\/[#@] sourceMappingURL=data:application\/json[^,]*;base64,)(\S+)/g, (_match, prefix, encoded) => {
|
|
7806
|
+
const map = JSON.parse(Buffer$1.from(encoded, "base64").toString());
|
|
7807
|
+
sanitize(map, output.fileName);
|
|
7808
|
+
return prefix + Buffer$1.from(JSON.stringify(map)).toString("base64");
|
|
7809
|
+
});
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7814
|
+
},
|
|
6845
7815
|
{
|
|
6846
7816
|
name: "valaxy:state-cleanup",
|
|
6847
7817
|
enforce: "post",
|
|
@@ -6921,18 +7891,31 @@ async function createRouterOptions(valaxyApp, base, parseMatter = (source) => ma
|
|
|
6921
7891
|
// vue-router defaults to `watch: !process.env.CI`, which is true locally.
|
|
6922
7892
|
watch: options.mode !== "build",
|
|
6923
7893
|
...valaxyConfig.router,
|
|
7894
|
+
// Defaults stay in front of a user exclude list. `publishing` turns a class back on.
|
|
7895
|
+
exclude: mergePageExcludes(valaxyConfig.siteConfig.publishing, valaxyConfig.router?.exclude),
|
|
6924
7896
|
/**
|
|
6925
7897
|
* @experimental See https://github.com/posva/unplugin-vue-router/issues/43 (now part of vue-router)
|
|
6926
7898
|
* we need get frontmatter before route, so write it in extendRoute
|
|
6927
7899
|
*/
|
|
6928
7900
|
async extendRoute(route) {
|
|
7901
|
+
const publishing = valaxyConfig.siteConfig.publishing;
|
|
7902
|
+
const component = route.components?.get?.("default") || "";
|
|
7903
|
+
const relative = component ? relativePagePath(component, options.userRoot) || relativePagePath(component) : void 0;
|
|
7904
|
+
const privateSegment = route.fullPath.split("/").some((segment) => segment.startsWith("_"));
|
|
7905
|
+
const readmeMarkdown = isReadmePage(component);
|
|
7906
|
+
if (relative && isUnpublishedPage(relative, publishing) || !publishing?.underscore && privateSegment || !publishing?.readme && readmeMarkdown) {
|
|
7907
|
+
route.delete?.();
|
|
7908
|
+
return;
|
|
7909
|
+
}
|
|
6929
7910
|
if (valaxyConfig.siteConfig.frontmatter !== _lastFrontmatterRef) {
|
|
6930
7911
|
_lastFrontmatterRef = valaxyConfig.siteConfig.frontmatter;
|
|
6931
7912
|
_cachedFrontmatter = structuredClone(valaxyConfig.siteConfig.frontmatter);
|
|
6932
7913
|
}
|
|
6933
7914
|
const defaultFrontmatter = structuredClone(_cachedFrontmatter);
|
|
7915
|
+
const defaultPassword = defaultFrontmatter.password;
|
|
7916
|
+
delete defaultFrontmatter.password;
|
|
6934
7917
|
if (route.meta && route.meta.frontmatter) {
|
|
6935
|
-
const { frontmatter: _, ...otherMeta } = route.meta;
|
|
7918
|
+
const { frontmatter: _, seoDescription: _seoDescription, ...otherMeta } = route.meta;
|
|
6936
7919
|
route.meta = otherMeta;
|
|
6937
7920
|
}
|
|
6938
7921
|
route.addToMeta({
|
|
@@ -6970,6 +7953,9 @@ async function createRouterOptions(valaxyApp, base, parseMatter = (source) => ma
|
|
|
6970
7953
|
const { data, excerpt, content } = parseMatter(md);
|
|
6971
7954
|
const mdFm = data;
|
|
6972
7955
|
const lastUpdated = valaxyConfig.siteConfig.lastUpdated;
|
|
7956
|
+
const encrypted = Boolean(mdFm.password === void 0 ? defaultPassword : mdFm.password) || (mdFm.encrypt ?? defaultFrontmatter.encrypt) === true;
|
|
7957
|
+
const publicContent = encrypted ? "" : stripEncryptedContent(content);
|
|
7958
|
+
const publicExcerpt = publicContent.includes(EXCERPT_SEPARATOR) ? publicContent.split(EXCERPT_SEPARATOR)[0] : "";
|
|
6973
7959
|
delete mdFm.password;
|
|
6974
7960
|
if (mdFm.gallery_password) {
|
|
6975
7961
|
delete mdFm.gallery_password;
|
|
@@ -7017,16 +8003,22 @@ async function createRouterOptions(valaxyApp, base, parseMatter = (source) => ma
|
|
|
7017
8003
|
excludeKeys.forEach((key) => {
|
|
7018
8004
|
delete routerFM[key];
|
|
7019
8005
|
});
|
|
7020
|
-
|
|
8006
|
+
const manualExcerpt = typeof mdFm.excerpt === "string" ? stripEncryptedContent(mdFm.excerpt) : mdFm.excerpt;
|
|
8007
|
+
let resolvedExcerpt = manualExcerpt || (publicExcerpt ? await getExcerptByType(publicExcerpt, mdFm.excerpt_type || defaultFrontmatter.excerpt_type || valaxyConfig.siteConfig.excerpt.type, mdIt) : "");
|
|
8008
|
+
const explicitDescription = mdFm.description;
|
|
8009
|
+
const hasExplicitDescription = typeof explicitDescription === "string" ? explicitDescription.trim().length > 0 : explicitDescription != null && typeof explicitDescription === "object";
|
|
8010
|
+
const seoSource = encrypted ? "" : typeof mdFm.excerpt === "string" && mdFm.excerpt.trim() ? mdFm.excerpt : publicExcerpt || publicContent;
|
|
8011
|
+
const seoDescription = hasExplicitDescription ? "" : plainSeoDescription(seoSource, valaxyConfig.siteConfig.excerpt?.length || 200);
|
|
7021
8012
|
if (!resolvedExcerpt && valaxyConfig.siteConfig.excerpt.auto) {
|
|
7022
8013
|
const autoExcerptLength = valaxyConfig.siteConfig.excerpt.length;
|
|
7023
8014
|
const excerptType = mdFm.excerpt_type || defaultFrontmatter.excerpt_type || valaxyConfig.siteConfig.excerpt.type;
|
|
7024
|
-
const autoExcerptMd = generateAutoExcerptMd(
|
|
8015
|
+
const autoExcerptMd = generateAutoExcerptMd(publicContent, autoExcerptLength);
|
|
7025
8016
|
resolvedExcerpt = await getExcerptByType(autoExcerptMd, excerptType, mdIt);
|
|
7026
8017
|
}
|
|
7027
8018
|
route.addToMeta({
|
|
7028
8019
|
frontmatter: routerFM,
|
|
7029
|
-
excerpt: resolvedExcerpt
|
|
8020
|
+
excerpt: resolvedExcerpt,
|
|
8021
|
+
...seoDescription ? { seoDescription } : {}
|
|
7030
8022
|
});
|
|
7031
8023
|
if (data.layout) {
|
|
7032
8024
|
route.addToMeta({
|
|
@@ -7066,6 +8058,23 @@ async function createRouterOptions(valaxyApp, base, parseMatter = (source) => ma
|
|
|
7066
8058
|
async beforeWriteFiles(root) {
|
|
7067
8059
|
await valaxyApp.hooks.callHook("vue-router:beforeWriteFiles", root);
|
|
7068
8060
|
await valaxyConfig.router?.beforeWriteFiles?.(root);
|
|
8061
|
+
if (options.mode === "build" && !valaxyConfig.siteConfig.publishing?.drafts) {
|
|
8062
|
+
const prune = (parent) => {
|
|
8063
|
+
for (const route of parent.children) {
|
|
8064
|
+
prune(route);
|
|
8065
|
+
if (!route.meta.frontmatter?.draft)
|
|
8066
|
+
continue;
|
|
8067
|
+
if (route.children.length) {
|
|
8068
|
+
route.components.clear();
|
|
8069
|
+
route.meta = {};
|
|
8070
|
+
route.name = false;
|
|
8071
|
+
} else {
|
|
8072
|
+
route.delete();
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8075
|
+
};
|
|
8076
|
+
prune(root);
|
|
8077
|
+
}
|
|
7069
8078
|
}
|
|
7070
8079
|
};
|
|
7071
8080
|
}
|
|
@@ -7397,6 +8406,8 @@ function renderPreloadLinks(modules, manifest) {
|
|
|
7397
8406
|
} else if (file.endsWith(".css")) {
|
|
7398
8407
|
links.push(`<link rel="stylesheet" href="${file}">`);
|
|
7399
8408
|
} else if (file.endsWith(".woff") || file.endsWith(".woff2")) {
|
|
8409
|
+
if (/(?:^|\/)KaTeX_[^/]+$/.test(file))
|
|
8410
|
+
continue;
|
|
7400
8411
|
links.push(`<link rel="preload" href="${file}" as="font" type="font/${file.endsWith(".woff2") ? "woff2" : "woff"}" crossorigin>`);
|
|
7401
8412
|
} else if (file.endsWith(".gif") || file.endsWith(".jpg") || file.endsWith(".jpeg") || file.endsWith(".png") || file.endsWith(".webp") || file.endsWith(".svg") || file.endsWith(".avif")) {
|
|
7402
8413
|
links.push(`<link rel="preload" href="${file}" as="image">`);
|
|
@@ -7427,6 +8438,36 @@ function routeToFileName(route) {
|
|
|
7427
8438
|
return route.slice(1);
|
|
7428
8439
|
return `${route}.html`.slice(1);
|
|
7429
8440
|
}
|
|
8441
|
+
function trailingSlashAlias(route) {
|
|
8442
|
+
if (!route || route === "/" || route.endsWith("/"))
|
|
8443
|
+
return;
|
|
8444
|
+
const file = routeToFileName(route);
|
|
8445
|
+
if (!file.endsWith(".html") || file.endsWith("/index.html"))
|
|
8446
|
+
return;
|
|
8447
|
+
return `${file.slice(0, -".html".length)}/index.html`;
|
|
8448
|
+
}
|
|
8449
|
+
async function fileExists(file) {
|
|
8450
|
+
try {
|
|
8451
|
+
await access(file, constants.F_OK);
|
|
8452
|
+
return true;
|
|
8453
|
+
} catch {
|
|
8454
|
+
return false;
|
|
8455
|
+
}
|
|
8456
|
+
}
|
|
8457
|
+
async function writeTrailingSlashAliases(outDir, routes) {
|
|
8458
|
+
const outputs = new Set(routes.map(routeToFileName));
|
|
8459
|
+
await Promise.all(routes.map(async (route) => {
|
|
8460
|
+
const alias = trailingSlashAlias(route);
|
|
8461
|
+
if (!alias || outputs.has(alias))
|
|
8462
|
+
return;
|
|
8463
|
+
const from = resolve(outDir, routeToFileName(route));
|
|
8464
|
+
const to = resolve(outDir, alias);
|
|
8465
|
+
if (!await fileExists(from) || await fileExists(to))
|
|
8466
|
+
return;
|
|
8467
|
+
await mkdir(dirname(to), { recursive: true });
|
|
8468
|
+
await copyFile(from, to);
|
|
8469
|
+
}));
|
|
8470
|
+
}
|
|
7430
8471
|
|
|
7431
8472
|
function tryGC() {
|
|
7432
8473
|
if (typeof globalThis.gc === "function")
|
|
@@ -7462,6 +8503,7 @@ async function ssgBuild(valaxyApp, viteConfig = {}, userSsgOptions = {}) {
|
|
|
7462
8503
|
const configOutDir = viteConfig.build?.outDir || "dist";
|
|
7463
8504
|
const outDir = isAbsolute$1(configOutDir) ? configOutDir : resolve(options.userRoot, configOutDir);
|
|
7464
8505
|
const ssgTemp = resolve(outDir, ".vite-ssg-temp");
|
|
8506
|
+
let routePaths = [];
|
|
7465
8507
|
const defaultConfig = {
|
|
7466
8508
|
...defaultViteConfig,
|
|
7467
8509
|
plugins: await profileBuildPhase("plugins", () => ViteValaxyPlugins(valaxyApp, {}, viteConfig, 2)),
|
|
@@ -7504,7 +8546,6 @@ async function ssgBuild(valaxyApp, viteConfig = {}, userSsgOptions = {}) {
|
|
|
7504
8546
|
tryGC();
|
|
7505
8547
|
const entryPath = resolve(ssgTemp, "entry-ssr.mjs");
|
|
7506
8548
|
const { render, routes } = await profileBuildPhase("server-load", () => import(pathToFileURL(entryPath).href));
|
|
7507
|
-
let routePaths;
|
|
7508
8549
|
if (userSsgOptions.includedRoutes) {
|
|
7509
8550
|
routePaths = await userSsgOptions.includedRoutes(routesToPaths(routes), routes);
|
|
7510
8551
|
} else if (userSsgOptions.includeAllRoutes) {
|
|
@@ -7546,8 +8587,11 @@ async function ssgBuild(valaxyApp, viteConfig = {}, userSsgOptions = {}) {
|
|
|
7546
8587
|
});
|
|
7547
8588
|
}
|
|
7548
8589
|
generateSitemap({
|
|
7549
|
-
hostname: options.config.siteConfig.url
|
|
8590
|
+
hostname: options.config.siteConfig.url,
|
|
8591
|
+
outDir,
|
|
8592
|
+
exclude: notFoundSitemapPaths(routePaths)
|
|
7550
8593
|
});
|
|
8594
|
+
await writeTrailingSlashAliases(outDir, routePaths);
|
|
7551
8595
|
if (userSsgOptions.onFinished)
|
|
7552
8596
|
await userSsgOptions.onFinished();
|
|
7553
8597
|
}
|
|
@@ -8052,7 +9096,7 @@ async function execBuild({ ssg, root, output, log, siteUrl }) {
|
|
|
8052
9096
|
if (!await isPagesDirExist(root))
|
|
8053
9097
|
throw new Error(`Pages directory not found: ${root}`);
|
|
8054
9098
|
const userRoot = path.resolve(root);
|
|
8055
|
-
const options = await profileBuildPhase("resolve-options", () => resolveOptions$
|
|
9099
|
+
const options = await profileBuildPhase("resolve-options", () => resolveOptions$2({ userRoot }, "build"));
|
|
8056
9100
|
if (siteUrl)
|
|
8057
9101
|
options.config.siteConfig.url = siteUrl;
|
|
8058
9102
|
setTimezone(options.config.siteConfig.timezone);
|
|
@@ -8216,8 +9260,12 @@ function createContentService(app, settings = {}) {
|
|
|
8216
9260
|
let release;
|
|
8217
9261
|
let disposed = false;
|
|
8218
9262
|
const parser = createMarkdownEngine();
|
|
8219
|
-
function
|
|
8220
|
-
|
|
9263
|
+
function unpublished(pagePath) {
|
|
9264
|
+
return isUnpublishedPage(pagePath.replace(/^pages\//, ""), config.siteConfig.publishing);
|
|
9265
|
+
}
|
|
9266
|
+
function visible(pagePath, data) {
|
|
9267
|
+
const keptPrivate = unpublished(pagePath) || Boolean(data.draft);
|
|
9268
|
+
if (settings.publicOnly && (data.password || data.encrypt || data.gallery_password || data.hide || keptPrivate && !settings.includeDrafts))
|
|
8221
9269
|
throw new Error("Page unavailable under the MCP visibility policy.");
|
|
8222
9270
|
}
|
|
8223
9271
|
async function read(path) {
|
|
@@ -8244,7 +9292,7 @@ function createContentService(app, settings = {}) {
|
|
|
8244
9292
|
const options = await routerOptions;
|
|
8245
9293
|
const routes = [];
|
|
8246
9294
|
routerApp.options.redirects.length = 0;
|
|
8247
|
-
const context = createRoutesContext(resolveOptions$
|
|
9295
|
+
const context = createRoutesContext(resolveOptions$3({
|
|
8248
9296
|
...options,
|
|
8249
9297
|
root: userRoot,
|
|
8250
9298
|
dts: false,
|
|
@@ -8272,7 +9320,7 @@ function createContentService(app, settings = {}) {
|
|
|
8272
9320
|
function project(path, file, routes, data) {
|
|
8273
9321
|
const matches = routes.filter((route) => route.files.includes(file));
|
|
8274
9322
|
for (const route of matches)
|
|
8275
|
-
visible(route.frontmatter);
|
|
9323
|
+
visible(path, route.frontmatter);
|
|
8276
9324
|
const resolved = matches[0]?.frontmatter || data;
|
|
8277
9325
|
const draft = Boolean(resolved.draft);
|
|
8278
9326
|
const base = settings.base ?? config.vite?.base ?? "/";
|
|
@@ -8304,7 +9352,7 @@ function createContentService(app, settings = {}) {
|
|
|
8304
9352
|
const { raw, file } = await read(path);
|
|
8305
9353
|
const { data } = parseMatter(raw);
|
|
8306
9354
|
const merged = { ...config.siteConfig.frontmatter, ...data };
|
|
8307
|
-
visible(merged);
|
|
9355
|
+
visible(path, merged);
|
|
8308
9356
|
const routes = await scanRoutes();
|
|
8309
9357
|
return project(path, file, routes, merged);
|
|
8310
9358
|
});
|
|
@@ -8323,7 +9371,7 @@ function createContentService(app, settings = {}) {
|
|
|
8323
9371
|
return result();
|
|
8324
9372
|
}
|
|
8325
9373
|
const { data, content } = parsed;
|
|
8326
|
-
visible({ ...config.siteConfig.frontmatter, ...data });
|
|
9374
|
+
visible(path, { ...config.siteConfig.frontmatter, ...data });
|
|
8327
9375
|
const fieldLine = (key) => raw.split("\n").findIndex((line) => line.startsWith(`${key}:`)) + 1 || 1;
|
|
8328
9376
|
for (const key of ["title", "description", "layout"]) {
|
|
8329
9377
|
if (data[key] !== void 0 && typeof data[key] !== "string" && !(key === "layout" && data[key] === false))
|
|
@@ -8352,7 +9400,7 @@ function createContentService(app, settings = {}) {
|
|
|
8352
9400
|
return result();
|
|
8353
9401
|
}
|
|
8354
9402
|
const page = project(path, file, routes, data);
|
|
8355
|
-
if (!page.routes.length)
|
|
9403
|
+
if (!page.routes.length && !unpublished(path))
|
|
8356
9404
|
add("route-missing", "error", "This file does not appear in the resolved route tree.", "Check router exclusions, page overrides and route hooks.");
|
|
8357
9405
|
const routePaths = /* @__PURE__ */ new Map();
|
|
8358
9406
|
for (const route of routes) {
|
|
@@ -8469,7 +9517,7 @@ function registerContentCommands(cli) {
|
|
|
8469
9517
|
setEnv();
|
|
8470
9518
|
if (json)
|
|
8471
9519
|
setLogLevel(-999);
|
|
8472
|
-
const options = await resolveOptions$
|
|
9520
|
+
const options = await resolveOptions$2({ userRoot: resolve$1(root) });
|
|
8473
9521
|
setTimezone(options.config.siteConfig.timezone);
|
|
8474
9522
|
const app = createValaxyNode(options);
|
|
8475
9523
|
if (options.config.loaders?.length) {
|
|
@@ -8527,7 +9575,7 @@ async function collectDebugInfo() {
|
|
|
8527
9575
|
valaxy: version
|
|
8528
9576
|
};
|
|
8529
9577
|
try {
|
|
8530
|
-
const options = await resolveOptions$
|
|
9578
|
+
const options = await resolveOptions$2({ userRoot: process.cwd() });
|
|
8531
9579
|
info.userRoot = options.userRoot;
|
|
8532
9580
|
info.theme = options.theme;
|
|
8533
9581
|
info.themeVersion = options.config.themeConfig?.pkg?.version;
|
|
@@ -8640,7 +9688,7 @@ function registerDeployCommand(cli) {
|
|
|
8640
9688
|
if (shouldBuild) {
|
|
8641
9689
|
await execBuild({ ssg: true, root, output, log: "info" });
|
|
8642
9690
|
}
|
|
8643
|
-
const options = await resolveOptions$
|
|
9691
|
+
const options = await resolveOptions$2({ userRoot: root }, "build");
|
|
8644
9692
|
const configDeployType = type ?? options.config.deploy?.type;
|
|
8645
9693
|
const deployType = configDeployType ?? await select({
|
|
8646
9694
|
message: "Where do you want to deploy?",
|
|
@@ -8801,7 +9849,7 @@ async function startValaxyDev({
|
|
|
8801
9849
|
process.exit(0);
|
|
8802
9850
|
port = port || await findFreePort(4859);
|
|
8803
9851
|
const resolveTimer = countPerformanceTime();
|
|
8804
|
-
const resolvedOptions = await resolveOptions$
|
|
9852
|
+
const resolvedOptions = await resolveOptions$2({ userRoot: root });
|
|
8805
9853
|
vLogger.debug(`resolveOptions: ${resolveTimer()}`);
|
|
8806
9854
|
setTimezone(resolvedOptions.config.siteConfig.timezone);
|
|
8807
9855
|
const createNodeTimer = countPerformanceTime();
|
|
@@ -8920,7 +9968,7 @@ date: <%=date%>
|
|
|
8920
9968
|
`;
|
|
8921
9969
|
|
|
8922
9970
|
async function getTemplate(layout) {
|
|
8923
|
-
const { clientRoot, themeRoot } = await resolveOptions$
|
|
9971
|
+
const { clientRoot, themeRoot } = await resolveOptions$2({ userRoot });
|
|
8924
9972
|
const roots = [userRoot, themeRoot, clientRoot];
|
|
8925
9973
|
for (const root of roots) {
|
|
8926
9974
|
const scaffoldPath = path.resolve(root, "scaffolds", `${layout}.md`);
|
|
@@ -9040,4 +10088,4 @@ async function run(argv = hideBin(process.argv), options = {}) {
|
|
|
9040
10088
|
await cli.parseAsync();
|
|
9041
10089
|
}
|
|
9042
10090
|
|
|
9043
|
-
export {
|
|
10091
|
+
export { resolveValaxyConfig as $, ALL_ROUTE as A, isInstalledGlobally as B, isKatexEnabled as C, isKatexPluginNeeded as D, EXCERPT_SEPARATOR as E, isMathJaxEnabled as F, GLOBAL_STATE as G, isPath as H, loadAllContent as I, loadConfigFromFile as J, mergeValaxyConfig as K, mergeViteConfigs as L, postProcessForSSG as M, processValaxyOptions as N, registerDevCommand as O, PATHNAME_PROTOCOL_RE as P, resolveAddonsConfig as Q, resolveImportPath as R, StateManager as S, resolveImportUrl as T, resolveOptions$2 as U, ViteValaxyPlugins as V, resolveSiteConfig as W, resolveSiteConfigFromRoot as X, resolveThemeConfigFromRoot as Y, resolveThemeValaxyConfig as Z, resolveUserThemeConfig as _, createContentService as a, resolveValaxyConfigFromRoot as a0, run as a1, ssgBuild as a2, startValaxyDev as a3, toAtFS as a4, transformObject as a5, version as a6, build as b, createCli as c, createMemoryReleasePlugin as d, createServer as e, createValaxyNode as f, createValaxyPlugin as g, customElements as h, defaultSiteConfig as i, defaultValaxyConfig as j, defaultViteConfig as k, defineAddon as l, defineConfig as m, defineSiteConfig as n, defineTheme as o, defineValaxyAddon as p, defineValaxyConfig as q, defineValaxyTheme as r, desktopRuntimeVersion as s, encryptContent as t, execBuild as u, generateClientRedirects as v, getGitTimestamp as w, getIndexHtml as x, getServerInfoText as y, isExternal as z };
|