minimatch
The minimal glob matcher used internally by npm — converts glob patterns into JavaScript RegExp objects.
Repository Health
Technical Analysis
Minimatch is a minimal glob-matching utility that converts shell-style glob expressions into JavaScript RegExp objects, then tests file paths against them. It is the matching library used internally by npm and sits at the foundation of the wider glob ecosystem.
Beyond simple *.js wildcards, minimatch supports brace expansion, extended glob (extglob) patterns, ** globstar matching across directories, POSIX character classes, negation, and a large set of options for case-sensitivity, partial matching, and Windows path handling.
What You Get
- A single
minimatch(path, pattern, options)function that returns whether a path matches a glob - A reusable
Minimatchclass exposing the parsedset, compiledregexp, and match helpers - Utility helpers:
filter(forArray.filter),match(fnmatch/glob-style list matching),makeRe,escape, andunescape - Full TypeScript types shipped as a hybrid ESM/CommonJS module
- An extensive option set covering brace expansion, extglobs, globstar, case-insensitivity, partial matching, and Windows path semantics
Common Use Cases
- Filtering lists of file paths against a glob pattern (the core of tools like glob and rimraf)
- Implementing include/exclude rules in build tools, bundlers, linters, and test runners
- Matching
.gitignore-style orpackage.jsonfiles-style path patterns - Reusing a compiled pattern across many paths for performance-sensitive directory walks
Under The Hood
Architecture
Minimatch’s pipeline lives in src/index.ts (the Minimatch class and top-level minimatch function) supported by src/ast.ts, which builds an abstract syntax tree from the pattern. A pattern is first split by / into path parts; braces are expanded via the external brace-expansion dependency into a 2-dimensional set where each row is a brace-expanded variant and each element is a path segment. Each segment is parsed by the AST in ast.ts (handling extglobs, character classes from src/brace-expressions.ts, and globstar) and compiled either to a literal string or a RegExp. Matching walks the split filename against a row via matchOne, with special-casing for ** globstar traversal and Windows UNC/drive-letter roots. src/assert-valid-pattern.ts guards against oversized patterns as a ReDoS mitigation.
Tech Stack
Written in TypeScript targeting Node 18/20/22+, with brace-expansion as its only runtime dependency. It builds via tshy into a hybrid package that ships both ESM and CommonJS entry points with type declarations. Dev tooling includes tap for testing, oxlint for linting, prettier for formatting, and typedoc for API docs.
Code Quality
The repository has an extensive test/ suite (25+ files) covering basics, brace expansion, extglobs, negation, partial matching, Windows path separators, UNC paths, optimization levels, and a dedicated redos.js for regular-expression denial-of-service edge cases, plus tap snapshots. Options are documented inline with JSDoc on the MinimatchOptions interface. The code is dense but well-organized into single-responsibility modules (escape.ts, unescape.ts, brace-expressions.ts, assert-valid-pattern.ts).
API Design
The public API is deliberately small and ergonomic: minimatch('bar.foo', '*.foo') reads naturally, while the Minimatch class exposes lower-level internals (set, regexp, matchOne) for glob-walkers that need to avoid excessive filesystem calls. Every option is a boolean flag with a clear name, and the README documents each one exhaustively. TypeScript types and hybrid module output make it drop-in for both import and require.
Used by 38 apps in this directory
overleaf
Collaboration · Productivity
Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.
Pi
AI Agents
An open-source, self-extensible agent harness and coding agent CLI — a modular runtime (agent core, unified multi-provider LLM API, TUI) with no built-in permission system by default, documented containerization patterns for sandboxing instead.
Prime Agent
AI Agents · AI Code Assistants · Developer Tools
An open-source coding and research agent built around a Recursive Language Model that treats context as variables and a persistent Python REPL as its only tool.
Promptfoo
AI Development
An open-source CLI and library for evaluating and red-teaming LLM applications — replace trial-and-error prompt engineering with systematic evals, vulnerability scanning, and CI/CD integration.
Standard Notes
Note Taking
End-to-end encrypted notes and files — private by design, built to last, and fully self-hostable.
strapi
CMS
Open-source headless CMS that auto-generates REST and GraphQL APIs from your content models, with a fully customizable admin panel you control.
TinaCMS
CMS
An open-source, Git-backed headless CMS that gives editors a live visual editing UI over Markdown, MDX, JSON, and YAML content while developers keep everything in version control.
Trigger.dev
AI Development · Automation · Developer Tools
Build and deploy fully-managed AI agents and background jobs in TypeScript — with no timeouts, durable retries, real-time observability, and elastic scaling built in.
Void
AI Code Assistants · Automation · Code Editors
Open-source AI code editor with direct LLM integration and data privacy