@maizzle/framework
Version:
Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.
19 lines (18 loc) • 679 B
JavaScript
import { matchesGlob, relative } from "pathe";
//#region src/utils/watchPaths.ts
/**
* Build a predicate that tells whether an absolute file path emitted by
* chokidar matches any of the given globs. Patterns are interpreted as
* project-relative; a leading `./` is stripped so user-supplied globs like
* `./locales/**` behave identically to `locales/**`.
*/
function createWatchedFileMatcher(patterns, cwd) {
const normalized = patterns.map((p) => p.replace(/^\.\//, ""));
return (file) => {
const rel = relative(cwd, file);
return normalized.some((p) => matchesGlob(rel, p));
};
}
//#endregion
export { createWatchedFileMatcher };
//# sourceMappingURL=watchPaths.js.map