diff options
author | 2023-06-26 11:27:39 +0200 | |
---|---|---|
committer | 2023-06-26 17:27:39 +0800 | |
commit | 478cd9d8fa9452466a73e0981863ef6e82f87238 (patch) | |
tree | c92b9a603fff5594a7ceb34e6592469c6ff13d63 | |
parent | c1564d3c029b295e2393822a6f0856d57cc89267 (diff) | |
download | astro-478cd9d8fa9452466a73e0981863ef6e82f87238.tar.gz astro-478cd9d8fa9452466a73e0981863ef6e82f87238.tar.zst astro-478cd9d8fa9452466a73e0981863ef6e82f87238.zip |
fix: Installs underneath a path containing leading underscores (#7476)
-rw-r--r-- | .changeset/flat-papayas-invite.md | 5 | ||||
-rw-r--r-- | packages/astro/src/content/vite-plugin-content-virtual-mod.ts | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/.changeset/flat-papayas-invite.md b/.changeset/flat-papayas-invite.md new file mode 100644 index 000000000..c8b1193d7 --- /dev/null +++ b/.changeset/flat-papayas-invite.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Allow astro to be installed underneath a folder with leading slashes diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts index ecda537e2..6ab920c4d 100644 --- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts +++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts @@ -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}`]; } |