-
Notifications
You must be signed in to change notification settings - Fork 108
feat: add CaseSensitivePlugin #1713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "case\u2014sensitive"
Conversation
Walkthrough该拉取请求引入了一个新的插件 Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
WalkthroughThis pull request introduces a new Changes
|
| let mut file_path = file.clone(); | ||
| let mut case_name = String::new(); | ||
| // 缓存map,file path做为key存在对应路径下的文件名和文件夹名 | ||
| let mut cache_map = self.cache_map.lock().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider handling the potential PoisonError when locking the cache_map to avoid panics. You can use lock().unwrap_or_else(|e| e.into_inner()) to handle this gracefully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
crates/mako/src/plugins/case_sensitive.rs (2)
66-69: 请避免在库代码中使用println!宏在库代码中使用
println!可能会导致意外的控制台输出,建议使用日志库(如log或tracing)来管理日志信息,从而更好地控制日志级别和输出。
85-85: 避免使用println!,改用日志库在插件中使用
println!会直接输出信息,可能在生产环境中造成不必要的输出,建议使用日志库来记录调试和信息日志。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
crates/mako/test/build/case-sensitive/assets/umi-logo.pngis excluded by!**/*.png
📒 Files selected for processing (6)
crates/mako/src/compiler.rs(1 hunks)crates/mako/src/plugins.rs(1 hunks)crates/mako/src/plugins/case_sensitive.rs(1 hunks)crates/mako/test/build/case-sensitive/index.ts(1 hunks)crates/mako/test/build/case-sensitive/mako.config.json(1 hunks)crates/mako/test/build/case-sensitive/package.json(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- crates/mako/test/build/case-sensitive/index.ts
- crates/mako/test/build/case-sensitive/mako.config.json
- crates/mako/test/build/case-sensitive/package.json
🔇 Additional comments (2)
crates/mako/src/plugins.rs (1)
3-3: 模块声明看起来正确
成功添加了 case_sensitive 模块,模块声明符合规范。
crates/mako/src/compiler.rs (1)
247-247: 成功添加了 CaseSensitivePlugin 插件
CaseSensitivePlugin 插件已正确添加到编译器的内置插件列表中,位置和初始化方式均符合预期。
| let file_path = &_param.file.path.to_string_lossy().to_string(); | ||
| if !file_path.starts_with(root) { | ||
| return false; | ||
| } | ||
| if file_path.contains("/node_modules/") { | ||
| return false; | ||
| } | ||
| true | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
建议使用 Path 方法来处理文件路径
直接对文件路径进行字符串操作可能导致跨平台兼容性问题,建议使用 std::path::Path 提供的方法(如 starts_with、components 等)来确保路径处理的正确性和跨平台兼容性。
【RFC】#1710
【支持大小写检测】
#164
Summary by CodeRabbit
CaseSensitivePlugin插件,用于检查指定目录结构中文件名的大小写敏感性。mako.config.json,包含duplicatePackageChecker的设置。package.json文件,定义项目的元数据和依赖要求。case_sensitive,扩展了插件功能。UmiLogo并添加日志输出。