valaxy 0.26.9 → 0.26.12

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.
@@ -1,7 +1,7 @@
1
1
  import 'node:process';
2
2
  import 'yargs';
3
3
  import 'yargs/helpers';
4
- export { c as cli, d as registerDevCommand, r as run, a as startValaxyDev } from '../../shared/valaxy.B5JLGXpW.mjs';
4
+ export { c as cli, d as registerDevCommand, r as run, a as startValaxyDev } from '../../shared/valaxy.DsB_W1aR.mjs';
5
5
  import 'node:os';
6
6
  import 'node:path';
7
7
  import 'consola';
@@ -13,7 +13,7 @@ import { EditableTreeNode } from 'unplugin-vue-router';
13
13
  import Router from 'unplugin-vue-router/vite';
14
14
  import Layouts from 'vite-plugin-vue-layouts';
15
15
  import { Options as Options$1 } from 'vitepress-plugin-group-icons';
16
- import { D as DefaultTheme, R as RuntimeConfig, a as RedirectItem, V as ValaxyConfig, P as PartialDeep, b as ValaxyAddon, S as SiteConfig, U as UserSiteConfig } from '../shared/valaxy.DJquM_xq.mjs';
16
+ import { D as DefaultTheme, R as RuntimeConfig, a as RedirectItem, V as ValaxyConfig, P as PartialDeep, b as ValaxyAddon, S as SiteConfig, U as UserSiteConfig } from '../shared/valaxy.gqLhCu14.mjs';
17
17
  import { MarkdownEnv } from 'unplugin-vue-markdown/types';
18
18
  import { KatexOptions } from 'katex';
19
19
  import MarkdownIt from 'markdown-it';
@@ -1,4 +1,4 @@
1
- export { C as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, V as ViteValaxyPlugins, b as build, c as cli, N as createServer, L as createValaxyPlugin, D as customElements, j as defaultSiteConfig, w as defaultValaxyConfig, F as defaultViteConfig, h as defineAddon, y as defineConfig, k as defineSiteConfig, u as defineTheme, f as defineValaxyAddon, x as defineValaxyConfig, t as defineValaxyTheme, O as encryptContent, g as generateClientRedirects, Q as getGitTimestamp, e as getIndexHtml, M as getServerInfoText, R as isExternal, U as isInstalledGlobally, S as isPath, v as loadConfigFromFile, A as mergeValaxyConfig, m as mergeViteConfigs, p as postProcessForSSG, I as processValaxyOptions, d as registerDevCommand, i as resolveAddonsConfig, Y as resolveImportPath, W as resolveImportUrl, J as resolveOptions, n as resolveSiteConfig, l as resolveSiteConfigFromRoot, o as resolveThemeConfigFromRoot, K as resolveThemeValaxyConfig, q as resolveUserThemeConfig, B as resolveValaxyConfig, z as resolveValaxyConfigFromRoot, r as run, s as ssgBuild, a as startValaxyDev, X as toAtFS, T as transformObject, H as version } from '../shared/valaxy.B5JLGXpW.mjs';
1
+ export { C as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, V as ViteValaxyPlugins, b as build, c as cli, N as createServer, L as createValaxyPlugin, D as customElements, j as defaultSiteConfig, w as defaultValaxyConfig, F as defaultViteConfig, h as defineAddon, y as defineConfig, k as defineSiteConfig, u as defineTheme, f as defineValaxyAddon, x as defineValaxyConfig, t as defineValaxyTheme, O as encryptContent, g as generateClientRedirects, Q as getGitTimestamp, e as getIndexHtml, M as getServerInfoText, R as isExternal, U as isInstalledGlobally, S as isPath, v as loadConfigFromFile, A as mergeValaxyConfig, m as mergeViteConfigs, p as postProcessForSSG, I as processValaxyOptions, d as registerDevCommand, i as resolveAddonsConfig, Y as resolveImportPath, W as resolveImportUrl, J as resolveOptions, n as resolveSiteConfig, l as resolveSiteConfigFromRoot, o as resolveThemeConfigFromRoot, K as resolveThemeValaxyConfig, q as resolveUserThemeConfig, B as resolveValaxyConfig, z as resolveValaxyConfigFromRoot, r as run, s as ssgBuild, a as startValaxyDev, X as toAtFS, T as transformObject, H as version } from '../shared/valaxy.DsB_W1aR.mjs';
2
2
  import 'node:path';
3
3
  import 'fs-extra';
4
4
  import 'consola/utils';
@@ -2,7 +2,7 @@ import process from 'node:process';
2
2
  import yargs from 'yargs';
3
3
  import { hideBin } from 'yargs/helpers';
4
4
  import os from 'node:os';
5
- import path$1, { join, dirname, resolve } from 'node:path';
5
+ import path$1, { join, dirname, resolve, relative as relative$1 } from 'node:path';
6
6
  import { consola } from 'consola';
7
7
  import { colors } from 'consola/utils';
8
8
  import fg from 'fast-glob';
@@ -437,6 +437,51 @@ async function getAlias(options) {
437
437
  return alias;
438
438
  }
439
439
 
440
+ const LOCAL_SEARCH_INDEX_ID = "@localSearchIndex";
441
+ const LOCAL_SEARCH_INDEX_REQUEST_PATH = `/${LOCAL_SEARCH_INDEX_ID}`;
442
+ async function localSearchPlugin(options) {
443
+ const siteConfig = options.config.siteConfig;
444
+ if (siteConfig.search?.provider !== "local") {
445
+ return {
446
+ name: "valaxy:local-search",
447
+ resolveId(id) {
448
+ if (id.startsWith(LOCAL_SEARCH_INDEX_ID)) {
449
+ return LOCAL_SEARCH_INDEX_REQUEST_PATH;
450
+ }
451
+ },
452
+ load(id) {
453
+ if (id.startsWith(LOCAL_SEARCH_INDEX_REQUEST_PATH)) {
454
+ return `export default '{}'`;
455
+ }
456
+ }
457
+ };
458
+ }
459
+ return {
460
+ name: "valaxy:local-search",
461
+ config: () => {
462
+ return {
463
+ optimizeDeps: {
464
+ include: [
465
+ "valaxy > @vueuse/integrations/useFocusTrap",
466
+ "valaxy > mark.js/src/vanilla.js",
467
+ "valaxy > minisearch"
468
+ ]
469
+ }
470
+ // async configureServer(_server) {
471
+ // server = _server
472
+ // await scanForBuild()
473
+ // onIndexUpdated()
474
+ // },
475
+ // resolveId(id) {
476
+ // if (id.startsWith(LOCAL_SEARCH_INDEX_ID)) {
477
+ // return `/${id}`
478
+ // }
479
+ // },
480
+ };
481
+ }
482
+ };
483
+ }
484
+
440
485
  const logger = consola.create({});
441
486
  const valaxyPrefix = colors.magenta("[valaxy]");
442
487
  const vLogger = {
@@ -1554,7 +1599,7 @@ async function setupMarkdownPlugins(md, options, base = "/") {
1554
1599
  return md;
1555
1600
  }
1556
1601
 
1557
- const version = "0.26.9";
1602
+ const version = "0.26.12";
1558
1603
 
1559
1604
  const GLOBAL_STATE = {
1560
1605
  valaxyApp: void 0,
@@ -1995,7 +2040,7 @@ const defaultSiteConfig = {
1995
2040
  },
1996
2041
  search: {
1997
2042
  enable: false,
1998
- type: "fuse"
2043
+ provider: "fuse"
1999
2044
  },
2000
2045
  fuse: {
2001
2046
  dataPath: "valaxy-fuse-list.json",
@@ -3472,7 +3517,9 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
3472
3517
  fullInstall: true,
3473
3518
  include: roots.map((root) => `${root}/locales/**`)
3474
3519
  }),
3475
- createFixPlugins()
3520
+ createFixPlugins(),
3521
+ // localSearch
3522
+ await localSearchPlugin(options)
3476
3523
  ];
3477
3524
  if (valaxyConfig.visualizer) {
3478
3525
  try {
@@ -3855,21 +3902,36 @@ async function getPosts(params, options) {
3855
3902
  const html = markdown.render(rssContent).replace('src="/', `src="${DOMAIN}/`);
3856
3903
  if (data.image?.startsWith("/"))
3857
3904
  data.image = DOMAIN + data.image;
3858
- const link = DOMAIN + path.replace(`${options.userRoot}/pages`, "").replace(/\.md$/, "");
3905
+ const relativePath = relative$1(join(options.userRoot, "pages"), path);
3906
+ const urlPath = relativePath.replace(/\\/g, "/").replace(/\.md$/, "");
3907
+ const link = `${DOMAIN}/${urlPath}`;
3859
3908
  const tip = `<br/><p>${lang === "zh-CN" ? `\u8BBF\u95EE <a href="${link}" target="_blank">${link}</a> ${fullText ? "\u67E5\u770B\u539F\u6587" : "\u9605\u8BFB\u5168\u6587"}\u3002` : `Visit <a href="${link}" target="_blank">${link}</a> to ${fullText ? "view original article" : "read more"}.`}</p>`;
3860
- posts.push({
3909
+ const item = {
3861
3910
  ...data,
3862
3911
  title: tObject(data.title, lang),
3863
3912
  description: tObject(data.description, lang),
3864
3913
  date: new Date(data.date),
3865
- published: new Date(data.updated || data.date),
3914
+ // RSS pubDate / JSON date_published
3915
+ published: new Date(data.date),
3916
+ // Atom published (first publish time)
3866
3917
  content: html + tip,
3867
3918
  author: [author],
3868
3919
  id: data.id || link,
3869
- link
3870
- });
3920
+ link,
3921
+ // Add updated field for Atom feed (if exists)
3922
+ // Atom: <updated> (last modified time)
3923
+ // JSON Feed: date_modified
3924
+ ...data.updated && { updated: new Date(data.updated) }
3925
+ };
3926
+ posts.push(item);
3871
3927
  }
3872
- posts.sort((a, b) => +(b.published || b.date) - +(a.published || a.date));
3928
+ const orderBy = siteConfig.orderBy || "date";
3929
+ const useUpdatedTime = orderBy === "updated";
3930
+ posts.sort((a, b) => {
3931
+ const aTime = useUpdatedTime ? a.updated || a.date : a.date;
3932
+ const bTime = useUpdatedTime ? b.updated || b.date : b.date;
3933
+ return +bTime - +aTime;
3934
+ });
3873
3935
  return posts;
3874
3936
  }
3875
3937
  async function writeFeed(feedOptions, posts, options, feedNameMap) {
@@ -4077,7 +4139,7 @@ async function execBuild({ ssg, root, output, log }) {
4077
4139
  const valaxyApp = createValaxyNode(options);
4078
4140
  await callHookWithLog("options:resolved", valaxyApp);
4079
4141
  const modules = [];
4080
- if (options.config.siteConfig.search.type === "fuse")
4142
+ if (options.config.siteConfig.search.provider === "fuse")
4081
4143
  modules.push(fuseModule);
4082
4144
  if (options.config.modules.rss.enable)
4083
4145
  modules.push(rssModule);
@@ -569,20 +569,25 @@ interface SiteConfig {
569
569
  * @zh 是否启用
570
570
  */
571
571
  enable: boolean;
572
+ /**
573
+ * @deprecated will be deprecated, use search.provider instead
574
+ */
575
+ type?: SiteConfig['search']['provider'];
572
576
  /**
573
577
  * Search Type
574
578
  * - algolia: Algolia Search
575
579
  * - engine: Engine Search, like Google/Baidu
576
580
  * - fuse: Local Search by fuse.js
581
+ * - local(todo): Local Search by MiniSearch
577
582
  */
578
- type: 'algolia' | 'engine' | 'fuse';
583
+ provider: 'algolia' | 'engine' | 'fuse' | 'local';
579
584
  };
580
585
  /**
581
586
  *
582
587
  * fuse search
583
588
  * @see https://fusejs.io/
584
589
  * @description 本地搜索
585
- * Please set search.type to 'fuse'
590
+ * Please set search.provider to 'fuse'
586
591
  */
587
592
  fuse: {
588
593
  /**
@@ -1,5 +1,5 @@
1
- import { c as PostFrontMatter, d as PageFrontMatter } from '../shared/valaxy.DJquM_xq.mjs';
2
- export { A as Album, B as BaseFrontMatter, D as DefaultTheme, E as ExcerptType, F as FuseListItem, P as PartialDeep, i as Photo, g as Pkg, a as RedirectItem, f as RedirectRule, R as RuntimeConfig, S as SiteConfig, e as SocialLink, U as UserSiteConfig, h as UserValaxyConfig, b as ValaxyAddon, V as ValaxyConfig } from '../shared/valaxy.DJquM_xq.mjs';
1
+ import { c as PostFrontMatter, d as PageFrontMatter } from '../shared/valaxy.gqLhCu14.mjs';
2
+ export { A as Album, B as BaseFrontMatter, D as DefaultTheme, E as ExcerptType, F as FuseListItem, P as PartialDeep, i as Photo, g as Pkg, a as RedirectItem, f as RedirectRule, R as RuntimeConfig, S as SiteConfig, e as SocialLink, U as UserSiteConfig, h as UserValaxyConfig, b as ValaxyAddon, V as ValaxyConfig } from '../shared/valaxy.gqLhCu14.mjs';
3
3
  import { Header } from '@valaxyjs/utils';
4
4
  import '@vueuse/integrations/useFuse';
5
5
  import 'medium-zoom';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy",
3
3
  "type": "module",
4
- "version": "0.26.9",
4
+ "version": "0.26.12",
5
5
  "description": "📄 Vite & Vue powered static blog generator.",
6
6
  "author": {
7
7
  "email": "me@yunyoujun.cn",
@@ -64,16 +64,16 @@
64
64
  "@antfu/utils": "^9.3.0",
65
65
  "@clack/prompts": "^0.11.0",
66
66
  "@iconify-json/ri": "^1.2.6",
67
- "@intlify/unplugin-vue-i18n": "^11.0.1",
68
- "@shikijs/transformers": "^3.15.0",
67
+ "@intlify/unplugin-vue-i18n": "^11.0.3",
68
+ "@shikijs/transformers": "^3.20.0",
69
69
  "@types/katex": "^0.16.7",
70
- "@unhead/addons": "^2.0.19",
71
- "@unhead/schema-org": "^2.0.19",
72
- "@unhead/vue": "^2.0.19",
73
- "@vitejs/plugin-vue": "^6.0.1",
70
+ "@unhead/addons": "^2.1.1",
71
+ "@unhead/schema-org": "^2.1.1",
72
+ "@unhead/vue": "^2.1.1",
73
+ "@vitejs/plugin-vue": "^6.0.3",
74
74
  "@vue/devtools-api": "7.7.2",
75
- "@vueuse/core": "^14.0.0",
76
- "@vueuse/integrations": "^14.0.0",
75
+ "@vueuse/core": "^14.1.0",
76
+ "@vueuse/integrations": "^14.1.0",
77
77
  "beasties": "^0.3.5",
78
78
  "consola": "^3.4.2",
79
79
  "cross-spawn": "^7.0.6",
@@ -87,16 +87,16 @@
87
87
  "fast-glob": "^3.3.3",
88
88
  "feed": "^5.1.0",
89
89
  "floating-vue": "^5.2.2",
90
- "fs-extra": "^11.3.2",
90
+ "fs-extra": "^11.3.3",
91
91
  "fuse.js": "^7.1.0",
92
92
  "gray-matter": "^4.0.3",
93
- "hookable": "^5.5.3",
93
+ "hookable": "^6.0.1",
94
94
  "html-to-text": "^9.0.5",
95
95
  "jiti": "^2.6.1",
96
96
  "js-base64": "^3.7.8",
97
- "js-yaml": "^4.1.0",
98
- "katex": "^0.16.25",
99
- "lru-cache": "^11.2.2",
97
+ "js-yaml": "^4.1.1",
98
+ "katex": "^0.16.27",
99
+ "lru-cache": "^11.2.4",
100
100
  "markdown-it": "^14.1.0",
101
101
  "markdown-it-anchor": "^9.2.0",
102
102
  "markdown-it-async": "^2.2.0",
@@ -108,7 +108,7 @@
108
108
  "markdown-it-table-of-contents": "^1.1.0",
109
109
  "markdown-it-task-lists": "^2.1.1",
110
110
  "medium-zoom": "^1.1.0",
111
- "mermaid": "^11.12.1",
111
+ "mermaid": "^11.12.2",
112
112
  "mlly": "^1.8.0",
113
113
  "nprogress": "^0.2.0",
114
114
  "open": "10.1.0",
@@ -118,29 +118,29 @@
118
118
  "pinia": "^3.0.4",
119
119
  "qrcode": "^1.5.4",
120
120
  "resolve-global": "^2.0.0",
121
- "sass": "^1.93.3",
122
- "shiki": "^3.15.0",
121
+ "sass": "^1.97.1",
122
+ "shiki": "^3.20.0",
123
123
  "star-markdown-css": "^0.5.3",
124
124
  "table": "^6.9.0",
125
- "unhead": "^2.0.19",
126
- "unocss": "^66.5.4",
125
+ "unhead": "^2.1.1",
126
+ "unocss": "66.5.10",
127
127
  "unplugin-vue-components": "28.0.0",
128
128
  "unplugin-vue-markdown": "^29.2.0",
129
- "unplugin-vue-router": "^0.16.1",
129
+ "unplugin-vue-router": "^0.19.1",
130
130
  "vanilla-lazyload": "^19.1.3",
131
- "vite": "^7.2.1",
131
+ "vite": "^7.3.0",
132
132
  "vite-dev-rpc": "^1.1.0",
133
- "vite-plugin-vue-devtools": "^8.0.3",
133
+ "vite-plugin-vue-devtools": "^8.0.5",
134
134
  "vite-plugin-vue-layouts": "^0.11.0",
135
135
  "vite-ssg": "^28.2.2",
136
136
  "vite-ssg-sitemap": "^0.10.0",
137
137
  "vitepress-plugin-group-icons": "^1.6.5",
138
- "vue": "^3.5.23",
139
- "vue-i18n": "^11.1.12",
140
- "vue-router": "^4.6.3",
138
+ "vue": "3.5.22",
139
+ "vue-i18n": "^11.2.7",
140
+ "vue-router": "^4.6.4",
141
141
  "yargs": "^18.0.0",
142
- "@valaxyjs/devtools": "0.26.9",
143
- "@valaxyjs/utils": "0.26.9"
142
+ "@valaxyjs/devtools": "0.26.12",
143
+ "@valaxyjs/utils": "0.26.12"
144
144
  },
145
145
  "devDependencies": {
146
146
  "@mdit-vue/plugin-component": "^3.0.2",
@@ -160,11 +160,12 @@
160
160
  "@types/nprogress": "^0.2.3",
161
161
  "@types/pascalcase": "^1.0.3",
162
162
  "@types/qrcode": "^1.5.6",
163
- "@types/yargs": "^17.0.34",
163
+ "@types/yargs": "^17.0.35",
164
164
  "cilicili": "^0.1.1",
165
165
  "diacritics": "^1.3.0",
166
166
  "gh-pages": "^6.3.0",
167
167
  "https-localhost": "^4.7.1",
168
+ "p-map": "^7.0.4",
168
169
  "rollup-plugin-visualizer": "^6.0.5",
169
170
  "unbuild": "^3.6.1"
170
171
  },
package/types/config.ts CHANGED
@@ -171,13 +171,18 @@ export interface SiteConfig {
171
171
  * @zh 是否启用
172
172
  */
173
173
  enable: boolean
174
+ /**
175
+ * @deprecated will be deprecated, use search.provider instead
176
+ */
177
+ type?: SiteConfig['search']['provider']
174
178
  /**
175
179
  * Search Type
176
180
  * - algolia: Algolia Search
177
181
  * - engine: Engine Search, like Google/Baidu
178
182
  * - fuse: Local Search by fuse.js
183
+ * - local(todo): Local Search by MiniSearch
179
184
  */
180
- type: 'algolia' | 'engine' | 'fuse'
185
+ provider: 'algolia' | 'engine' | 'fuse' | 'local'
181
186
  }
182
187
 
183
188
  /**
@@ -185,7 +190,7 @@ export interface SiteConfig {
185
190
  * fuse search
186
191
  * @see https://fusejs.io/
187
192
  * @description 本地搜索
188
- * Please set search.type to 'fuse'
193
+ * Please set search.provider to 'fuse'
189
194
  */
190
195
  fuse: {
191
196
  /**
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Type augmentation for markdown-it-container
3
+ *
4
+ * The official @types/markdown-it-container@2.0.11 depends on @types/markdown-it@13.0.9,
5
+ * but we use @types/markdown-it@14.1.2. This file provides compatible type definitions.
6
+ */
7
+ declare module 'markdown-it-container' {
8
+ import type MarkdownIt from 'markdown-it'
9
+ import type Token from 'markdown-it/lib/token.mjs'
10
+
11
+ interface ContainerOptions {
12
+ /**
13
+ * Function to validate tail after opening marker, should return true on success.
14
+ */
15
+ validate?: (params: string) => boolean
16
+
17
+ /**
18
+ * Renderer for opening/closing tokens.
19
+ */
20
+ render?: (tokens: Token[], idx: number, options: any, env: any, self: any) => string
21
+
22
+ /**
23
+ * Character to use in delimiter, default is ":"
24
+ */
25
+ marker?: string
26
+ }
27
+
28
+ /**
29
+ * markdown-it plugin for creating block-level custom containers
30
+ */
31
+ function container(
32
+ md: MarkdownIt,
33
+ name: string,
34
+ options?: ContainerOptions,
35
+ ): void
36
+
37
+ export = container
38
+ }