Skip to content

perf(core): avoid temporary minimizer option arrays#8159

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/refactor-minimizer-registration
Jul 22, 2026
Merged

perf(core): avoid temporary minimizer option arrays#8159
chenjiahan merged 1 commit into
mainfrom
chenjiahan/refactor-minimizer-registration

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR avoids allocating temporary arrays when registering JS and CSS minimizer options. It handles single values and arrays directly while preserving default minimizer registration for undefined and empty arrays. There are no public API or behavior changes.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Updated minimizer setup logic to remove the castArray helper. JavaScript and CSS options now branch directly on whether the value is an array, handling single options, empty arrays with defaults, and populated arrays with multiple registrations.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: avoiding temporary arrays when registering minimizer options.
Description check ✅ Passed The description matches the changes and correctly notes the no-API, no-behavior intent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/core/src/plugins/minimize.ts (1)

137-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Protect the undefined and empty-array fallback behavior in both branches.

Add regression tests for omitted/undefined and empty-array jsOptions and cssOptions; current coverage only exercises single values and populated arrays.

  • packages/core/src/plugins/minimize.ts#L137-L142: cover default JS minimizer registration.
  • packages/core/src/plugins/minimize.ts#L189-L194: cover default CSS minimizer registration.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/plugins/minimize.ts` around lines 137 - 142, Add regression
tests covering omitted or undefined and empty-array jsOptions for the default JS
minimizer registration near packages/core/src/plugins/minimize.ts:137-142, and
the equivalent cssOptions cases near
packages/core/src/plugins/minimize.ts:189-194. Verify both inputs register the
default minimizer, while preserving existing single-value and populated-array
coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/core/src/plugins/minimize.ts`:
- Around line 137-142: Add regression tests covering omitted or undefined and
empty-array jsOptions for the default JS minimizer registration near
packages/core/src/plugins/minimize.ts:137-142, and the equivalent cssOptions
cases near packages/core/src/plugins/minimize.ts:189-194. Verify both inputs
register the default minimizer, while preserving existing single-value and
populated-array coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bc3c6e8b-de12-46bd-adce-f27c8763b56d

📥 Commits

Reviewing files that changed from the base of the PR and between ff7fcc7 and 10fe2f9.

📒 Files selected for processing (1)
  • packages/core/src/plugins/minimize.ts

@chenjiahan
chenjiahan merged commit a5818c9 into main Jul 22, 2026
7 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/refactor-minimizer-registration branch July 22, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant