micromatch/picomatch ? reverse-engineered prompt

Reverse engineered prompt

Build me a tiny JavaScript library for matching file paths against glob patterns, something fast and accurate with no dependencies.

I want it to handle the usual glob stuff like *, ?, **, braces, extglobs, POSIX brackets, escaping special characters, and regex style matching where it makes sense. The main export should take a pattern and return a matcher function, and there should also be helpers for checking a string against one or more patterns directly.

Please include support for both normal Node use and a POSIX only version for environments without automatic OS path detection. Add clear examples, good tests, and a few benchmark style examples if that fits. Keep the API small and simple, and make sure it feels fast enough to use in tools that need to match lots of file paths repeatedly. If you need to, look up the current docs online first.