aboutsummaryrefslogtreecommitdiff
path: root/packages/astro-rss/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro-rss/src')
-rw-r--r--packages/astro-rss/src/index.ts18
-rw-r--r--packages/astro-rss/src/util.ts2
2 files changed, 10 insertions, 10 deletions
diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts
index 84cdad0d9..b84e81e73 100644
--- a/packages/astro-rss/src/index.ts
+++ b/packages/astro-rss/src/index.ts
@@ -73,8 +73,8 @@ const rssOptionsValidator = z.object({
// eslint-disable-next-line
console.warn(
yellow(
- '[RSS] Passing a glob result directly has been deprecated. Please migrate to the `pagesGlobToRssItems()` helper: https://docs.astro.build/en/guides/rss/'
- )
+ '[RSS] Passing a glob result directly has been deprecated. Please migrate to the `pagesGlobToRssItems()` helper: https://docs.astro.build/en/guides/rss/',
+ ),
);
return pagesGlobToRssItems(items);
}
@@ -123,7 +123,7 @@ async function validateRssOptions(rssOptions: RSSOptions) {
return message;
}),
- ].join('\n')
+ ].join('\n'),
);
throw formattedError;
}
@@ -134,7 +134,7 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed
const { url, frontmatter } = await getInfo();
if (url === undefined || url === null) {
throw new Error(
- `[RSS] You can only glob entries within 'src/pages/' when passing import.meta.glob() directly. Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`
+ `[RSS] You can only glob entries within 'src/pages/' when passing import.meta.glob() directly. Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`,
);
}
const parsedResult = rssSchema
@@ -151,11 +151,11 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed
[
`[RSS] ${filePath} has invalid or missing frontmatter.\nFix the following properties:`,
...parsedResult.error.errors.map((zodError) => zodError.message),
- ].join('\n')
+ ].join('\n'),
);
(formattedError as any).file = filePath;
throw formattedError;
- })
+ }),
);
}
@@ -207,7 +207,7 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
if (typeof rssOptions.customData === 'string')
Object.assign(
root.rss.channel,
- parser.parse(`<channel>${rssOptions.customData}</channel>`).channel
+ parser.parse(`<channel>${rssOptions.customData}</channel>`).channel,
);
// items
root.rss.channel.item = items.map((result) => {
@@ -250,7 +250,7 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
}
if (result.source) {
item.source = parser.parse(
- `<source url="${result.source.url}">${result.source.title}</source>`
+ `<source url="${result.source.url}">${result.source.title}</source>`,
).source;
}
if (result.enclosure) {
@@ -258,7 +258,7 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
? result.enclosure.url
: createCanonicalURL(result.enclosure.url, rssOptions.trailingSlash, site);
item.enclosure = parser.parse(
- `<enclosure url="${enclosureURL}" length="${result.enclosure.length}" type="${result.enclosure.type}"/>`
+ `<enclosure url="${enclosureURL}" length="${result.enclosure.length}" type="${result.enclosure.type}"/>`,
).enclosure;
}
return item;
diff --git a/packages/astro-rss/src/util.ts b/packages/astro-rss/src/util.ts
index a709d942d..43de370dd 100644
--- a/packages/astro-rss/src/util.ts
+++ b/packages/astro-rss/src/util.ts
@@ -5,7 +5,7 @@ import type { RSSOptions } from './index.js';
export function createCanonicalURL(
url: string,
trailingSlash?: RSSOptions['trailingSlash'],
- base?: string
+ base?: string,
): string {
let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical
if (!getUrlExtension(url)) {