What is the problem this feature will solve?
Would allow for the dynamic creation of glob patterns from arbitrary paths.
Example:
const pattern = `${path.escapeGlob(import.meta.dirname)}/*`;
What is the feature you are proposing to solve the problem?
Something similar in functionality to this:
// Wraps symbols which open groups `{`, `[`, `(`, and
// those with semantics independent of groups `*`, `?`
path.escapeGlob = (x = "") => x.replace(/([*{[(?])/g, "[$1]");
And this:
// inverse path.escapeGlob
path.unescapeGlob = (x = "") => x.replace(/\[(.)\]/g, "$1");
I was using #58988 as a reference for special chars.
What alternatives have you considered?
Using a user land package everywhere dynamic glob creation is required, or even for everything glob related to keep things consistent.