-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat/upgrade swc #1444
feat/upgrade swc #1444
Conversation
## Walkthrough
本次更改集中在更新 `Cargo.toml` 文件中的依赖项,新增了 `clap` 和 `regex` 依赖,并更新了 `swc_core` 的版本。此外,`mako` 子项目的依赖项也进行了精简和版本固定,确保了依赖管理的稳定性和一致性。整体上,这些更改反映了对项目功能的增强和依赖管理的优化。
## Changes
| 文件 | 更改摘要 |
|----------------------------------------------|--------------------------------------------------|
| Cargo.toml | 新增 `clap` 和 `regex` 依赖,更新 `swc_core` 版本。 |
| crates/mako/Cargo.toml | 精简 `swc_core` 特性集,固定多个依赖项的版本。 |
| packages/bundler-mako/package.json | 更新 `@umijs/mako` 依赖版本。 |
| packages/mako/package.json | 更新 `@umijs/mako` 及其可选依赖版本。 |
| packages/mako/npm/* | 更新多个平台的 `@umijs/mako` 版本。 |
## Assessment against linked issues
| Objective | Addressed | Explanation |
|-----------------------------------------------|-----------|--------------------------------------|
| 移除 mako 代码中的 swc workaround (#[1432]) | ❌ | 本次更改未涉及 `swc` 的相关代码更新。 |
| 使用稳定的 Rust 版本 (#[1432]) | ❌ | 本次更改未包含 Rust 版本的更新。 |
| 解决一些具体问题 (#[1432]) | ❓ | 本次更改未直接解决提到的问题,需进一步确认。 |
- **#1186**: 该 PR 修改了 `Cargo.toml` 文件,添加了新依赖,与主 PR 中的更改相关。
- **#1460**: 该 PR 更新了 `Cargo.toml` 文件,添加了新依赖,直接与主 PR 的修改有关。
- **#1466**: 该 PR 引入了新依赖,建立了与主 PR 的关系。
- **#1575**: 该 PR 更新了 `package.json` 文件,涉及依赖管理的更改,相关性强。
- **#1595**: 该 PR 涉及 `Cargo.toml` 文件的格式化,与主 PR 中的依赖管理相关。
> 🐇 在代码的草地上跳跃,
> 每次更新都欢快的拍跺!
> 新特性闪闪如星光,
> 性能提升跃向理想!
> 让我们欢庆这变化,
> 代码更清晰,未来更笑哈哈!
> 🐰✨ 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 (
|
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
Outside diff range, codebase verification and nitpick comments (1)
crates/mako/src/plugins/mod.rs (1)
6-6
: 确认注释掉的emotion
模块的影响注释掉
emotion
模块会影响任何依赖此模块的代码。尽管crates/mako/src/compiler.rs
中的EmotionPlugin
引用已被注释掉,但crates/mako/src/plugins/emotion.rs
和crates/mako/src/config/config.rs
中的引用仍然是活跃的。请确保所有相关代码都已更新以反映此更改,以防止潜在的运行时错误。
crates/mako/src/plugins/emotion.rs
crates/mako/src/config/config.rs
Analysis chain
确认注释掉的
emotion
模块的影响注释掉
emotion
模块会影响任何依赖此模块的代码。请确保所有相关代码都已更新以反映此更改。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of commenting out the `emotion` module. # Test: Search for the usage of the `emotion` module. Expect: No occurrences. rg --type rust -A 5 $'emotion'Length of output: 3761
Script:
#!/bin/bash # Description: Verify if the references to the `emotion` module in the identified files are commented out or active. # Check if the references in crates/mako/src/compiler.rs are commented out rg --type rust -A 5 'emotion' crates/mako/src/compiler.rs # Check if the references in crates/mako/src/plugins/emotion.rs are commented out rg --type rust -A 5 'emotion' crates/mako/src/plugins/emotion.rs # Check if the references in crates/mako/src/config/config.rs are commented out rg --type rust -A 5 'emotion' crates/mako/src/config/config.rsLength of output: 1880
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (26)
- Cargo.toml (1 hunks)
- crates/mako/Cargo.toml (3 hunks)
- crates/mako/src/ast/css_ast.rs (1 hunks)
- crates/mako/src/ast/sourcemap.rs (2 hunks)
- crates/mako/src/build/load.rs (1 hunks)
- crates/mako/src/compiler.rs (3 hunks)
- crates/mako/src/features/node.rs (1 hunks)
- crates/mako/src/generate/chunk_pot/ast_impl.rs (2 hunks)
- crates/mako/src/generate/chunk_pot/str_impl.rs (1 hunks)
- crates/mako/src/generate/chunk_pot/util.rs (3 hunks)
- crates/mako/src/generate/transform.rs (1 hunks)
- crates/mako/src/plugins/context_module.rs (1 hunks)
- crates/mako/src/plugins/invalid_webpack_syntax.rs (1 hunks)
- crates/mako/src/plugins/minifish/inject.rs (1 hunks)
- crates/mako/src/plugins/mod.rs (1 hunks)
- crates/mako/src/plugins/tree_shaking/shake/module_concatenate/module_ref_rewriter.rs (2 hunks)
- crates/mako/src/plugins/tree_shaking/shake/module_concatenate/ref_link.rs (1 hunks)
- crates/mako/src/stats.rs (1 hunks)
- crates/mako/src/visitors/async_module.rs (6 hunks)
- crates/mako/src/visitors/css_px2rem.rs (2 hunks)
- crates/mako/src/visitors/env_replacer.rs (2 hunks)
- crates/mako/src/visitors/meta_url_replacer.rs (1 hunks)
- crates/mako/src/visitors/new_url_assets.rs (2 hunks)
- crates/mako/src/visitors/optimize_define_utils.rs (8 hunks)
- crates/mako/src/visitors/public_path_assignment.rs (2 hunks)
- rust-toolchain.toml (1 hunks)
Files skipped from review due to trivial changes (10)
- crates/mako/src/ast/sourcemap.rs
- crates/mako/src/features/node.rs
- crates/mako/src/generate/chunk_pot/str_impl.rs
- crates/mako/src/generate/chunk_pot/util.rs
- crates/mako/src/generate/transform.rs
- crates/mako/src/plugins/context_module.rs
- crates/mako/src/plugins/invalid_webpack_syntax.rs
- crates/mako/src/plugins/tree_shaking/shake/module_concatenate/module_ref_rewriter.rs
- crates/mako/src/visitors/css_px2rem.rs
- rust-toolchain.toml
Additional comments not posted (30)
Cargo.toml (1)
10-10
: 依赖项升级已批准
swc_core
依赖项版本已从0.83.22
升级到0.96.0
,这可能包括性能改进、新特性或错误修复。crates/mako/src/visitors/meta_url_replacer.rs (1)
16-18
: 类型处理更改已批准在
CondExpr
结构体的test
、cons
和alt
字段中添加.into()
方法调用,确保类型兼容性和安全性。crates/mako/src/visitors/public_path_assignment.rs (2)
12-16
: 简化了赋值表达式的检查逻辑使用
as_ident()
方法直接检查赋值表达式的左侧是否为标识符,简化了代码并提高了可读性。确保新逻辑的正确性。
17-20
: 改进了赋值表达式的构造使用
member_expr!
宏直接构造新的赋值表达式,提高了代码的清晰度并减少了构造新赋值时出错的可能性。crates/mako/Cargo.toml (4)
33-36
: 确认新增的swc_core
功能新增的功能增强了
swc_core
crate 的能力或功能。请确保这些功能是必要的并且已正确实现。
72-72
: 固定swc_error_reporters
版本将
swc_error_reporters
的版本固定为0.18.1
,确保兼容性和稳定性。
73-73
: 固定swc_node_comments
版本将
swc_node_comments
的版本固定为0.21.0
,确保兼容性和稳定性。
90-90
: 更新mdxjs
版本将
mdxjs
的版本更新为0.2.5
,这可能表明库中有显著的变化或改进。crates/mako/src/visitors/new_url_assets.rs (2)
54-55
: 改进了表达式处理使用
into()
方法包装document.baseURI
和self.location.href
表达式,可能提高了类型安全性或与代码库其他部分的兼容性。确保新逻辑的正确性。
94-95
: 标准化表达式处理在涉及
__mako_require__.publicPath
的二元加法操作中使用into()
方法包装左操作数,表明在不同表达式中统一处理表达式的更广泛努力。确保新逻辑的正确性。crates/mako/src/visitors/optimize_define_utils.rs (4)
38-38
: 更改已批准!将
.into()
替换为.as_callee()
提高了类型安全性和代码清晰度。
59-60
: 更改已批准!将
.into()
替换为.as_callee()
提高了类型安全性和代码清晰度。
70-70
: 更改已批准!直接比较
callee_ident.sym
和字符串字面量"_export"
减少了不必要的开销并提高了可读性。
79-80
: 更改已批准!将
.into()
替换为.as_callee()
提高了类型安全性和代码清晰度。crates/mako/src/ast/css_ast.rs (2)
49-51
: 更改已批准!添加了对
comments
的克隆操作,使Lexer
能够处理注释,提高了解析的能力。
52-52
: 更改已批准!更新了
Lexer
的初始化,包含了comments
,这可能会改变解析过程中对 CSS 注释的处理方式。crates/mako/src/build/load.rs (1)
136-136
: 更改已批准!将
reason
转换为字符串reason.to_string()
提高了错误消息的清晰度。crates/mako/src/generate/chunk_pot/ast_impl.rs (1)
100-102
: 确认临时更改并计划后续处理。
merge_source_map
函数调用被注释掉,改为从source_map_chain
弹出最后一个元素。这是一个临时措施,TODO 注释表明未来会有进一步的开发。请确认这是一个临时更改,并计划在未来版本中处理合并 source map 的逻辑。
crates/mako/src/visitors/env_replacer.rs (3)
86-89
: 优化条件检查以替代直接模式匹配。将直接模式匹配替换为条件检查,增强了代码的可读性和维护性。
这些更改保持了逻辑的完整性,同时提高了代码的可读性。
95-95
: 优化条件检查以替代直接模式匹配。将直接模式匹配替换为条件检查,增强了代码的可读性和维护性。
这些更改保持了逻辑的完整性,同时提高了代码的可读性。
143-146
: 优化条件检查以替代直接模式匹配。将直接模式匹配替换为条件检查,增强了代码的可读性和维护性。
这些更改保持了逻辑的完整性,同时提高了代码的可读性。
crates/mako/src/plugins/tree_shaking/shake/module_concatenate/ref_link.rs (1)
76-76
: 验证键的类型转换。将键插入
defined_idents
前进行类型转换,可能会影响后续操作的行为。请确保这种类型转换是必要的,并验证它不会引入新的问题。
crates/mako/src/compiler.rs (3)
187-187
: 新增字段comments
。
CssMeta
结构体中新增了comments
字段,类型为SwcComments
。
195-195
: 初始化comments
字段。
CssMeta
的new
方法已更新,正确初始化了comments
字段。
241-241
: 确认注释掉EmotionPlugin
的原因。
EmotionPlugin
的相关代码被注释掉了,建议确认注释的原因是否已记录或理解。crates/mako/src/visitors/async_module.rs (3)
7-8
: 新增导入ArrayPat
。导入了
ArrayPat
和相关结构,确保它们在代码中被正确使用。
127-137
: 使用ArrayPat
优化解构赋值。解构赋值的逻辑已更新为使用
ArrayPat
,提高了代码的可读性和性能。
139-139
: 优化条件表达式和await
处理。条件表达式和
await
处理的逻辑已更新,提高了代码的可读性和性能。crates/mako/src/plugins/minifish/inject.rs (1)
199-199
: 新增字段phase
。
ImportDecl
结构体中新增了phase
字段,使用Default::default()
进行初始化。crates/mako/src/stats.rs (1)
324-324
: 简化错误处理使用
unwrap_or_default()
简化了错误处理逻辑,提升了代码的可读性和简洁性。
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (8)
- crates/mako/Cargo.toml (3 hunks)
- crates/mako/src/ast/js_ast.rs (3 hunks)
- crates/mako/src/compiler.rs (3 hunks)
- crates/mako/src/lib.rs (1 hunks)
- crates/mako/src/stats.rs (1 hunks)
- crates/mako/src/visitors/common_js.rs (1 hunks)
- crates/mako/src/visitors/dynamic_import.rs (1 hunks)
- crates/mako/src/visitors/dynamic_import_to_require.rs (1 hunks)
Files skipped from review due to trivial changes (3)
- crates/mako/src/lib.rs
- crates/mako/src/stats.rs
- crates/mako/src/visitors/dynamic_import.rs
Files skipped from review as they are similar to previous changes (2)
- crates/mako/Cargo.toml
- crates/mako/src/compiler.rs
Additional comments not posted (4)
crates/mako/src/visitors/common_js.rs (1)
22-29
: 简化了use_strict
的逻辑重构后的代码使用了更简洁和可读的方法来确定
use_strict
的值。逻辑看起来是正确的,并且应保持相同的功能。crates/mako/src/visitors/dynamic_import_to_require.rs (1)
34-34
: 简化了模块项位置的逻辑重构后的代码使用了更简洁和可读的方法来确定模块项的位置。逻辑看起来是正确的,并且应保持相同的功能。
crates/mako/src/ast/js_ast.rs (2)
54-57
: 重命名TsConfig
为TsSyntax
重命名在确定TypeScript文件的语法时正确应用,没有引入任何问题。
Line range hint
63-67
:
重命名EsConfig
为EsSyntax
重命名在确定JavaScript文件的语法时正确应用,没有引入任何问题。
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
Outside diff range, codebase verification and nitpick comments (2)
crates/mako/src/generate/chunk_pot/mod.rs (1)
15-15
: 移除chunk_type
字段影响了其他部分的代码在
ChunkPot
结构中移除chunk_type
字段后,代码库的其他部分仍在引用此字段,这可能会导致运行时错误或逻辑错误。请检查并更新以下文件中的相关代码:
crates/mako/src/stats.rs
crates/mako/src/plugins/ssu.rs
crates/mako/src/generate/optimize_chunk.rs
crates/mako/src/generate/generate_chunks.rs
crates/mako/src/generate/chunk_graph.rs
crates/mako/src/generate/chunk_pot/ast_impl.rs
crates/mako/src/generate/chunk.rs
crates/mako/src/generate/group_chunk.rs
请确保所有引用
chunk_type
字段的代码都已更新,以反映此字段的移除。Analysis chain
移除
chunk_type
字段以简化结构移除
ChunkPot
结构中的chunk_type
字段简化了结构,可能减少复杂性并提高可维护性。请确保验证此更改对依赖此属性的相关功能的影响。
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of removing `chunk_type` field on related functionality. # Test: Search for the usage of `chunk_type`. Expect: No occurrences. rg --type rust -A 5 'chunk_type'Length of output: 17713
crates/mako/src/visitors/dep_replacer.rs (1)
请确保结构体实例化匹配新定义。
DepReplacer
结构体的定义已更改,但在以下文件中仍然存在旧定义的实例化,请更新这些实例化以匹配新定义:
crates/mako/src/visitors/dep_replacer.rs
crates/mako/src/generate/transform.rs
crates/mako/src/plugins/bundless_compiler.rs
Analysis chain
Line range hint
15-18
:
请确保结构体实例化匹配新定义。
DepReplacer
结构体的定义已更改,请验证代码库中所有对此结构体的实例化是否匹配新定义。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all struct instantiations of `DepReplacer` match the new definition. # Test: Search for the struct usage. Expect: Only occurrences of the new definition. rg --type rust -A 5 $'DepReplacer'Length of output: 4689
Script:
#!/bin/bash # Description: Verify all struct instantiations of `DepReplacer` match the new definition. # Test: Search for the struct instantiation. Expect: Only occurrences of the new definition. rg --type rust 'DepReplacer \{' -A 5Length of output: 1645
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- crates/binding/src/tsfn.rs (1 hunks)
- crates/mako/src/generate/chunk_pot/mod.rs (3 hunks)
- crates/mako/src/generate/mod.rs (1 hunks)
- crates/mako/src/generate/swc_helpers.rs (1 hunks)
- crates/mako/src/generate/transform.rs (2 hunks)
- crates/mako/src/main.rs (1 hunks)
- crates/mako/src/plugins/bundless_compiler.rs (1 hunks)
- crates/mako/src/plugins/invalid_webpack_syntax.rs (3 hunks)
- crates/mako/src/plugins/require_context/visitor.rs (1 hunks)
- crates/mako/src/plugins/tree_shaking/module.rs (2 hunks)
- crates/mako/src/plugins/tree_shaking/shake/module_concatenate.rs (1 hunks)
- crates/mako/src/plugins/tree_shaking/shake/module_concatenate/external_transformer.rs (1 hunks)
- crates/mako/src/plugins/tree_shaking/shake/skip_module.rs (1 hunks)
- crates/mako/src/plugins/tree_shaking/statement_graph.rs (2 hunks)
- crates/mako/src/visitors/dep_replacer.rs (2 hunks)
Files skipped from review due to trivial changes (3)
- crates/binding/src/tsfn.rs
- crates/mako/src/generate/swc_helpers.rs
- crates/mako/src/main.rs
Files skipped from review as they are similar to previous changes (2)
- crates/mako/src/generate/transform.rs
- crates/mako/src/plugins/invalid_webpack_syntax.rs
Additional comments not posted (12)
crates/mako/src/plugins/tree_shaking/shake/module_concatenate/external_transformer.rs (1)
29-29
: 更改参数类型以提高灵活性和性能将参数类型从
&Vec<ExprOrSpread>
更改为&[ExprOrSpread]
提高了函数的灵活性,并可能提高性能。crates/mako/src/plugins/require_context/visitor.rs (1)
50-50
: 更改参数类型以提高灵活性和性能将参数类型从
&Vec<ExprOrSpread>
更改为&[ExprOrSpread]
提高了函数的灵活性,并可能提高性能。crates/mako/src/plugins/bundless_compiler.rs (2)
Line range hint
15-18
:
请确保函数调用匹配新签名。函数
transform_js_generate
的签名已更改,请验证代码库中所有对此函数的调用是否匹配新签名。
Line range hint
15-18
:
确保内部逻辑正确。请确保函数
transform_js_generate
内部逻辑在移除top_level_mark
参数后仍然正确。crates/mako/src/visitors/dep_replacer.rs (1)
#!/bin/bash # Description: Verify internal logic correctness after field removal. # Test: Check for any references to `DepReplacer` within the entire codebase. rg --type rust 'DepReplacer'crates/mako/src/plugins/tree_shaking/statement_graph.rs (2)
34-34
: 确保新字段正确集成。
ImportInfo
结构体添加了新字段stmt_id
,请确保该字段正确集成且不会引入任何问题。#!/bin/bash # Description: Verify the integration of the new field `stmt_id` in `ImportInfo`. # Test: Check for any usage of the new field within the file. rg --type rust $'stmt_id' crates/mako/src/plugins/tree_shaking/statement_graph.rs
248-250
: 确保新字段正确集成。
Statement
结构体添加了新字段has_side_effects
和span
,请确保这些字段正确集成且不会引入任何问题。#!/bin/bash # Description: Verify the integration of the new fields `has_side_effects` and `span` in `Statement`. # Test: Check for any usage of the new fields within the file. rg --type rust $'has_side_effects|span' crates/mako/src/plugins/tree_shaking/statement_graph.rscrates/mako/src/plugins/tree_shaking/shake/module_concatenate.rs (1)
1-1
: 请验证删除的模块影响删除
mod exports_transform;
可能会影响依赖此模块的代码。请确保删除不会破坏现有功能。Verification successful
删除的模块未影响代码
在代码库中未找到对
exports_transform
模块的引用。可以确认删除此模块不会破坏现有功能。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the removed `exports_transform` module. # Test: Search for references to `exports_transform`. Expect: No occurrences. rg --type rust -A 5 $'exports_transform'Length of output: 39
Script:
#!/bin/bash # Description: Verify the impact of the removed `exports_transform` module. # Search for any references to `exports_transform` in the codebase, including imports and usage. rg 'exports_transform' -A 10Length of output: 28
crates/mako/src/plugins/tree_shaking/module.rs (1)
25-33
: 更改已批准将
UsedIdent
枚举的 trait 实现从ToString
更改为Display
,改进了与 Rust 格式化 trait 的集成。实现是正确的。crates/mako/src/generate/mod.rs (1)
Line range hint
1-1
:
请验证删除的结构体影响删除
EmitFile
结构体可能会影响依赖此结构体的代码。请确保删除不会破坏现有功能,并且新的机制已正确实现。Verification successful
删除
EmitFile
结构体的影响已验证
EmitFile
结构体已从代码库中删除,并且相关代码已被重构以使用新的文件处理机制。没有发现对EmitFile
的引用,新的机制已正确实现。
- 删除确认:
EmitFile
结构体已从代码库中移除。- 代码重构: 相关代码已更新以使用新的文件处理机制。
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the removed `EmitFile` struct. # Test: Search for references to `EmitFile`. Expect: No occurrences. rg --type rust -A 5 $'EmitFile'Length of output: 30
Script:
#!/bin/bash # Description: Verify the removal and impact of the `EmitFile` struct. # Step 1: Search for the definition of `EmitFile` to confirm it has been removed. rg --type rust 'struct EmitFile' # Step 2: Check the commit history to confirm the removal of `EmitFile`. git log -p -S 'struct EmitFile'Length of output: 7987
crates/mako/src/plugins/tree_shaking/shake/skip_module.rs (2)
165-165
: 参数类型更改已批准将参数类型从
&Vec<ModuleId>
更改为&[ModuleId]
提高了函数的灵活性和性能,符合 Rust 的最佳实践。
165-165
: 请验证函数调用确保所有对
skip_module_optimize
的调用都使用了新的参数类型。Verification successful
请验证函数调用
确保所有对
skip_module_optimize
的调用都使用了新的参数类型。根据搜索结果,shake.rs
中的函数调用使用了&tree_shake_modules_ids
,这与新的参数类型匹配。
crates/mako/src/plugins/tree_shaking/shake.rs
:skip_module_optimize
函数调用使用了新的参数类型。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `skip_module_optimize` match the new parameter type. # Test: Search for the function usage. Expect: Only occurrences of the new parameter type. rg --type rust -A 5 $'skip_module_optimize'Length of output: 1696
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (1)
- crates/mako/Cargo.toml (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- crates/mako/Cargo.toml
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- crates/binding/Cargo.toml (1 hunks)
- crates/mako/src/compiler.rs (2 hunks)
Files skipped from review due to trivial changes (1)
- crates/binding/Cargo.toml
Files skipped from review as they are similar to previous changes (1)
- crates/mako/src/compiler.rs
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (2)
- crates/mako/Cargo.toml (3 hunks)
- crates/mako/src/ast/sourcemap.rs (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- crates/mako/Cargo.toml
- crates/mako/src/ast/sourcemap.rs
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (1)
- scripts/test-hmr.mjs (1 hunks)
Additional comments not posted (1)
scripts/test-hmr.mjs (1)
1644-1644
: 请验证 'content-type' 头信息的更改是否符合新标准。将 'content-type' 从 'application/javascript; charset=utf-8' 更改为 'text/javascript; charset=utf-8' 可能会影响客户端对 JavaScript 内容的解释和处理。请确保此更改符合最新的服务器配置或标准。
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- packages/bundler-mako/package.json (1 hunks)
- packages/mako/npm/darwin-arm64/package.json (1 hunks)
- packages/mako/npm/darwin-x64/package.json (1 hunks)
- packages/mako/npm/linux-arm64-gnu/package.json (2 hunks)
- packages/mako/npm/linux-arm64-musl/package.json (1 hunks)
- packages/mako/npm/linux-x64-gnu/package.json (1 hunks)
- packages/mako/npm/linux-x64-musl/package.json (1 hunks)
- packages/mako/package.json (2 hunks)
Files skipped from review due to trivial changes (2)
- packages/mako/npm/darwin-x64/package.json
- packages/mako/package.json
Files skipped from review as they are similar to previous changes (4)
- packages/mako/npm/darwin-arm64/package.json
- packages/mako/npm/linux-arm64-musl/package.json
- packages/mako/npm/linux-x64-gnu/package.json
- packages/mako/npm/linux-x64-musl/package.json
Additional comments not posted (2)
packages/mako/npm/linux-arm64-gnu/package.json (1)
3-3
: 版本更新已批准。此次更改将版本号从
0.0.0
更新至0.8.9-canary.20240909.1
,符合语义化版本控制的规范。请确保所有相关文档和配置也已更新以反映这一变更。packages/bundler-mako/package.json (1)
6-6
: 依赖版本更新已批准。此次更改将
@umijs/mako
的版本号从0.8.8
更新至0.8.9-canary.20240909.1
,符合语义化版本控制的规范。请确保所有相关文档和配置也已更新以反映这一变更。
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
Files selected for processing (1)
- packages/bundler-mako/package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/bundler-mako/package.json
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
🧹 Outside diff range and nitpick comments (2)
crates/mako/src/generate/chunk_pot/util.rs (2)
74-74
: 函数结构更新正确,建议考虑提取常量在
Function
和BlockStmt
结构中添加ctxt: Default::default()
是正确的,这符合更新后的 SWC API 要求。这些更改与处理 SWC 升级中的破坏性变更的 PR 目标一致。建议:考虑将
Default::default()
提取为一个常量,以提高代码的可读性和可维护性。例如:const DEFAULT_CONTEXT: swc_core::ecma::ast::Ctxt = Default::default();然后在需要的地方使用
ctxt: DEFAULT_CONTEXT
。Also applies to: 82-82
303-303
: 模块函数表达式转换更新正确,建议统一优化在
to_module_fn_expr
函数中,Function
和BlockStmt
结构添加了ctxt: Default::default()
,这与之前在empty_module_fn_expr
中的修改一致。这些更改正确地反映了 SWC API 的更新要求。建议:
- 如之前建议的那样,考虑将
Default::default()
提取为一个常量,以提高代码的一致性和可维护性。- 确保这个更改在整个代码库中统一应用,以保持一致性。
Also applies to: 312-312
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- crates/mako/src/generate/chunk_pot/util.rs (7 hunks)
- crates/mako/src/lib.rs (0 hunks)
💤 Files with no reviewable changes (1)
- crates/mako/src/lib.rs
🧰 Additional context used
🔇 Additional comments (4)
crates/mako/src/generate/chunk_pot/util.rs (4)
13-15
: 导入语句更新正确导入语句中添加了
Function
,这与后续代码中的使用相符。这个更改与升级 SWC 和处理破坏性变更的 PR 目标一致。
Line range hint
137-145
: 哈希函数优化得当
hash_hashmap
函数的实现已经得到了简化和优化。新的实现直接收集并排序哈希表条目,避免了创建中间的键值对向量。这种方法更加简洁高效,同时保持了排序和哈希逻辑的一致性,有可能提高了性能。这个改进增强了代码的可读性,是一个很好的优化。
170-172
: 模块对象转换函数优化合理
pot_to_module_object
函数的实现已经得到了优化。新的实现直接收集并排序模块映射条目,这与hash_hashmap
函数的优化类似。这种方法使代码更加简洁,可能提高了效率,同时保持了排序逻辑的一致性。这个改进与 PR 中的整体代码风格改进保持一致,是一个很好的优化。
250-252
: 块模块转换函数更新正确,建议验证
pot_to_chunk_module
函数中chunk_global_obj
的赋值操作已更新,使用了make_assign_to
和make_member
方法。这个更改可能反映了 SWC API 的更新或类型推断的改进。函数的整体逻辑保持不变,这有助于保持行为的一致性。建议:
- 验证这个更改在不同的输入场景下是否能正确工作。
- 确保这个更改与最新的 SWC 文档一致。
为了验证这个更改,可以运行以下脚本:
svgr-rs 先复制到本地, 等 PR 合并再移除
考虑到 https://swc.rs/docs/plugin/selecting-swc-core#v098x- 有对 plugin 的 breaking change 还是一步到位
close #1432
Summary by CodeRabbit
总结
新特性
clap
和regex
依赖,增强命令行参数解析和正则表达式功能。swc_core
依赖至新版本,提升项目功能和稳定性。mako
crate 的依赖特性,确保更高的兼容性和稳定性。@umijs/mako
相关包至新版本,包含新的功能和改进。Bug 修复