Revert "refactor: migrate from Bun.Glob to npm glob package"

This reverts commit 3c21735b35.
This commit is contained in:
Dax Raad
2026-02-19 12:48:43 -05:00
parent 50883cc1e9
commit af72010e9f
17 changed files with 122 additions and 226 deletions

View File

@@ -1,5 +1,4 @@
import { sep } from "node:path"
import { Glob } from "../util/glob"
export namespace FileIgnore {
const FOLDERS = new Set([
@@ -54,17 +53,19 @@ export namespace FileIgnore {
"**/.nyc_output/**",
]
const FILE_GLOBS = FILES.map((p) => new Bun.Glob(p))
export const PATTERNS = [...FILES, ...FOLDERS]
export function match(
filepath: string,
opts?: {
extra?: string[]
whitelist?: string[]
extra?: Bun.Glob[]
whitelist?: Bun.Glob[]
},
) {
for (const pattern of opts?.whitelist || []) {
if (Glob.match(pattern, filepath)) return false
for (const glob of opts?.whitelist || []) {
if (glob.match(filepath)) return false
}
const parts = filepath.split(sep)
@@ -73,8 +74,8 @@ export namespace FileIgnore {
}
const extra = opts?.extra || []
for (const pattern of [...FILES, ...extra]) {
if (Glob.match(pattern, filepath)) return true
for (const glob of [...FILE_GLOBS, ...extra]) {
if (glob.match(filepath)) return true
}
return false