Skip to content

path: add escapeGlob and unescapeGlob - #61269

Open
Xstoudi wants to merge 13 commits into
nodejs:mainfrom
Xstoudi:feat/glob-escape
Open

path: add escapeGlob and unescapeGlob#61269
Xstoudi wants to merge 13 commits into
nodejs:mainfrom
Xstoudi:feat/glob-escape

Conversation

@Xstoudi

@Xstoudi Xstoudi commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

path: add escapeGlob and unescapeGlob

Expose minimatch escaping and unescaping capabilities on path module.

Fixes: #61258

This is an implem proposal fix #61258 using minimatch that is already-vendored. Also feel free to -1 the change if you think it doesn't have its place there.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/path

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. path Issues and PRs related to the path subsystem. labels Jan 4, 2026
@codecov

codecov Bot commented Jan 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.15%. Comparing base (9041ad0) to head (e7ed644).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61269      +/-   ##
==========================================
+ Coverage   90.12%   90.15%   +0.02%     
==========================================
  Files         743      743              
  Lines      242324   242368      +44     
  Branches    45629    45635       +6     
==========================================
+ Hits       218396   218501     +105     
+ Misses      15440    15359      -81     
- Partials     8488     8508      +20     
Files with missing lines Coverage Δ
lib/internal/fs/glob.js 91.51% <100.00%> (+0.24%) ⬆️
lib/path.js 97.51% <100.00%> (+0.02%) ⬆️

... and 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller avivkeller added semver-minor PRs that contain new features and should be released in the next minor version. notable-change PRs with changes that should be highlighted in changelogs. labels Jan 4, 2026
@github-actions

This comment was marked as outdated.

@Xstoudi

Xstoudi commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

Hey, no interest?

@nodejs/path

@targos

targos commented Feb 25, 2026

Copy link
Copy Markdown
Member

@nodejs/path @nodejs/fs

Comment thread doc/api/path.md Outdated
Comment thread test/parallel/test-path-unescapeglob.js
Comment thread lib/path.js Outdated
@TheOneTheOnlyJJ

Copy link
Copy Markdown
Contributor

I am wondering, why not just expose minimatch? It's already vendored, right?

@Xstoudi

Xstoudi commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Vendoring is an implem detail, not a commitment and I'd prefer to not couple the Node's API to a third-party dependency.

Goal here is to provide stable, cross-platform glob semantic in Node rather than exposing raw minimatch behavior. windowsPathsNoEscape and magicalBraces are good illustrations of this.

@jazelly jazelly added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 2, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 2, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Xstoudi

Xstoudi commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

Hey, is there something blocking this PR?

@valler

valler commented Jul 23, 2026

Copy link
Copy Markdown

The test cases don't include patterns containing parentheses ( and ). Is this intentional?

@Xstoudi

Xstoudi commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

No, I'll add some

@avivkeller avivkeller added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jul 23, 2026
@avivkeller

Copy link
Copy Markdown
Member

@Xstoudi Please rebase

@Xstoudi
Xstoudi force-pushed the feat/glob-escape branch from 3671060 to dc0951b Compare July 24, 2026 18:18
Xstoudi added 3 commits July 24, 2026 20:49
Expose minimatch escaping and unescaping capabilities on path module.

Fixes: nodejs#61258
Signed-off-by: Xavier Stouder <xavier@stouder.io>
@Xstoudi
Xstoudi force-pushed the feat/glob-escape branch from dc0951b to a2123ff Compare July 24, 2026 18:51
@avivkeller avivkeller added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 25, 2026
@github-actions github-actions Bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor
Failed to start CI
- Validating Jenkins credentials
✔  Jenkins credentials valid
- Querying data for job/node-test-pull-request/72403/
[SyntaxError: Unexpected token '<', ..."    
  https://github.com/nodejs/node/actions/runs/30165172379

@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. labels Jul 26, 2026
@github-actions github-actions Bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor
Failed to start CI
- Validating Jenkins credentials
✔  Jenkins credentials valid
- Querying data for job/node-test-pull-request/72403/
[SyntaxError: Unexpected token '<', ..."    
  https://github.com/nodejs/node/actions/runs/30182123250

@trivikr

trivikr commented Aug 21, 2026

Copy link
Copy Markdown
Member

This needs a rebase to resolve conflicts in test/parallel/test-path-glob.js

@trivikr trivikr removed the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Aug 22, 2026
@TheOneTheOnlyJJ

Copy link
Copy Markdown
Contributor

Should this be reconsidered around #65392? @avivkeller

@avivkeller

Copy link
Copy Markdown
Member

If needed, since we won't have an escape function, this PR can be updated to vendor it's own escaping implementation, it's quite simple, it's just stringToEscape.replace(/[?*()[\]{}]/g, '[$&]')

@avivkeller avivkeller removed the notable-change PRs with changes that should be highlighted in changelogs. label Aug 23, 2026
@valler

valler commented Aug 23, 2026

Copy link
Copy Markdown

If needed, since we won't have an escape function, this PR can be updated to vendor it's own escaping implementation, it's quite simple, it's just stringToEscape.replace(/[?*()[\]{}]/g, '[$&]')

nice, that's more or less what #61258 gave as an example plus closing symbols.

@trivikr trivikr removed the request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. path Issues and PRs related to the path subsystem. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

path.escapeGlob

9 participants