This commit is contained in:
2026-05-11 05:30:03 +08:00
parent eeda1e68e8
commit 33951a649b
48 changed files with 640 additions and 1018 deletions

View File

@@ -1,6 +1,7 @@
import fs from "fs";
import path from "path";
import { globSync } from "glob";
// 1. 引入 tinyglobby
import { globSync } from "tinyglobby";
interface Config {
outputDir: string;
@@ -77,13 +78,12 @@ function generateIndexFile(config: Config) {
// ------ scanDirs forEach start ------------------------
config.scanDirs.forEach((dir) => {
// 2. 路径模式保持不变tinyglobby 能够正确处理
const scanPattern = path.resolve(currentPath, dir, "**", "*.*");
const allFilePath = globSync(scanPattern, {
absolute: true,
windowsPathsNoEscape: true,
dot: false,
follow: true,
// 3. 移除了 windowsPathsNoEscapetinyglobby 默认处理路径更智能
});
const validFiles = allFilePath.filter((filePath) => {