-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: 适配效能插件的fix #17514
base: main
Are you sure you want to change the base?
fix: 适配效能插件的fix #17514
Conversation
Walkthrough在 Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant F as filterGlobalConfig
participant P as Plugins
C->>F: 调用 filterGlobalConfig(globalConfig, command)
alt command 为假(null/falsy)
F->>P: 检查并过滤包含 ExcludePluginTagsForNullCommand 的插件
F-->>C: 返回更新后的 config
else command 为真
F->>P: 根据 RelatedPluginTag 执行插件过滤
F-->>C: 返回处理后的 config
end
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
🪧 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
🧹 Nitpick comments (1)
packages/taro-service/src/utils/index.ts (1)
123-131
: 优化命令为空时的配置过滤逻辑当命令为空时,现在会过滤掉包含特定标签的插件,而不是直接返回原始配置。这解决了PR中提到的问题,防止在命令为空时加载不必要的插件。
建议使用可选链操作符来避免潜在的空值错误:
- if (config.plugins?.length) { + if (config.plugins?.length) { config.plugins = config.plugins.filter(pluginName => { return !ExcludePluginTagsForNullCommand.some(tag => pluginName.includes(tag)) }) }另外,考虑添加类型检查以确保
pluginName
是字符串类型:config.plugins = config.plugins.filter(pluginName => { - return !ExcludePluginTagsForNullCommand.some(tag => pluginName.includes(tag)) + return typeof pluginName === 'string' && !ExcludePluginTagsForNullCommand.some(tag => pluginName.includes(tag)) })🧰 Tools
🪛 Biome (1.9.4)
[error] 127-127: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/taro-service/src/utils/index.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/taro-service/src/utils/index.ts (1)
packages/taro/types/compile/config/project.d.ts (1)
IProjectConfig
(210-323)
🪛 Biome (1.9.4)
packages/taro-service/src/utils/index.ts
[error] 127-127: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
🔇 Additional comments (1)
packages/taro-service/src/utils/index.ts (1)
121-121
: 新增常量用于排除特定插件标签这个常量定义了当命令为空时需要排除的插件标签列表。目前只包含一个标签
@jdtaro/plugin-build-
。这是一个良好的实践,将这些标签统一管理,便于未来扩展。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17514 +/- ##
========================================
Coverage 57.70% 57.70%
========================================
Files 469 469
Lines 26551 26551
Branches 5859 5842 -17
========================================
Hits 15321 15321
- Misses 9608 9727 +119
+ Partials 1622 1503 -119
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
这个 PR 做了什么? (简要描述所做更改)
command为空时(Taro项目外的taro命令,去掉所有build阶段加载的全局插件)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit