-
Notifications
You must be signed in to change notification settings - Fork 85
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
fix: win path problem with context module and require context #1742
Conversation
概述演练这些变更主要涉及在Mako构建插件中引入 变更
针对链接问题的评估
诗歌
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 addresses the Windows path issue in the context module and require context by integrating the Changes
|
@@ -24,18 +25,30 @@ impl ContextLoadMode { | |||
let mut map_str = String::from(r#"var _map_lazy = {"#); | |||
map.iter().for_each(|(key, value)| match self { | |||
ContextLoadMode::Sync => { | |||
println!( |
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.
Debug print statements like println!("... render_module_import1: {} -> {}", win_path(key), win_path(value));
should be removed or replaced with proper logging before merging, as they can clutter the output and are not suitable for production code.
)); | ||
} | ||
|
||
ContextLoadMode::Lazy => { | ||
println!( |
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.
Debug print statements like println!("... render_module_import2: {} -> {}", win_path(key), win_path(value));
should be removed or replaced with proper logging before merging, as they can clutter the output and are not suitable for production code.
@@ -147,11 +160,12 @@ impl VirtualContextModuleRender { | |||
pub fn module_id_map(&self, map: &BTreeMap<String, String>, context: &Arc<Context>) -> String { | |||
let mut map_str = String::from(r#"var _map = {"#); | |||
for (key, value) in map.iter() { | |||
println!("... replace key: {} -> {}", key, win_path(key)); |
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.
Debug print statements like println!("... replace key: {} -> {}", key, win_path(key));
should be removed or replaced with proper logging before merging, as they can clutter the output and are not suitable for production code.
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: 0
🧹 Nitpick comments (2)
crates/mako/src/plugins/require_context/render.rs (2)
28-32
: 移除调试打印语句这些调试打印语句应该在发布前移除,它们不应该出现在生产代码中。
- println!( - "... render_module_import1: {} -> {}", - win_path(key), - win_path(value) - );Also applies to: 42-46
163-163
: 移除调试日志这行调试日志应该在发布前移除。
- println!("... replace key: {} -> {}", key, win_path(key));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
crates/mako/src/plugins/context_module.rs
(2 hunks)crates/mako/src/plugins/require_context/param.rs
(2 hunks)crates/mako/src/plugins/require_context/render.rs
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: stable - i686-pc-windows-msvc - node@20
- GitHub Check: stable - x86_64-pc-windows-msvc - node@20
- GitHub Check: stable - aarch64-unknown-linux-musl - node@20
- GitHub Check: Clippy
- GitHub Check: stable - aarch64-unknown-linux-gnu - node@20
- GitHub Check: Mako Build (macos-latest)
- GitHub Check: stable - x86_64-unknown-linux-musl - node@20
- GitHub Check: stable - x86_64-unknown-linux-gnu - node@20
- GitHub Check: Cargo Test
- GitHub Check: Code Coverage
- GitHub Check: Mako Build (ubuntu-latest)
- GitHub Check: stable - aarch64-apple-darwin - node@20
- GitHub Check: stable - x86_64-apple-darwin - node@20
🔇 Additional comments (5)
crates/mako/src/plugins/require_context/param.rs (2)
11-11
: 导入了 win_path 函数以处理 Windows 路径新增了 win_path 函数的导入,用于规范化 Windows 路径格式。
38-40
: 确保路径在编码前进行规范化处理在对路径进行编码之前使用 win_path 进行规范化处理,这有助于解决 Windows 路径的兼容性问题。
crates/mako/src/plugins/require_context/render.rs (1)
36-37
: 路径规范化处理的实现正确在模块导入时对键值对的路径进行规范化处理,确保了 Windows 环境下的路径兼容性。
Also applies to: 50-51, 167-168
crates/mako/src/plugins/context_module.rs (2)
15-15
: 正确导入了所需的模块从 file 模块中导入 win_path 函数,同时保持了其他必要的导入。
123-125
: 路径规范化的实现完整且正确在生成内容时对所有值进行路径规范化处理,确保了跨平台兼容性。建议添加单元测试以验证 Windows 路径的处理。
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1742 +/- ##
==========================================
- Coverage 54.82% 54.78% -0.04%
==========================================
Files 180 180
Lines 18053 18066 +13
==========================================
Hits 9897 9897
- Misses 8156 8169 +13 ☔ View full report in Codecov by Sentry. |
Close #1693
Summary by CodeRabbit
新功能
win_path
函数,用于跨平台路径处理改进