From 7bc79e9db887a34ee4112fc002863372a05fb264 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Mon, 8 Jul 2024 18:45:34 +0100 Subject: [PATCH] Allow file URL for base dir --- packages/astro/src/content/loaders/glob.ts | 4 ++-- .../astro/test/fixtures/content-layer/src/content/config.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/astro/src/content/loaders/glob.ts b/packages/astro/src/content/loaders/glob.ts index 288046e85a7f..03d384c7aa35 100644 --- a/packages/astro/src/content/loaders/glob.ts +++ b/packages/astro/src/content/loaders/glob.ts @@ -21,8 +21,8 @@ export interface GenerateIdOptions { export interface GlobOptions { /** The glob pattern to match files, relative to the base directory */ pattern: string; - /** The base directory to resolve the glob pattern from, relative to the root directory. Defaults to `.` */ - base?: string; + /** The base directory to resolve the glob pattern from. Relative to the root directory, or an absolute file URL. Defaults to `.` */ + base?: string | URL; /** * Function that generates an ID for an entry. Default implementation generates a slug from the entry path. * @returns The ID of the entry. Must be unique per collection. diff --git a/packages/astro/test/fixtures/content-layer/src/content/config.ts b/packages/astro/test/fixtures/content-layer/src/content/config.ts index 360331b8ec5d..49d9d6f4a2b5 100644 --- a/packages/astro/test/fixtures/content-layer/src/content/config.ts +++ b/packages/astro/test/fixtures/content-layer/src/content/config.ts @@ -71,7 +71,7 @@ const cats = defineCollection({ // Absolute paths should also work -const absoluteRoot = new URL('../../content-outside-src', import.meta.url).href; +const absoluteRoot = new URL('../../content-outside-src', import.meta.url); const spacecraft = defineCollection({ type: 'experimental_data',