Refactor/整理项目对话错误相关代码 #593

Merged
k88936 merged 40 commits from refactor/turn-error-to-explicit-struct into master 2026-10-03 15:58:25 +08:00
Showing only changes of commit fff4e8ff68 - Show all commits
+7 -7
View File
@@ -77,14 +77,14 @@ function snapshot(dir) {
console.warn(`目录不存在,跳过校验:${dir}`);
return new Map();
}
const entries = fs.readdirSync(absolute, { recursive: true });
return new Map(
fs
.readdirSync(absolute, { withFileTypes: true })
.filter((entry) => entry.isFile())
.map((entry) => [
path.posix.join(dir, entry.name),
fs.readFileSync(path.join(absolute, entry.name)),
]),
entries.flatMap((entry) => {
const absoluteFile = path.join(absolute, entry);
if (!fs.lstatSync(absoluteFile).isFile()) return [];
const name = path.posix.join(dir, entry.split(path.sep).join('/'));
return [[name, fs.readFileSync(absoluteFile)]];
}),
);
}