valaxy 0.25.4 → 0.25.6

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.6";
8
8
 
9
9
  // node/modules/fuse.ts
10
10
  import path4 from "path";
@@ -373,6 +373,9 @@ var defaultValaxyConfig = {
373
373
  // cssCodeSplit: false,
374
374
  }
375
375
  },
376
+ vue: {
377
+ browserTemplateCompilation: true
378
+ },
376
379
  devtools: true
377
380
  };
378
381
  function defineValaxyConfig(config) {
@@ -1448,7 +1451,7 @@ async function getAlias(options) {
1448
1451
  { find: `valaxy-theme-${options.theme}/`, replacement: `${toAtFS(resolve6(options.themeRoot))}/` },
1449
1452
  { find: `valaxy-theme-${options.theme}`, replacement: `${toAtFS(resolve6(options.themeRoot))}/client/index.ts` }
1450
1453
  ];
1451
- if (options.config.siteConfig.encrypt.enable) {
1454
+ if (options.config.vue?.browserTemplateCompilation) {
1452
1455
  alias.push(
1453
1456
  { find: /^vue$/, replacement: await resolveImportPath("vue/dist/vue.esm-bundler.js", true) }
1454
1457
  );
@@ -2542,9 +2545,7 @@ function titleCollectorPlugin(md3) {
2542
2545
  const [tokens, idx] = args;
2543
2546
  const token = tokens[idx];
2544
2547
  const title = extractTitle(token.info);
2545
- if (title && title !== extractTitle("")) {
2546
- globalTitleCollector.add(title);
2547
- }
2548
+ globalTitleCollector.add(title);
2548
2549
  return fence(...args);
2549
2550
  };
2550
2551
  }
@@ -2557,7 +2558,7 @@ async function setupMarkdownPlugins(md3, options, base = "/") {
2557
2558
  const siteConfig = options?.config.siteConfig || {};
2558
2559
  if (mdOptions.preConfig)
2559
2560
  mdOptions.preConfig(md3);
2560
- md3.use(highlightLinePlugin).use(titleCollectorPlugin).use(preWrapperPlugin, { theme, siteConfig }).use(snippetPlugin, options?.userRoot).use(containerPlugin, {
2561
+ md3.use(highlightLinePlugin).use(preWrapperPlugin, { theme, siteConfig }).use(snippetPlugin, options?.userRoot).use(titleCollectorPlugin).use(containerPlugin, {
2561
2562
  languages: siteConfig.languages,
2562
2563
  ...mdOptions?.container,
2563
2564
  blocks: {
@@ -4070,15 +4071,16 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
4070
4071
  console.log();
4071
4072
  }
4072
4073
  }
4073
- const codeBlockTitles = getGlobalTitleCollector();
4074
4074
  const builtinCustomIcon = {
4075
4075
  nodejs: "vscode-icons:file-type-node",
4076
4076
  playwright: "vscode-icons:file-type-playwright",
4077
4077
  typedoc: "vscode-icons:file-type-typedoc",
4078
4078
  eslint: "vscode-icons:file-type-eslint"
4079
4079
  };
4080
- plugins.push(
4081
- groupIconVitePlugin({
4080
+ let cachedGroupIconsCSS = null;
4081
+ const generateGroupIconsCSS = (id) => {
4082
+ const codeBlockTitles = getGlobalTitleCollector();
4083
+ const originalPlugin = groupIconVitePlugin({
4082
4084
  customIcon: {
4083
4085
  ...builtinCustomIcon,
4084
4086
  ...valaxyConfig.groupIcons?.customIcon
@@ -4089,8 +4091,51 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
4089
4091
  ...Object.keys(valaxyConfig.groupIcons?.customIcon || {}),
4090
4092
  ...Array.from(codeBlockTitles)
4091
4093
  ]
4092
- })
4093
- );
4094
+ });
4095
+ if (originalPlugin && typeof originalPlugin === "object" && "load" in originalPlugin) {
4096
+ return originalPlugin.load(id);
4097
+ }
4098
+ return "";
4099
+ };
4100
+ const dynamicGroupIconPlugin = {
4101
+ name: "post-process-add-group-icons",
4102
+ enforce: "post",
4103
+ configureServer(server) {
4104
+ const markdownGlobs = roots.map((root) => `${root}/**/*.md`);
4105
+ server.watcher.add(markdownGlobs);
4106
+ server.watcher.on("change", (file) => {
4107
+ if (file.endsWith(".md")) {
4108
+ cachedGroupIconsCSS = null;
4109
+ const module = server.moduleGraph.getModuleById("\0virtual:group-icons.css");
4110
+ if (module) {
4111
+ server.reloadModule(module);
4112
+ }
4113
+ }
4114
+ });
4115
+ },
4116
+ resolveId(id) {
4117
+ if (id === "virtual:group-icons.css") {
4118
+ return "\0virtual:group-icons.css";
4119
+ }
4120
+ return void 0;
4121
+ },
4122
+ async load(id) {
4123
+ if (id === "\0virtual:group-icons.css") {
4124
+ if (cachedGroupIconsCSS !== null) {
4125
+ return cachedGroupIconsCSS;
4126
+ }
4127
+ return generateGroupIconsCSS(id);
4128
+ }
4129
+ return void 0;
4130
+ },
4131
+ // In build mode, regenerate the CSS after all markdown files have been processed
4132
+ generateBundle() {
4133
+ if (this.meta.rollupVersion) {
4134
+ cachedGroupIconsCSS = generateGroupIconsCSS("\0virtual:group-icons.css");
4135
+ }
4136
+ }
4137
+ };
4138
+ plugins.push(dynamicGroupIconPlugin);
4094
4139
  return plugins;
4095
4140
  }
4096
4141
 
@@ -3,7 +3,7 @@ import {
3
3
  registerDevCommand,
4
4
  run,
5
5
  startValaxyDev
6
- } from "../../chunk-FQD2JPI3.js";
6
+ } from "../../chunk-KREZGAGZ.js";
7
7
  export {
8
8
  cli,
9
9
  registerDevCommand,
@@ -276,7 +276,24 @@ interface ValaxyExtendConfig {
276
276
  * @see https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/README.md
277
277
  */
278
278
  vue?: Parameters<typeof Vue>[0] & {
279
+ /**
280
+ * @valaxy
281
+ */
279
282
  isCustomElement?: ((tag: string) => boolean)[];
283
+ /**
284
+ * @valaxy
285
+ * @see https://cn.vuejs.org/guide/scaling-up/tooling#note-on-in-browser-template-compilation
286
+ * enable
287
+ *
288
+ * for runtime compile vue, encrypt and decrypt
289
+ * for excerpt_type: html (runtime render)
290
+ *
291
+ * @default true
292
+ *
293
+ * browserTemplateCompilation
294
+ * @description 支持浏览器内的模板编译
295
+ */
296
+ browserTemplateCompilation?: boolean;
280
297
  };
281
298
  /**
282
299
  * @see https://github.com/unplugin/unplugin-vue-components
@@ -50,7 +50,7 @@ import {
50
50
  startValaxyDev,
51
51
  toAtFS,
52
52
  transformObject
53
- } from "../chunk-FQD2JPI3.js";
53
+ } from "../chunk-KREZGAGZ.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.6",
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",
@@ -101,7 +100,7 @@
101
100
  "markdown-it-table-of-contents": "^0.9.0",
102
101
  "markdown-it-task-lists": "^2.1.1",
103
102
  "medium-zoom": "^1.1.0",
104
- "mermaid": "^11.8.1",
103
+ "mermaid": "^11.9.0",
105
104
  "mlly": "^1.7.4",
106
105
  "nprogress": "^0.2.0",
107
106
  "open": "10.1.0",
@@ -129,11 +128,11 @@
129
128
  "vite-ssg-sitemap": "^0.9.0",
130
129
  "vitepress-plugin-group-icons": "^1.6.1",
131
130
  "vue": "^3.5.17",
132
- "vue-i18n": "^11.1.9",
131
+ "vue-i18n": "^11.1.10",
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.6",
135
+ "@valaxyjs/utils": "0.25.6"
137
136
  },
138
137
  "devDependencies": {
139
138
  "@mdit-vue/plugin-component": "^2.1.4",