mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(kit): ignore negation when resolving ignore patterns
This commit is contained in:
parent
468ebbdf0b
commit
e105fadd7e
@ -28,6 +28,8 @@ export function isIgnored (pathname: string): boolean {
|
|||||||
return !!(relativePath && nuxt._ignore.ignores(relativePath))
|
return !!(relativePath && nuxt._ignore.ignores(relativePath))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NEGATION_RE = /^(!?)(.*)$/
|
||||||
|
|
||||||
export function resolveIgnorePatterns (relativePath?: string): string[] {
|
export function resolveIgnorePatterns (relativePath?: string): string[] {
|
||||||
const nuxt = tryUseNuxt()
|
const nuxt = tryUseNuxt()
|
||||||
|
|
||||||
@ -48,7 +50,13 @@ export function resolveIgnorePatterns (relativePath?: string): string[] {
|
|||||||
|
|
||||||
if (relativePath) {
|
if (relativePath) {
|
||||||
// Map ignore patterns based on if they start with * or !*
|
// Map ignore patterns based on if they start with * or !*
|
||||||
return nuxt._ignorePatterns.map(p => p[0] === '*' || (p[0] === '!' && p[1] === '*') ? p : relative(relativePath, resolve(nuxt.options.rootDir, p)))
|
return nuxt._ignorePatterns.map(p => {
|
||||||
|
const [_, negation = '', pattern] = p.match(NEGATION_RE) || []
|
||||||
|
if (pattern[0] === '*') {
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
return negation + relative(relativePath, resolve(nuxt.options.rootDir, pattern || p))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return nuxt._ignorePatterns
|
return nuxt._ignorePatterns
|
||||||
|
Loading…
Reference in New Issue
Block a user