Skip to content

feat: implement glob pattern matching with last-match-wins semantics#63

Merged
fengmk2 merged 1 commit into
mainfrom
last-match-wins
Sep 13, 2025
Merged

feat: implement glob pattern matching with last-match-wins semantics#63
fengmk2 merged 1 commit into
mainfrom
last-match-wins

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Aug 28, 2025

  • Add vite_glob crate for efficient glob pattern matching
  • Implement GlobPatternSet with support for negated patterns (!)
  • Follow gitignore-like semantics: last matching pattern wins
  • Support workspace exclusion patterns in pnpm/npm/yarn workspaces
  • Add comprehensive tests for various glob scenarios

🤖 Generated with Claude Code

@fengmk2 fengmk2 requested a review from branchseer August 28, 2025 11:20
Comment thread crates/vite_package_manager/src/lib.rs
Copy link
Copy Markdown
Member

@Boshen Boshen left a comment

Choose a reason for hiding this comment

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

@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented Aug 29, 2025

Can you also test https://github.com/oxc-project/fast-glob

The amount of code is similar, but Glob parsing needs to be done every time, which would likely result in some performance degradation https://github.com/voidzero-dev/vite-plus/pull/67/files.
Also, we need wax's walk function to traverse directories, so we can only replace part of wax's functionality.
It seems more appropriate to just use wax as a single dependency.

@Brooooooklyn
Copy link
Copy Markdown
Member

cursor review

@Brooooooklyn Brooooooklyn requested review from Copilot and removed request for branchseer August 29, 2025 05:53

This comment was marked as outdated.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


@fengmk2 fengmk2 requested a review from Copilot August 31, 2025 05:18
Copy link
Copy Markdown
Contributor

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 implements efficient glob pattern matching with last-match-wins semantics for workspace exclusion patterns. The implementation follows gitignore-like behavior where negated patterns (!pattern) override earlier matches.

  • Adds a new vite_glob crate with a GlobPatternSet that supports negated patterns
  • Replaces compact_str usage with vite_str::Str across multiple crates
  • Refactors workspace pattern handling to use the new glob system with proper last-match-wins semantics

Reviewed Changes

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

Show a summary per file
File Description
crates/vite_glob/src/lib.rs New glob pattern matching implementation with comprehensive tests
crates/vite_glob/Cargo.toml New crate configuration
crates/vite_package_manager/src/lib.rs Refactored workspace glob handling to use new pattern system
crates/vite_package_manager/src/package.rs Extracted PackageJson and related types from lib.rs
crates/vite_package_manager/Cargo.toml Updated dependencies to include vite_glob and vite_str
crates/vite_task/src/config/workspace.rs String type conversion updates
crates/vite_error/src/lib.rs Removed compact_str dependency
crates/vite_error/Cargo.toml Updated dependencies
Cargo.toml Added vite_glob workspace dependency
Comments suppressed due to low confidence (1)

crates/vite_package_manager/src/lib.rs:1

  • The pattern cloning on lines 70 and 72 creates unnecessary allocations. Consider collecting patterns into inclusions and all vectors in a single pass without cloning, or use references where possible.
pub mod package;

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread crates/vite_package_manager/src/lib.rs
@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented Sep 8, 2025

@branchseer Check if #63 and #68 can be merged, as vite install needs to pass through more default environment variables, and the functionality depends on these two PRs.

Copy link
Copy Markdown
Member Author

fengmk2 commented Sep 8, 2025

Copilot AI review requested due to automatic review settings September 13, 2025 09:39
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread crates/vite_package_manager/src/lib.rs Outdated
Comment thread crates/vite_package_manager/src/lib.rs
- Add vite_glob crate for efficient glob pattern matching
- Implement GlobPatternSet with support for negated patterns (!)
- Follow gitignore-like semantics: last matching pattern wins
- Support workspace exclusion patterns in pnpm/npm/yarn workspaces
- Add comprehensive tests for various glob scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@fengmk2 fengmk2 merged commit 221716a into main Sep 13, 2025
8 checks passed
Copy link
Copy Markdown
Member Author

fengmk2 commented Sep 13, 2025

Merge activity

@fengmk2 fengmk2 deleted the last-match-wins branch September 13, 2025 10:01
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.

5 participants