Skip to content

feat!: Leverage minimatch for glob comparison - #77

Draft
phated wants to merge 3 commits into
mainfrom
phated/minimatch
Draft

phated wants to merge 3 commits into
mainfrom
phated/minimatch

Conversation

@phated

@phated phated commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Minimatch has been chosen by Node.js as the implementation of globbing they include in the runtime. This means that our glob comparisons need to match whatever minimatch decides. As of the time of this PR, the Minimatch included in Node 22 is 10.2.4 so that is the pinned version here.

This means there will be some breaking changes in the "glob parents" that are determined, but I went through each breaking test and believe each one to be correct. I will also be migrating commented-out tests to explicit tests showing the difference or annotating them with comments.

Note: Minimatch is doing a full glob parse as part of each call to glob-parent which may or may not be slower than our previous implementation. Due to the amount of issues opened on this repo and the gulp repo's above it related to incorrect glob parents, we are choosing to optimize for correctness instead of performance.

Fixes #60

@phated
phated requested a review from FotoVerite October 22, 2026 23:31

@FotoVerite FotoVerite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes to the index look fine too me, I want to know what you're plans for the commented out tests? Future PR, remove, another commit.

Comment thread test/index.test.js
assert.deepStrictEqual(gp("(a|b)"), ".");
assert.deepStrictEqual(gp("/(a|b)"), "/");
assert.deepStrictEqual(gp("./(a|b)"), ".");
// assert.deepStrictEqual(gp("(a|b)"), ".");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the actual plan for Universal Naming Conventions?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am not sure what you mean by "Universal Naming Conventions", but this isn't a valid glob. I believe it is representing an "extglob" but those require a preceding symbol. Our old implementation didn't validate patterns were actually globs, just glob-like. By changing to the new implementation that forces a full minimatch parse, we can determine it is not a valid glob.

I believe a true pattern for this glob will be {a,b} or perhaps a different glob.

@phated phated added this to v6 Oct 26, 2026
@github-project-automation github-project-automation Bot moved this to Todo in v6 Oct 26, 2026
@phated phated moved this from Todo to In Progress in v6 Oct 26, 2026
@phated phated self-assigned this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

globParent("?/a") returns "?" instead of "."

2 participants