Skip to content

Replace glob w/ fs.glob - #94

Open
ChristianMurphy wants to merge 1 commit into
unifiedjs:mainfrom
ChristianMurphy:refactor/fs-glob
Open

ChristianMurphy wants to merge 1 commit into
unifiedjs:mainfrom
ChristianMurphy:refactor/fs-glob

Conversation

@ChristianMurphy

Copy link
Copy Markdown
Member

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything or linked relevant results below
  • I made sure the docs are up to date
  • I included tests (or that’s not needed)

Description of changes

Closes #91.

This replaces the deprecated glob@10 with fs.glob from Node.
It needs a major release: the minimum Node version goes from 16 to 22.17, the first 22.x release where fs.glob is stable.

  • lib/finder.js calls fs.glob(pattern, {cwd}, callback)
  • Node has no hasMagic, so new Minimatch(pattern).hasMagic() decides what counts as a glob; with default options it is the same check as before, where \ escapes the next character
  • the readme and the CI matrix move to Node 22.17 and lts/jod
  • a new test covers a glob through a symlinked folder

Behavior changes compared to glob@10:

  • globs no longer look inside symlinked folders.
    glob@10 followed one level of links, except under a leading **.
    So **/*.md gives the same results as before.
    But */readme.md and docs/**/*.md no longer find files through a linked folder.
    A glob or path that names the link itself still works, because the engine then reads that folder
  • inside a glob, \ is a path separator instead of an escape
  • a pattern with .. that points back into cwd reports paths such as ../dir/file.md; glob@10 reported file.md
  • on Node 20 and lower, the first glob throws TypeError: fs.glob is not a function

I left out followSymlinks on purpose.
Node 22 ignores it.
On Node 24.16+, it follows links at every depth under **.
Then **/*.md would crawl pnpm dependencies and process npm workspace packages twice.

The install warning stays until wooorm/load-plugin#22 lands, because load-plugin still brings in glob@10 through @npmcli/config.

@github-actions github-actions Bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Sep 26, 2026
@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6f35eae) to head (11272d5).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #94   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         3214      3206    -8     
=========================================
- Hits          3214      3206    -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤞 phase/open Post is being triaged manually 🧑 semver/major This is a change

Development

Successfully merging this pull request may close these issues.

Replace glob with fs.glob

1 participant