vitepress-allyouneed 0.3.0 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.3.1] - 2026-05-20
6
+
7
+ ### Fixed
8
+ - **空目录假 URL 导致 MIME 404**
9
+
5
10
  ## [0.3.0] - 2026-05-20
6
11
 
7
12
  正式版。汇集 v0.3 全部新功能(Obsidian 语法 6 模块、sidebar 自动生成全套、DocHeader banner、i18n 集成、`_sidebar.md` 覆盖等),并修两个 deploy 关键 bug。
package/dist/index.cjs CHANGED
@@ -2939,8 +2939,12 @@ function toPerFolderSidebar(root, opts, options, index) {
2939
2939
  /* isTopLevel */
2940
2940
  true
2941
2941
  )) {
2942
- const firstUrl = child.dirIndex && !child.dirIndexEmpty ? child.dirIndex.url : findFirstPageUrl(child, opts) ?? `/${key}/`;
2943
- rootItems.push({ text: labelText, link: firstUrl });
2942
+ const firstUrl = child.dirIndex && !child.dirIndexEmpty ? child.dirIndex.url : findFirstPageUrl(child, opts);
2943
+ if (firstUrl) {
2944
+ rootItems.push({ text: labelText, link: firstUrl });
2945
+ } else {
2946
+ rootItems.push({ text: labelText });
2947
+ }
2944
2948
  } else {
2945
2949
  rootItems.push({ text: labelText });
2946
2950
  }
@@ -2995,10 +2999,12 @@ function generateNav(index, options, autoOptions = {}) {
2995
2999
  }
2996
3000
  const text = computeGroupText(child.path, child.dirIndex, opts);
2997
3001
  let link;
2998
- if (child.dirIndex) {
3002
+ if (child.dirIndex && !child.dirIndexEmpty) {
2999
3003
  link = stripBase(child.dirIndex.url, base);
3000
3004
  } else {
3001
- link = `/${key}/`;
3005
+ const first = findFirstPageUrl(child, opts);
3006
+ if (!first) continue;
3007
+ link = first;
3002
3008
  }
3003
3009
  const escapedPrefix = `/${key}/`.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3004
3010
  out.push({ text, link, activeMatch: "^" + escapedPrefix });
@@ -3097,10 +3103,9 @@ function generateFolderIndexes(options, folderOpts = {}) {
3097
3103
  const strip = folderOpts.stripNumericPrefix ?? true;
3098
3104
  const exclude = folderOpts.exclude ?? [];
3099
3105
  const template = folderOpts.template ?? defaultTemplate;
3100
- const dirsToProcess = collectDirs(srcDir, srcDir, viewsPrefix, exclude, mode);
3106
+ const dirsToProcess = [srcDir, ...collectDirs(srcDir, srcDir, viewsPrefix, exclude, mode)];
3101
3107
  for (const dirAbs of dirsToProcess) {
3102
3108
  const dirRel = import_node_path9.default.relative(srcDir, dirAbs).split(import_node_path9.default.sep).join("/");
3103
- if (dirRel === "") continue;
3104
3109
  const entries = safeReaddir(dirAbs);
3105
3110
  if (entries.length === 0) continue;
3106
3111
  const dirName = import_node_path9.default.basename(dirAbs).toLowerCase();
@@ -3163,11 +3168,11 @@ function generateFolderIndexes(options, folderOpts = {}) {
3163
3168
  }
3164
3169
  files.sort((a, b) => a.title.localeCompare(b.title));
3165
3170
  subDirs.sort((a, b) => a.title.localeCompare(b.title));
3166
- const lastSeg = dirRel.split("/").pop() ?? "";
3171
+ const lastSeg = dirRel === "" ? import_node_path9.default.basename(srcDir) : dirRel.split("/").pop() ?? "";
3167
3172
  const ctx = {
3168
3173
  dirAbsPath: dirAbs,
3169
3174
  dirRelPath: dirRel,
3170
- title: humanize2(lastSeg, strip),
3175
+ title: humanize2(lastSeg, strip) || "Home",
3171
3176
  files,
3172
3177
  subDirs
3173
3178
  };