From 904921cbe44e168477c751774a2e01a6cc972a16 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 10 Jul 2023 20:39:32 +0800 Subject: [PATCH] Ignore content .json files prefixed with underscores (#7611) --- .changeset/funny-tomatoes-guess.md | 5 +++++ .../astro/src/content/vite-plugin-content-virtual-mod.ts | 4 ++-- .../src/content/with-schema-config/_ignore.md | 0 .../src/content/with-schema-config/_ignore/file.md | 0 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/funny-tomatoes-guess.md create mode 100644 packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore.md create mode 100644 packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore/file.md diff --git a/.changeset/funny-tomatoes-guess.md b/.changeset/funny-tomatoes-guess.md new file mode 100644 index 000000000..cd8b65b49 --- /dev/null +++ b/.changeset/funny-tomatoes-guess.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Ignore content .json files prefixed with underscores (regression) 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 62ba612e9..021a26314 100644 --- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts +++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts @@ -213,7 +213,7 @@ function globWithUnderscoresIgnored(relContentDir: string, exts: string[]): stri const contentDir = appendForwardSlash(relContentDir); return [ `${contentDir}**/*${extGlob}`, - `!${contentDir}_*/**${extGlob}`, - `!${contentDir}_*${extGlob}`, + `!${contentDir}**/_*/**${extGlob}`, + `!${contentDir}**/_*${extGlob}`, ]; } diff --git a/packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore.md b/packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore.md new file mode 100644 index 000000000..e69de29bb diff --git a/packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore/file.md b/packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore/file.md new file mode 100644 index 000000000..e69de29bb