-
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
feat: support runtime global module registry #1574
Conversation
Walkthrough此次更改引入了一个新的布尔字段 Changes
Assessment against linked issues
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/generate/runtime.rs (1)
15-15
: 结构体修改审查
AppRuntimeTemplate
结构体新增了一个布尔字段global_module_registry
,用于启用/禁用全局模块注册表功能。建议为此字段添加适当的文档,说明其用途和工作方式,以便于其他开发者理解和使用。
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- crates/mako/src/config/config.rs (2 hunks)
- crates/mako/src/generate/chunk_pot/util.rs (1 hunks)
- crates/mako/src/generate/runtime.rs (1 hunks)
- crates/mako/templates/app_runtime.stpl (1 hunks)
- e2e/fixtures/config.global-module-registry/expect.js (1 hunks)
- e2e/fixtures/config.global-module-registry/mako.config.json (1 hunks)
- e2e/fixtures/config.global-module-registry/src/common.ts (1 hunks)
- e2e/fixtures/config.global-module-registry/src/entryA.ts (1 hunks)
- e2e/fixtures/config.global-module-registry/src/entryB.ts (1 hunks)
Files skipped from review due to trivial changes (3)
- e2e/fixtures/config.global-module-registry/src/common.ts
- e2e/fixtures/config.global-module-registry/src/entryA.ts
- e2e/fixtures/config.global-module-registry/src/entryB.ts
Additional comments not posted (5)
e2e/fixtures/config.global-module-registry/expect.js (1)
1-4
: 测试实现审查此测试通过
require
加载模块并使用assert
断言不同入口点的模块实例是否相同,直接关联到 PR 的目标。测试实现简单且恰当,适合验证全局模块注册表的功能。e2e/fixtures/config.global-module-registry/mako.config.json (1)
1-25
: 配置设置审查此配置文件结构清晰,包括了入口定义、代码分割策略和全局模块注册表选项。
globalModuleRegistry
选项设置为true
,符合 PR 的目标,支持新功能的测试。配置设置适当,支持所引入的功能。crates/mako/src/generate/chunk_pot/util.rs (1)
118-118
: 新增字段global_module_registry
已正确集成代码更改已经通过审查。请确保
global_module_registry
字段的集成不会影响现有功能。运行以下脚本以验证新字段的集成:
Verification successful
global_module_registry
字段已正确集成
global_module_registry
字段在代码库中的集成是正确的,并且没有对现有功能产生负面影响。该字段在多个文件中定义和使用,符合其作为全局模块注册表的用途。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 描述:验证 `global_module_registry` 字段的集成。 # 测试:搜索函数使用。预期:只有新签名的出现。 rg --type rust -A 5 $'global_module_registry'Length of output: 1051
crates/mako/templates/app_runtime.stpl (1)
2-8
: 条件块正确实现
createRuntime
函数中的条件块已经正确实现,允许基于全局上下文灵活管理模块。请确保此逻辑不会引入任何副作用。运行以下脚本以验证条件逻辑的正确性:
Verification successful
条件逻辑正确实现
在模板文件中的条件逻辑已正确实现,与
hmr_runtime.js
中的模块管理使用模式一致。modulesRegistry
的初始化确保了在热模块替换场景中模块状态的正确管理。无需进一步操作。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 描述:验证 `modulesRegistry` 的条件逻辑。 # 测试:搜索条件块使用。预期:只有正确的条件逻辑。 rg --type rust -A 5 $'modulesRegistry'Length of output: 37
Script:
#!/bin/bash # 描述:验证 `modulesRegistry` 的条件逻辑。 # 测试:搜索模板文件或 JavaScript 文件中的条件块使用。 rg --type js --type-add 'template:*.stpl' -A 5 'modulesRegistry'Length of output: 3679
crates/mako/src/config/config.rs (1)
125-125
: 新增布尔字段global_module_registry
已正确集成
OutputConfig
结构中的新增字段已经通过审查。请确保此字段的集成不会影响现有功能。运行以下脚本以验证新字段的集成:
Verification successful
global_module_registry
字段已成功集成在
OutputConfig
结构中新增的global_module_registry
字段已正确集成,并在代码库中被使用。没有发现任何影响现有功能的问题。
crates/mako/src/config/config.rs
: 字段声明。crates/mako/src/generate/chunk_pot/util.rs
: 字段使用。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 描述:验证 `global_module_registry` 字段的集成。 # 测试:搜索结构使用。预期:只有新字段的出现。 rg --type rust -A 5 $'global_module_registry'Length of output: 1051
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1574 +/- ##
==========================================
+ Coverage 61.92% 62.01% +0.08%
==========================================
Files 127 127
Lines 15311 15347 +36
==========================================
+ Hits 9481 9517 +36
Misses 5830 5830 ☔ View full report in Codecov by Sentry. |
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- docs/config.md (1 hunks)
- docs/config.zh-CN.md (1 hunks)
Files skipped from review due to trivial changes (1)
- docs/config.zh-CN.md
@@ -12,4 +12,5 @@ pub struct AppRuntimeTemplate { | |||
pub is_browser: bool, | |||
pub concatenate_enabled: bool, | |||
pub cross_origin_loading: Option<String>, | |||
pub global_module_registry: bool, |
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.
guess: how many fields will be hold in this struct ?
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.
I don't know ...
Close #1559
Summary by CodeRabbit
新功能
文档
修复