feat(load-md-files): replace lstat with glob withFileTypes, eliminate unbounded Promise.all#63
Merged
Merged
Conversation
ee5c383 to
017df5f
Compare
… unbounded Promise.all
- Rewrite loadMdFiles using glob({ withFileTypes: true }) to eliminate all
lstat system calls — isSymbolicLink() reads Dirent type bits directly
- Pass all patterns as array to single glob() call, removing the first
Promise.all
- Remove absolute: true (conflicts with withFileTypes), use fullpath()
- Add 6 new tests: normal files, file symlinks, files inside symlinked
dirs, pattern dedup, relative→absolute paths, nonexistent paths
- Update performance-security-analysis.md: mark P1 as fixed, reorder
priorities
017df5f to
3b16978
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #62
变更
load-md-files.ts: 用glob({ withFileTypes: true })重写 — 移除lstat引入,模式数组作单次调用,isSymbolicLink()来自 Dirent(零额外系统调用),fullpath()获取绝对路径。I/O 从O(glob 次数) + O(n × lstat)降至O(1 次 glob),无Promise.all残留。symlink-security.spec.ts: 新增 7 项loadMdFiles测试:正常文件、文件符号链接、目录内文件、重复 pattern、相对路径→绝对路径、不存在路径、扩展名过滤sanitize-terminal.ts: ESLint--fix格式微调验证
load-md-files.ts行覆盖率 100%(40%→41% 总体)