-
Notifications
You must be signed in to change notification settings - Fork 74
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
Revert "refactor: Unify the static server in bundler-mako and devServer" #1556
Conversation
Walkthrough此次更改集中在改进静态内容服务的逻辑和请求处理的灵活性。 Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant DevServer
participant BundlerMako
Client->>DevServer: 发起请求
DevServer->>DevServer: 处理请求
DevServer->>Client: 返回静态内容
Client->>BundlerMako: 发起请求
BundlerMako->>BundlerMako: 处理请求 URL
BundlerMako->>Client: 返回文件
Poem
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
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 (2)
- crates/mako/src/dev.rs (3 hunks)
- packages/bundler-mako/index.js (1 hunks)
Additional comments not posted (4)
crates/mako/src/dev.rs (1)
174-181
: 代码简化和性能优化这些更改简化了代码并可能通过减少不必要的检查来提高性能。
请验证移除
write_to_disk
检查是否会引入任何问题。可以运行以下脚本来检查write_to_disk
的使用情况:另外,这些更改看起来是之前重构的还原。请确保这次还原不会重新引入之前解决的问题。
Also applies to: 199-201
Verification successful
移除
write_to_disk
检查的影响在
dev.rs
中移除write_to_disk
检查可能简化了静态内容的服务逻辑,而不影响编译过程。然而,建议验证compiler.rs
中的逻辑,以确保没有引入任何意外的副作用。
write_to_disk
在crates/mako/src/compiler.rs
中用于编译过程。- 请确认
compiler.rs
中的逻辑在移除检查后仍然正常工作。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 描述:检查 `write_to_disk` 的使用情况 # 测试:搜索 `write_to_disk` 的使用。预期:确保没有其他地方依赖这个检查。 rg --type rust 'write_to_disk'Length of output: 444
packages/bundler-mako/index.js (3)
117-124
: 新增processReqURL
函数以处理请求 URL这个新函数用于标准化请求 URL 的处理。它考虑了
publicPath
的配置,并相应地调整了 URL。这是一个很好的改进,它增加了 URL 处理的灵活性和一致性。
133-134
: 保留静态文件服务功能这行代码保留了之前的静态文件服务功能。
保留这个功能是正确的,它确保了从指定的输出目录正确地服务静态文件。
126-131
: 在中间件中使用processReqURL
函数这个新的中间件使用
processReqURL
函数来处理请求 URL,考虑了publicPath
的配置。这个改动很好地集成了新的
processReqURL
函数,使得 URL 处理更加灵活和可配置。让我们验证一下这个改动是否正确处理了所有可能的
publicPath
配置:Verification successful
验证成功:
processReqURL
函数正确处理了publicPath
配置
processReqURL
函数在packages/bundler-mako/index.js
中定义,并在中间件中正确使用。该函数确保publicPath
以/
开头,并根据配置调整请求 URL。这一改动很好地集成了新的函数,使得 URL 处理更加灵活和可配置。
processReqURL
函数定义和使用在packages/bundler-mako/index.js
中。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 描述:验证 processReqURL 函数是否正确处理了各种 publicPath 配置 # 测试:搜索 processReqURL 函数的定义和使用 # 预期:找到函数定义和至少一处使用 rg --type javascript -A 10 'function processReqURL' rg --type javascript -A 5 'processReqURL\('Length of output: 169
Script:
#!/bin/bash # Search for the definition and usage of the processReqURL function in the codebase # Search for the function definition rg 'function processReqURL' -A 10 # Search for the function usage rg 'processReqURL\(' -A 5Length of output: 1408
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1556 +/- ##
=======================================
Coverage 61.63% 61.63%
=======================================
Files 127 127
Lines 15294 15294
=======================================
Hits 9427 9427
Misses 5867 5867 ☔ View full report in Codecov by Sentry. |
Reverts #1468
it will break proxy feature in umi
Summary by CodeRabbit
新功能
publicPath
。性能提升
日志改进