refactor: unwrap FileIgnore namespace + self-reexport (#22937)
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { Glob } from "@opencode-ai/shared/util/glob"
|
import { Glob } from "@opencode-ai/shared/util/glob"
|
||||||
|
|
||||||
export namespace FileIgnore {
|
const FOLDERS = new Set([
|
||||||
const FOLDERS = new Set([
|
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"bower_components",
|
"bower_components",
|
||||||
".pnpm-store",
|
".pnpm-store",
|
||||||
@@ -30,9 +29,9 @@ export namespace FileIgnore {
|
|||||||
"mypy_cache",
|
"mypy_cache",
|
||||||
".history",
|
".history",
|
||||||
".gradle",
|
".gradle",
|
||||||
])
|
])
|
||||||
|
|
||||||
const FILES = [
|
const FILES = [
|
||||||
"**/*.swp",
|
"**/*.swp",
|
||||||
"**/*.swo",
|
"**/*.swo",
|
||||||
|
|
||||||
@@ -51,17 +50,17 @@ export namespace FileIgnore {
|
|||||||
// Coverage/test outputs
|
// Coverage/test outputs
|
||||||
"**/coverage/**",
|
"**/coverage/**",
|
||||||
"**/.nyc_output/**",
|
"**/.nyc_output/**",
|
||||||
]
|
]
|
||||||
|
|
||||||
export const PATTERNS = [...FILES, ...FOLDERS]
|
export const PATTERNS = [...FILES, ...FOLDERS]
|
||||||
|
|
||||||
export function match(
|
export function match(
|
||||||
filepath: string,
|
filepath: string,
|
||||||
opts?: {
|
opts?: {
|
||||||
extra?: string[]
|
extra?: string[]
|
||||||
whitelist?: string[]
|
whitelist?: string[]
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
for (const pattern of opts?.whitelist || []) {
|
for (const pattern of opts?.whitelist || []) {
|
||||||
if (Glob.match(pattern, filepath)) return false
|
if (Glob.match(pattern, filepath)) return false
|
||||||
}
|
}
|
||||||
@@ -77,5 +76,6 @@ export namespace FileIgnore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * as FileIgnore from "./ignore"
|
||||||
|
|||||||
Reference in New Issue
Block a user