GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: return complete pattern parts from scan by mrmlnc · Pull Request #199 · micromatch/picomatch

Conversation

@mrmlnc

@mrmlnc mrmlnc commented Aug 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #58. This PR depends on #197, because makes this fix simpler by enabling full-pattern scanning for tokens.

Summary

scan() did not always return a complete representation of pattern segments when parts was enabled.

This change:

  • preserves leading and trailing empty segments;
  • returns a single part for patterns without path separators;
  • excludes prefixes such as ! and ./ from returned parts;
  • keeps slashes inside balanced parentheses in the same part;
  • handles nested and escaped parentheses;
  • splits only on top-level, unescaped path separators.

Examples

scan('/', { parts: true }).parts
// ['', '']

scan('/a/b', { parts: true }).parts
// ['', 'a', 'b']

scan('(!(b/a))', { parts: true }).parts
// ['(!(b/a))']

scan('./directory/(a|b)/*.js', { parts: true }).parts
// ['directory', '(a|b)', '*.js']

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mrmlnc
fix: return complete pattern parts from scan
f201165
Preserve leading and trailing empty segments and return the final
segment for patterns without a path separator.

Track nested and escaped parentheses so that only top-level,
unescaped path separators split the pattern. Keep prefixes out of
the returned parts.

Fixes #58.
@github-code-quality

github-code-quality Bot commented Aug 23, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: JavaScript

JavaScript / code-coverage/nyc

The overall line coverage in commit f201165 in the issue-58 branch is 96%. Line coverage data for the master branch is not yet available.

Show a line coverage summary of the most covered files.
File master issue-58 f201165 +/-
lib/constants.js — 100% —
index.js — 100% —
posix.js — 100% —
lib/scan.js — 99% —
lib/parse.js — 95% —
lib/picomatch.js — 95% —
lib/utils.js — 90% —
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@doowb
doowb marked this pull request as ready for review August 24, 2026 14:03
@doowb
doowb merged commit ada9d3f into master Aug 24, 2026
26 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@doowb
doowb deleted the issue-58 branch August 24, 2026 14:04
@mrmlnc mrmlnc mentioned this pull request Aug 24, 2026
Fix for #62 #63
Closed
mergify Bot added a commit to ArcadeData/arcadedb that referenced this pull request Aug 30, 2026
@mergify
chore(studio-deps-dev)(deps-dev): bump picomatch from 4.0.5 to 4.0.7 …
20493da
…in /studio [skip ci]

Bumps [picomatch](https://github.com/micromatch/picomatch) from 4.0.5 to 4.0.7.
Release notes

*Sourced from [picomatch's releases](https://github.com/micromatch/picomatch/releases).*

> 4.0.7
> -----
>
> What's Changed
> --------------
>
> * fix: handle terminal globstars in parenthesized patterns by [`@​mrmlnc`](https://github.com/mrmlnc) in [micromatch/picomatch#198](https://redirect.github.com/micromatch/picomatch/pull/198)
>
> **Full Changelog**: <micromatch/picomatch@4.0.6...4.0.7>
>
> 4.0.6
> -----
>
> What's Changed
> --------------
>
> * fix: scan full pattern when tokens are requested by [`@​mrmlnc`](https://github.com/mrmlnc) in [micromatch/picomatch#197](https://redirect.github.com/micromatch/picomatch/pull/197)
> * fix: return complete pattern parts from scan by [`@​mrmlnc`](https://github.com/mrmlnc) in [micromatch/picomatch#199](https://redirect.github.com/micromatch/picomatch/pull/199)
>
> **Full Changelog**: <micromatch/picomatch@4.0.5...4.0.6>


Changelog

*Sourced from [picomatch's changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md).*

> 4.0.7 (2026-08-24)
> ------------------
>
> ### Fixed
>
> * Fixed terminal globstars in parenthesized patterns ([#142](https://redirect.github.com/micromatch/picomatch/issues/142), [e279bd7](micromatch/picomatch@e279bd7)).
>
> 4.0.6 (2026-08-24)
> ------------------
>
> ### Fixed
>
> * `scan()` now scans the full pattern when tokens are requested, instead of merging the remaining path segments into the final token ([#62](https://redirect.github.com/micromatch/picomatch/issues/62), [5f5819d](micromatch/picomatch@5f5819d)).
> * `scan()` now returns complete pattern parts, including leading and trailing empty segments, and handles nested and escaped parentheses correctly ([#58](https://redirect.github.com/micromatch/picomatch/issues/58), [f201165](micromatch/picomatch@f201165)).


Commits

* [`6bb4067`](micromatch/picomatch@6bb4067) 4.0.7
* [`fdfb155`](micromatch/picomatch@fdfb155) Merge pull request [#198](https://redirect.github.com/micromatch/picomatch/issues/198) from micromatch/issue-142
* [`38c6b7a`](micromatch/picomatch@38c6b7a) 4.0.6
* [`ada9d3f`](micromatch/picomatch@ada9d3f) Merge pull request [#199](https://redirect.github.com/micromatch/picomatch/issues/199) from micromatch/issue-58
* [`9b74f6f`](micromatch/picomatch@9b74f6f) Merge pull request [#197](https://redirect.github.com/micromatch/picomatch/issues/197) from micromatch/issue-62
* [`f201165`](micromatch/picomatch@f201165) fix: return complete pattern parts from scan
* [`e279bd7`](micromatch/picomatch@e279bd7) fix: handle terminal globstars in parenthesized patterns
* [`5f5819d`](micromatch/picomatch@5f5819d) fix: scan full pattern when tokens are requested
* See full diff in [compare view](micromatch/picomatch@4.0.5...4.0.7)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=picomatch&package-manager=npm\_and\_yarn&previous-version=4.0.5&new-version=4.0.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

The scan method returns empty parts for pattern with only a forward slash

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mrmlnc @doowb
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.