valaxy 0.25.4 → 0.25.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import yargs from "yargs";
4
4
  import { hideBin } from "yargs/helpers";
5
5
 
6
6
  // package.json
7
- var version = "0.25.4";
7
+ var version = "0.25.5";
8
8
 
9
9
  // node/modules/fuse.ts
10
10
  import path4 from "path";
@@ -2542,9 +2542,7 @@ function titleCollectorPlugin(md3) {
2542
2542
  const [tokens, idx] = args;
2543
2543
  const token = tokens[idx];
2544
2544
  const title = extractTitle(token.info);
2545
- if (title && title !== extractTitle("")) {
2546
- globalTitleCollector.add(title);
2547
- }
2545
+ globalTitleCollector.add(title);
2548
2546
  return fence(...args);
2549
2547
  };
2550
2548
  }
@@ -2557,7 +2555,7 @@ async function setupMarkdownPlugins(md3, options, base = "/") {
2557
2555
  const siteConfig = options?.config.siteConfig || {};
2558
2556
  if (mdOptions.preConfig)
2559
2557
  mdOptions.preConfig(md3);
2560
- md3.use(highlightLinePlugin).use(titleCollectorPlugin).use(preWrapperPlugin, { theme, siteConfig }).use(snippetPlugin, options?.userRoot).use(containerPlugin, {
2558
+ md3.use(highlightLinePlugin).use(preWrapperPlugin, { theme, siteConfig }).use(snippetPlugin, options?.userRoot).use(titleCollectorPlugin).use(containerPlugin, {
2561
2559
  languages: siteConfig.languages,
2562
2560
  ...mdOptions?.container,
2563
2561
  blocks: {
@@ -4070,15 +4068,16 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
4070
4068
  console.log();
4071
4069
  }
4072
4070
  }
4073
- const codeBlockTitles = getGlobalTitleCollector();
4074
4071
  const builtinCustomIcon = {
4075
4072
  nodejs: "vscode-icons:file-type-node",
4076
4073
  playwright: "vscode-icons:file-type-playwright",
4077
4074
  typedoc: "vscode-icons:file-type-typedoc",
4078
4075
  eslint: "vscode-icons:file-type-eslint"
4079
4076
  };
4080
- plugins.push(
4081
- groupIconVitePlugin({
4077
+ let cachedGroupIconsCSS = null;
4078
+ const generateGroupIconsCSS = (id) => {
4079
+ const codeBlockTitles = getGlobalTitleCollector();
4080
+ const originalPlugin = groupIconVitePlugin({
4082
4081
  customIcon: {
4083
4082
  ...builtinCustomIcon,
4084
4083
  ...valaxyConfig.groupIcons?.customIcon
@@ -4089,8 +4088,51 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
4089
4088
  ...Object.keys(valaxyConfig.groupIcons?.customIcon || {}),
4090
4089
  ...Array.from(codeBlockTitles)
4091
4090
  ]
4092
- })
4093
- );
4091
+ });
4092
+ if (originalPlugin && typeof originalPlugin === "object" && "load" in originalPlugin) {
4093
+ return originalPlugin.load(id);
4094
+ }
4095
+ return "";
4096
+ };
4097
+ const dynamicGroupIconPlugin = {
4098
+ name: "post-process-add-group-icons",
4099
+ enforce: "post",
4100
+ configureServer(server) {
4101
+ const markdownGlobs = roots.map((root) => `${root}/**/*.md`);
4102
+ server.watcher.add(markdownGlobs);
4103
+ server.watcher.on("change", (file) => {
4104
+ if (file.endsWith(".md")) {
4105
+ cachedGroupIconsCSS = null;
4106
+ const module = server.moduleGraph.getModuleById("\0virtual:group-icons.css");
4107
+ if (module) {
4108
+ server.reloadModule(module);
4109
+ }
4110
+ }
4111
+ });
4112
+ },
4113
+ resolveId(id) {
4114
+ if (id === "virtual:group-icons.css") {
4115
+ return "\0virtual:group-icons.css";
4116
+ }
4117
+ return void 0;
4118
+ },
4119
+ async load(id) {
4120
+ if (id === "\0virtual:group-icons.css") {
4121
+ if (cachedGroupIconsCSS !== null) {
4122
+ return cachedGroupIconsCSS;
4123
+ }
4124
+ return generateGroupIconsCSS(id);
4125
+ }
4126
+ return void 0;
4127
+ },
4128
+ // In build mode, regenerate the CSS after all markdown files have been processed
4129
+ generateBundle() {
4130
+ if (this.meta.rollupVersion) {
4131
+ cachedGroupIconsCSS = generateGroupIconsCSS("\0virtual:group-icons.css");
4132
+ }
4133
+ }
4134
+ };
4135
+ plugins.push(dynamicGroupIconPlugin);
4094
4136
  return plugins;
4095
4137
  }
4096
4138
 
@@ -3,7 +3,7 @@ import {
3
3
  registerDevCommand,
4
4
  run,
5
5
  startValaxyDev
6
- } from "../../chunk-FQD2JPI3.js";
6
+ } from "../../chunk-D6OORM36.js";
7
7
  export {
8
8
  cli,
9
9
  registerDevCommand,
@@ -50,7 +50,7 @@ import {
50
50
  startValaxyDev,
51
51
  toAtFS,
52
52
  transformObject
53
- } from "../chunk-FQD2JPI3.js";
53
+ } from "../chunk-D6OORM36.js";
54
54
  export {
55
55
  $t,
56
56
  ALL_ROUTE,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy",
3
3
  "type": "module",
4
- "version": "0.25.4",
4
+ "version": "0.25.5",
5
5
  "description": "📄 Vite & Vue powered static blog generator.",
6
6
  "author": {
7
7
  "email": "me@yunyoujun.cn",
@@ -68,7 +68,6 @@
68
68
  "@vueuse/core": "^13.5.0",
69
69
  "@vueuse/integrations": "^13.5.0",
70
70
  "beasties": "^0.3.5",
71
- "birpc": "^2.4.0",
72
71
  "consola": "^3.4.2",
73
72
  "cross-spawn": "^7.0.6",
74
73
  "css-i18n": "^0.0.5",
@@ -132,8 +131,8 @@
132
131
  "vue-i18n": "^11.1.9",
133
132
  "vue-router": "^4.5.1",
134
133
  "yargs": "^18.0.0",
135
- "@valaxyjs/devtools": "0.25.4",
136
- "@valaxyjs/utils": "0.25.4"
134
+ "@valaxyjs/devtools": "0.25.5",
135
+ "@valaxyjs/utils": "0.25.5"
137
136
  },
138
137
  "devDependencies": {
139
138
  "@mdit-vue/plugin-component": "^2.1.4",