Skip to content

fix: improve enum scanning loop exit logic and use unplugin transform…#9

Merged
AntaresQAQ merged 1 commit into
mainfrom
fix-release-enum-logic
Dec 21, 2025
Merged

fix: improve enum scanning loop exit logic and use unplugin transform…#9
AntaresQAQ merged 1 commit into
mainfrom
fix-release-enum-logic

Conversation

@AntaresQAQ
Copy link
Copy Markdown
Owner

… filter

Copilot AI review requested due to automatic review settings December 21, 2025 17:14
@AntaresQAQ AntaresQAQ merged commit e278b08 into main Dec 21, 2025
6 checks passed
@AntaresQAQ AntaresQAQ deleted the fix-release-enum-logic branch December 21, 2025 17:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the plugin to use unplugin's native transform filter mechanism and improves the enum scanning loop exit logic by performing proper Set equality comparison instead of just checking size changes.

Key changes:

  • Refactored transform filtering to use unplugin's native filter API instead of manual pattern matching
  • Improved enum scanning loop exit logic to use Set equality comparison rather than size comparison
  • Added Vite-specific configuration to apply only during build

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/index.ts Refactored to use unplugin's transform filter API and added Vite build-only configuration
src/core/utils.ts Added isEqualSet utility function for comparing Set equality
src/core/inline-const-enum.ts Updated scanConstEnums to use Set equality comparison instead of size comparison for more accurate loop termination
package.json Bumped version from 0.0.3 to 0.0.4

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/utils.ts
Comment on lines +29 to +39
export function isEqualSet<T>(a: Set<T>, b: Set<T>): boolean {
if (a.size !== b.size) {
return false;
}
for (const item of a) {
if (!b.has(item)) {
return false;
}
}
return true;
}
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

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

The new isEqualSet utility function lacks test coverage. Since the existing test file test/e2e.test.ts demonstrates this codebase uses comprehensive testing, this new utility function should have unit tests to verify its behavior, especially for edge cases like empty sets, sets with different sizes, and sets with identical elements.

Copilot uses AI. Check for mistakes.
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.

2 participants