[ci] yarn format

This commit is contained in:
jonathantneal 2022-01-19 20:36:00 +00:00 committed by GitHub Actions
parent 85ad1aab67
commit 18bb39f0d4
5 changed files with 10 additions and 9 deletions

View file

@ -370,7 +370,7 @@ export interface RSS {
export type RSSFunction = (args: RSS) => void; export type RSSFunction = (args: RSS) => void;
export type FeedResult = { url: string; content?: string; }; export type FeedResult = { url: string; content?: string };
export type RSSResult = { xml: FeedResult; xsl?: FeedResult }; export type RSSResult = { xml: FeedResult; xsl?: FeedResult };
export type SSRError = Error & vite.ErrorPayload['err']; export type SSRError = Error & vite.ErrorPayload['err'];

View file

@ -92,7 +92,9 @@ export async function collectPagesData(opts: CollectPagesDataOptions): Promise<C
const { url, content } = result.rss.xsl; const { url, content } = result.rss.xsl;
const stylesheetFile = new URL(url.replace(/^\/?/, './'), astroConfig.dist); const stylesheetFile = new URL(url.replace(/^\/?/, './'), astroConfig.dist);
if (assets[fileURLToPath(stylesheetFile)]) { if (assets[fileURLToPath(stylesheetFile)]) {
throw new Error(`[getStaticPaths] RSS feed stylesheet ${url} already exists.\nUse \`rss(data, {stylesheet: '...'})\` to choose a unique, custom URL. (${route.component})`); throw new Error(
`[getStaticPaths] RSS feed stylesheet ${url} already exists.\nUse \`rss(data, {stylesheet: '...'})\` to choose a unique, custom URL. (${route.component})`
);
} }
assets[fileURLToPath(stylesheetFile)] = content; assets[fileURLToPath(stylesheetFile)] = content;
} }

View file

@ -95,15 +95,15 @@ export function generateRssFunction(site: string | undefined, route: RouteData):
result.xsl = { result.xsl = {
url: rssData.stylesheet, url: rssData.stylesheet,
content: generateRSSStylesheet(), content: generateRSSStylesheet(),
} };
} else if (typeof rssData.stylesheet === 'string') { } else if (typeof rssData.stylesheet === 'string') {
result.xsl = { result.xsl = {
url: rssData.stylesheet, url: rssData.stylesheet,
} };
} }
result.xml = { result.xml = {
url: feedURL, url: feedURL,
content: generateRSS({ rssData, site, srcFile: route.component, feedURL }) content: generateRSS({ rssData, site, srcFile: route.component, feedURL }),
}; };
}, },
rss: result, rss: result,

View file

@ -83,7 +83,6 @@ export function viteID(filePath: URL): string {
return slash(fileURLToPath(filePath)); return slash(fileURLToPath(filePath));
} }
// Vendored from https://github.com/genmon/aboutfeeds/blob/main/tools/pretty-feed-v3.xsl // Vendored from https://github.com/genmon/aboutfeeds/blob/main/tools/pretty-feed-v3.xsl
/** Basic stylesheet for RSS feeds */ /** Basic stylesheet for RSS feeds */
export const PRETTY_FEED_V3 = `<?xml version="1.0" encoding="utf-8"?> export const PRETTY_FEED_V3 = `<?xml version="1.0" encoding="utf-8"?>