fix: Installs underneath a path containing leading underscores (#7476)

This commit is contained in:
Rasso Hilber 2023-06-26 11:27:39 +02:00 committed by GitHub
parent c1564d3c02
commit 478cd9d8fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Allow astro to be installed underneath a folder with leading slashes

View file

@ -21,6 +21,7 @@ import {
type ContentLookupMap,
type ContentPaths,
} from './utils.js';
import { appendForwardSlash } from '../core/path.js';
interface AstroContentVirtualModPluginParams {
settings: AstroSettings;
@ -209,5 +210,6 @@ const UnexpectedLookupMapError = new AstroError({
function globWithUnderscoresIgnored(relContentDir: string, exts: string[]): string[] {
const extGlob = getExtGlob(exts);
return [`${relContentDir}/**/*${extGlob}`, `!**/_*/**${extGlob}`, `!**/_*${extGlob}`];
const contentDir = appendForwardSlash(relContentDir);
return [`${contentDir}**/*${extGlob}`, `!${contentDir}_*/**${extGlob}`, `!${contentDir}_*${extGlob}`];
}