From 4266ecd1acb9e245632f4a4d0bfd270a0dd2f3f9 Mon Sep 17 00:00:00 2001 From: Christine Tham Date: Fri, 27 Jan 2023 19:34:12 +1100 Subject: [PATCH] Migrated to Astro collections! --- .gitignore | 2 + README.md | 11 ++- package.json | 6 +- src/components/blogcard.astro | 35 ++++---- src/components/bloghero.astro | 2 +- src/components/blogroll.astro | 5 +- src/components/hero.astro | 12 ++- src/components/latestarticles.astro | 63 +++++++-------- src/components/paginatecontrol.astro | 6 +- src/components/seo.astro | 2 +- src/config.ts | 43 +++++----- .../blog/2000-01-01-template.md | 0 .../blog/2022-08-09-mit-licence.md | 0 .../blog/2022-08-10-markdown-cheat-sheet.md | 0 .../blog/2022-08-19-sample-carousel.mdx | 0 .../blog/2022-08-20-mermaid-diagrams.md | 0 .../blog/2022-08-21-sample-gallery-post.mdx | 0 .../blog/2022-08-23-sample-mdx-post.mdx | 0 .../blog/2022-08-24-math-equations.md | 0 .../blog/2022-08-25-plantuml-diagrams.md | 0 .../blog/2022-08-26-markmap-diagrams.md | 0 .../blog/2022-08-27-how-to-use.md | 0 .../blog/2023-01-26-roadmap.md} | 2 - src/content/config.ts | 45 +++++++++++ src/{pages => content}/doc/introduction.md | 0 src/{pages => content}/doc/page-2.md | 0 src/{pages => content}/doc/page-3.md | 0 src/{pages => content}/doc/page-4.md | 0 src/env.d.ts | 1 + src/pages/about.md | 11 ++- src/pages/author/[author]/[...page].astro | 22 ++--- src/pages/authors.astro | 20 ++--- src/pages/blog/[...page].astro | 18 ++--- src/pages/blog/[slug].astro | 14 ++++ src/pages/carousel.astro | 14 +--- src/pages/categories.astro | 16 +--- src/pages/category/[category]/[...page].astro | 22 ++--- src/pages/doc/[slug].astro | 14 ++++ src/pages/index.astro | 14 +--- src/pages/rss.xml.js | 22 ++--- src/pages/search-docs.json.js | 19 ++--- src/pages/search-index.json.js | 18 ++--- src/pages/tag/[tag]/[...page].astro | 22 ++--- src/pages/tags.astro | 18 ++--- yarn.lock | 80 +++++++++++-------- 45 files changed, 312 insertions(+), 267 deletions(-) rename src/{pages => content}/blog/2000-01-01-template.md (100%) rename src/{pages => content}/blog/2022-08-09-mit-licence.md (100%) rename src/{pages => content}/blog/2022-08-10-markdown-cheat-sheet.md (100%) rename src/{pages => content}/blog/2022-08-19-sample-carousel.mdx (100%) rename src/{pages => content}/blog/2022-08-20-mermaid-diagrams.md (100%) rename src/{pages => content}/blog/2022-08-21-sample-gallery-post.mdx (100%) rename src/{pages => content}/blog/2022-08-23-sample-mdx-post.mdx (100%) rename src/{pages => content}/blog/2022-08-24-math-equations.md (100%) rename src/{pages => content}/blog/2022-08-25-plantuml-diagrams.md (100%) rename src/{pages => content}/blog/2022-08-26-markmap-diagrams.md (100%) rename src/{pages => content}/blog/2022-08-27-how-to-use.md (100%) rename src/{pages/blog/2022-08-28-roadmap.md => content/blog/2023-01-26-roadmap.md} (89%) create mode 100644 src/content/config.ts rename src/{pages => content}/doc/introduction.md (100%) rename src/{pages => content}/doc/page-2.md (100%) rename src/{pages => content}/doc/page-3.md (100%) rename src/{pages => content}/doc/page-4.md (100%) create mode 100644 src/pages/blog/[slug].astro create mode 100644 src/pages/doc/[slug].astro diff --git a/.gitignore b/.gitignore index 7329a85..c57f8b6 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ pnpm-debug.log* # macOS-specific files .DS_Store + +.astro diff --git a/README.md b/README.md index 5373d4c..6c97a03 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # hello-astro -Hello Astro is a full featured [Astro](https://astro.build) corporate/marketing/blog starter theme written in Typescript and TailwindCSS. It supports Markdown and MDX based pages and blog posts. +Hello Astro is a full featured [Astro](https://astro.build) multi-purpose starter theme written in Typescript and TailwindCSS. It supports Markdown and MDX based pages and blog posts. ![Light](https://github.com/hellotham/hello-astro/raw/main/screenshot-light.png) @@ -8,6 +8,13 @@ Hello Astro is a full featured [Astro](https://astro.build) corporate/marketing/ ![Lighthouse](https://github.com/hellotham/hello-astro/raw/main/lighthouse.png) +Hello Astro can used for any/all of the following: + +- corporate/marketing site +- blog +- documentation site +- portfolio site supporting photo galleries + Uses the following integrations: - @astrojs/mdx @@ -125,3 +132,5 @@ All commands are run from the root of the project, from a terminal: - 1.0.1: Moved social images to src, improved coverImage processing - 1.0.2: Upgrade packages to latest - 1.1.0: Update to astro v2.x, now works with node 18 and 19 +- 2.0.0: New version supporting Astro collections! Also clarified that this is a + multipurpose theme. Search can now include both Markdown and MDX pages! diff --git a/package.json b/package.json index 0daf318..58f524a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@akebifiky/remark-simple-plantuml": "^1.0.2", "@astrojs/alpinejs": "^0.1.2", "@astrojs/image": "^0.13.0", - "@astrojs/mdx": "^0.15.0", + "@astrojs/mdx": "^0.15.1", "@astrojs/sitemap": "^1.0.0", "@astrojs/tailwind": "^3.0.0", "@tailwindcss/aspect-ratio": "^0.4.2", @@ -25,11 +25,11 @@ "@types/alpinejs": "^3.7.1", "@types/leaflet": "^1.9.0", "alpinejs": "^3.11.1", - "astro": "2.0.1", + "astro": "2.0.2", "astro-robots-txt": "^0.3.11", "exifr": "^7.1.3", "mdast-util-to-string": "^3.1.1", - "prettier-plugin-astro": "^0.7.2", + "prettier-plugin-astro": "^0.8.0", "reading-time": "^1.5.0", "rehype-katex": "^6.0.2", "remark-math": "^5.1.1", diff --git a/src/components/blogcard.astro b/src/components/blogcard.astro index 38c516d..6b75fcb 100644 --- a/src/components/blogcard.astro +++ b/src/components/blogcard.astro @@ -1,7 +1,6 @@ --- +import type { CollectionEntry } from 'astro:content' import { Icon } from 'astro-icon' -import type { MarkdownInstance } from 'astro' -import type { Frontmatter } from '../config' import { categoryDetail } from '../config' import SVGImg from '../components/svgimg.astro' import Img from '../components/img.astro' @@ -9,44 +8,44 @@ import Categories from '../components/categories.astro' import Tags from '../components/tags.astro' export interface Props { - post: MarkdownInstance + post: CollectionEntry<'blog'> } const { post } = Astro.props -const image = post.frontmatter.coverImage || post.frontmatter.socialImage || categoryDetail(post.frontmatter.categories && post.frontmatter.categories[0]).socialImage -const svgimg = post.frontmatter.coverSVG || (post.frontmatter.coverImage ? null : categoryDetail(post.frontmatter.categories && post.frontmatter.categories[0]).coverSVG) +const image = post.data.coverImage || post.data.socialImage || categoryDetail(post.data.categories && post.data.categories[0]).socialImage +const svgimg = post.data.coverSVG || (post.data.coverImage ? null : categoryDetail(post.data.categories && post.data.categories[0]).coverSVG) ---
- + { svgimg ? ( ) : ( {post.frontmatter.title ) } -

{post.frontmatter.title}

+

{post.data.title}

- - + +

- {post.frontmatter.title} + {post.data.title}

@@ -54,15 +53,15 @@ const svgimg = post.frontmatter.coverSVG || (post.frontmatter.coverImage ? null class="text-gray-500 dark:text-gray-400 mr-3 inline-flex items-center leading-none text-xs pr-3 py-1 border-r-2 border-purple-200 dark:border-purple-600" > - {post.frontmatter.publishDate?.slice(0, 10)} + {post.data.publishDate?.toString().slice(0, 10)} - {post.frontmatter.minutesRead} + {post.data.minutesRead} - {post.frontmatter.author && ( + {post.data.author && ( @@ -71,15 +70,15 @@ const svgimg = post.frontmatter.coverSVG || (post.frontmatter.coverImage ? null pack="heroicons-outline" name="user-circle" /> - {post.frontmatter.author} + {post.data.author} )}

- {post.frontmatter.description} + {post.data.description}

- +
diff --git a/src/components/bloghero.astro b/src/components/bloghero.astro index c69f4d5..8613b2f 100644 --- a/src/components/bloghero.astro +++ b/src/components/bloghero.astro @@ -61,7 +61,7 @@ const svgimg = frontmatter.coverSVG || (frontmatter.coverImage ? null : category - {frontmatter.publishDate?.slice(0, 10)} + {frontmatter.publishDate?.toString().slice(0, 10)} diff --git a/src/components/blogroll.astro b/src/components/blogroll.astro index 49bbab4..ce3507f 100644 --- a/src/components/blogroll.astro +++ b/src/components/blogroll.astro @@ -1,10 +1,9 @@ --- -import type { MarkdownInstance } from 'astro' -import type { Frontmatter } from '../config' +import type { CollectionEntry } from 'astro:content' import BlogCard from '../components/blogcard.astro' export interface Props { - posts: MarkdownInstance[] + posts: CollectionEntry<'blog'>[] } const { posts } = Astro.props diff --git a/src/components/hero.astro b/src/components/hero.astro index 18e8f86..04a0c51 100644 --- a/src/components/hero.astro +++ b/src/components/hero.astro @@ -32,9 +32,15 @@ import { FeaturedSVG } from '../config'

- Hello Astro is a full featured corporate/marketing/blog starter - theme written in Typescript, TailwindCSS and Astro. It supports - Markdown and MDX based pages and blog posts (including math and diagrams), plus full text search on blog pages. + Hello Astro is a multi-purpose starter + theme written in Typescript, TailwindCSS, AlpineJS and Astro. It supports + Markdown and MDX based pages, documentation pages and blog posts (including math and diagrams), plus full text search. +

+

+ Hello Astro can be used for creating corporate/marketing sites, blogs, documentation sites, portfolio sites (supporting photo + galleries) or any combination of the above!

[] + posts: CollectionEntry<'blog'>[] } const { posts } = Astro.props @@ -49,22 +48,22 @@ const otherPosts = posts.slice(1, 5)

- - {newestPost.frontmatter.title} + + {newestPost.data.title} { - newestPost.frontmatter.coverSVG ? ( + newestPost.data.coverSVG ? ( ) : ( {newestPost.frontmatter.title ) @@ -72,68 +71,68 @@ const otherPosts = posts.slice(1, 5)
{ - newestPost.frontmatter.categories && ( - + newestPost.data.categories && ( + ) }
- +

- {newestPost.frontmatter.title} + {newestPost.data.title}

- {newestPost.frontmatter.publishDate?.slice(0, 10)} + {newestPost.data.publishDate?.toISOString().slice(0, 10)}

- {newestPost.frontmatter.description} + {newestPost.data.description}

Read more - {newestPost.frontmatter.title} + {newestPost.data.title}
{ otherPosts.map(post => (
- - {post.frontmatter.coverSVG ? ( + + {post.data.coverSVG ? ( ) : ( {post.frontmatter.title )}
- {post.frontmatter.categories && ( - + {post.data.categories && ( + )} - +
- {post.frontmatter.title} + {post.data.title}

- {post.frontmatter.publishDate?.slice(0, 10)} + {post.data.publishDate?.toISOString().slice(0, 10)}

- {post.frontmatter.description} + {post.data.description}

diff --git a/src/components/paginatecontrol.astro b/src/components/paginatecontrol.astro index c2472b0..ea7757f 100644 --- a/src/components/paginatecontrol.astro +++ b/src/components/paginatecontrol.astro @@ -1,10 +1,10 @@ --- import { Icon } from 'astro-icon' -import type { MarkdownInstance, Page } from 'astro' -import type { Frontmatter } from '../config' +import type { CollectionEntry } from 'astro:content' +import type { Page } from 'astro' export interface Props { - page: Page> + page: Page> } // const { id } = Astro.params diff --git a/src/components/seo.astro b/src/components/seo.astro index 3672e1b..f3f2c80 100644 --- a/src/components/seo.astro +++ b/src/components/seo.astro @@ -19,7 +19,7 @@ const { frontmatter } = Astro.props const siteurl = new URL(import.meta.env.BASE_URL, Astro.url) const type = Astro.url.toString().includes('blog') ? 'post' : 'page' -const year = parseInt(SiteMetadata.buildTime.slice(0, 4)) +const year = parseInt(SiteMetadata.buildTime.toString().slice(0, 4)) const images = import.meta.glob('../images/**/*', { import: 'default' }) const image = await images[frontmatter.socialImage || frontmatter.coverImage || DefaultImage]() const logo = await images[LogoImage]() diff --git a/src/config.ts b/src/config.ts index 00f77cd..a3162a3 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,27 +1,30 @@ import type { MarkdownInstance } from 'astro' - -export interface Frontmatter { - draft?: boolean - title: string - description?: string - author?: string - publishDate: string - coverSVG?: string - coverImage?: string - socialImage?: string - categories?: string[] - tags?: string[] - file?: string - url?: string - minutesRead?: string - extra?: string[] - section?: string[] -} +import type { CollectionEntry } from 'astro:content' + +export type Frontmatter = CollectionEntry<'blog'>['data'] + +// export interface Frontmatter { +// draft?: boolean +// title: string +// description?: string +// author?: string +// publishDate: string +// coverSVG?: string +// coverImage?: string +// socialImage?: string +// categories?: string[] +// tags?: string[] +// file?: string +// url?: string +// minutesRead?: string +// extra?: string[] +// section?: string[] +// } export interface TagType { tag: string count: number - pages: MarkdownInstance[] + pages: CollectionEntry<'blog'>[] } export const SiteMetadata = { @@ -82,7 +85,7 @@ export const SiteMetadata = { icon: 'github', }, ], - buildTime: new Date().toString(), + buildTime: new Date(), } export const Logo = '../svg/astro/logomark-light.svg' diff --git a/src/pages/blog/2000-01-01-template.md b/src/content/blog/2000-01-01-template.md similarity index 100% rename from src/pages/blog/2000-01-01-template.md rename to src/content/blog/2000-01-01-template.md diff --git a/src/pages/blog/2022-08-09-mit-licence.md b/src/content/blog/2022-08-09-mit-licence.md similarity index 100% rename from src/pages/blog/2022-08-09-mit-licence.md rename to src/content/blog/2022-08-09-mit-licence.md diff --git a/src/pages/blog/2022-08-10-markdown-cheat-sheet.md b/src/content/blog/2022-08-10-markdown-cheat-sheet.md similarity index 100% rename from src/pages/blog/2022-08-10-markdown-cheat-sheet.md rename to src/content/blog/2022-08-10-markdown-cheat-sheet.md diff --git a/src/pages/blog/2022-08-19-sample-carousel.mdx b/src/content/blog/2022-08-19-sample-carousel.mdx similarity index 100% rename from src/pages/blog/2022-08-19-sample-carousel.mdx rename to src/content/blog/2022-08-19-sample-carousel.mdx diff --git a/src/pages/blog/2022-08-20-mermaid-diagrams.md b/src/content/blog/2022-08-20-mermaid-diagrams.md similarity index 100% rename from src/pages/blog/2022-08-20-mermaid-diagrams.md rename to src/content/blog/2022-08-20-mermaid-diagrams.md diff --git a/src/pages/blog/2022-08-21-sample-gallery-post.mdx b/src/content/blog/2022-08-21-sample-gallery-post.mdx similarity index 100% rename from src/pages/blog/2022-08-21-sample-gallery-post.mdx rename to src/content/blog/2022-08-21-sample-gallery-post.mdx diff --git a/src/pages/blog/2022-08-23-sample-mdx-post.mdx b/src/content/blog/2022-08-23-sample-mdx-post.mdx similarity index 100% rename from src/pages/blog/2022-08-23-sample-mdx-post.mdx rename to src/content/blog/2022-08-23-sample-mdx-post.mdx diff --git a/src/pages/blog/2022-08-24-math-equations.md b/src/content/blog/2022-08-24-math-equations.md similarity index 100% rename from src/pages/blog/2022-08-24-math-equations.md rename to src/content/blog/2022-08-24-math-equations.md diff --git a/src/pages/blog/2022-08-25-plantuml-diagrams.md b/src/content/blog/2022-08-25-plantuml-diagrams.md similarity index 100% rename from src/pages/blog/2022-08-25-plantuml-diagrams.md rename to src/content/blog/2022-08-25-plantuml-diagrams.md diff --git a/src/pages/blog/2022-08-26-markmap-diagrams.md b/src/content/blog/2022-08-26-markmap-diagrams.md similarity index 100% rename from src/pages/blog/2022-08-26-markmap-diagrams.md rename to src/content/blog/2022-08-26-markmap-diagrams.md diff --git a/src/pages/blog/2022-08-27-how-to-use.md b/src/content/blog/2022-08-27-how-to-use.md similarity index 100% rename from src/pages/blog/2022-08-27-how-to-use.md rename to src/content/blog/2022-08-27-how-to-use.md diff --git a/src/pages/blog/2022-08-28-roadmap.md b/src/content/blog/2023-01-26-roadmap.md similarity index 89% rename from src/pages/blog/2022-08-28-roadmap.md rename to src/content/blog/2023-01-26-roadmap.md index 67e0279..ff8b70e 100644 --- a/src/pages/blog/2022-08-28-roadmap.md +++ b/src/content/blog/2023-01-26-roadmap.md @@ -17,10 +17,8 @@ tags: The following are some potential features that are being considered as enhancements to this starter. Please consider [sponsoring](https://github.com/sponsors/hellotham) us if these features are important to you and you would like them to be implemented sooner. Alternately, if you want to implement any of these features, please let us know and we will be happy to support you! - Automatic optimization of images in Markdown/MDX posts -- Use Astro collections Current issues: -- MDX content currently not included in search as it does not support rawContent property. - Better support for Mermaid (awaiting possible official integration by Astro) - Should really use load Mermaid and Markmap scripts from packages rather than external CDN. diff --git a/src/content/config.ts b/src/content/config.ts new file mode 100644 index 0000000..4af0476 --- /dev/null +++ b/src/content/config.ts @@ -0,0 +1,45 @@ +// 1. Import your utilities and schemas +import { z, defineCollection } from 'astro:content' + +// 2. Define your collections +const blogCollection = defineCollection({ + schema: z.object({ + draft: z.boolean().optional(), + layout: z.string().optional(), + title: z.string(), + description: z.string(), + author: z.string().optional(), + publishDate: z.date(), + // publishDate: z.string().datetime({ offset: true }), + // publishDate: z.string().transform((str: string) => new Date(str)), + // publishDate: z.string().transform((str: string | Date) => new Date(str)), + coverSVG: z.string().optional(), + coverImage: z.string().optional(), + socialImage: z.string().optional(), + images: z.array(z.string()).optional(), + gallery: z.string().optional(), + categories: z.array(z.string()).optional(), + tags: z.array(z.string()).optional(), + extra: z.array(z.enum(["math", "markmap", "mermaid", "gallery"])).optional(), + minutesRead: z.string().optional(), + }), + }) + +const docCollection = defineCollection({ + schema: z.object({ + draft: z.boolean().optional(), + layout: z.string(), + section: z.string(), + weight: z.number().optional(), + title: z.string(), + description: z.string(), + images: z.array(z.string()).optional(), + gallery: z.string().optional(), + }), + }) + +// 3. Export multiple collections to register them +export const collections = { + 'blog': blogCollection, + 'doc': docCollection, +} diff --git a/src/pages/doc/introduction.md b/src/content/doc/introduction.md similarity index 100% rename from src/pages/doc/introduction.md rename to src/content/doc/introduction.md diff --git a/src/pages/doc/page-2.md b/src/content/doc/page-2.md similarity index 100% rename from src/pages/doc/page-2.md rename to src/content/doc/page-2.md diff --git a/src/pages/doc/page-3.md b/src/content/doc/page-3.md similarity index 100% rename from src/pages/doc/page-3.md rename to src/content/doc/page-3.md diff --git a/src/pages/doc/page-4.md b/src/content/doc/page-4.md similarity index 100% rename from src/pages/doc/page-4.md rename to src/content/doc/page-4.md diff --git a/src/env.d.ts b/src/env.d.ts index 3d93245..5305be0 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1,3 +1,4 @@ +/// /// declare module 'hero-patterns' declare module 'lunr' diff --git a/src/pages/about.md b/src/pages/about.md index 402f1f2..7dec2be 100644 --- a/src/pages/about.md +++ b/src/pages/about.md @@ -7,7 +7,7 @@ coverSVG: ../svg/undraw/undraw_about_me.svg socialImage: ../images/undraw/undraw_about_me.png --- -This is starter template for a full featured marketing and blog website based on the following: +This is multi-purpose Astro starter template based on the following: - [Astro](https://astro.build/) as a modern static site generator - [TypeScript](https://www.typescriptlang.org/) @@ -31,7 +31,14 @@ This is starter template for a full featured marketing and blog website based on It follows the [JAMstack architecture](https://jamstack.org) by automatically building a static version from the Git repository. The demo is deployed on Github Pages. -This website is open source (MIT licence) - fork it and customise for your needs. +Hello Astro can used for any/all of the following: + +- corporate/marketing site +- blog +- documentation site +- portfolio site supporting photo galleries + +This starter is open source (MIT licence) - fork it and customise for your needs. ## Features diff --git a/src/pages/author/[author]/[...page].astro b/src/pages/author/[author]/[...page].astro index 32626da..0a67175 100644 --- a/src/pages/author/[author]/[...page].astro +++ b/src/pages/author/[author]/[...page].astro @@ -1,6 +1,8 @@ --- -import type { MarkdownInstance, PaginateFunction, Page } from 'astro' +import type { PaginateFunction, Page } from 'astro' +import type { CollectionEntry } from 'astro:content' import { Frontmatter , SiteMetadata, authorDetail, PAGE_SIZE } from '../../../config' +import { getCollection } from 'astro:content' import Base from '../../../layouts/base.astro' import Img from '../../../components/img.astro' import PageHero from '../../../components/pagehero.astro' @@ -8,7 +10,7 @@ import BlogRoll from '../../../components/blogroll.astro' import PaginateControl from '../../../components/paginatecontrol.astro' export interface Props { - page: Page> + page: Page> } const { author } = Astro.params @@ -33,21 +35,13 @@ const frontmatter: Frontmatter = { } export async function getStaticPaths({ paginate }: { paginate: PaginateFunction }) { - const allPosts = (await Astro.glob( - '../../blog/*.{md,mdx}' - )) as MarkdownInstance[] - const posts = allPosts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) + const allPosts = await getCollection('blog') + const posts = allPosts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) - const authors = Array.from(new Set(posts.flatMap(post => post.frontmatter.author))) + const authors = Array.from(new Set(posts.flatMap(post => post.data.author))) return authors.map(author => { - return paginate(posts.filter(post => author && post.frontmatter.author?.includes(author)), { + return paginate(posts.filter(post => author && post.data.author?.includes(author)), { params: { author }, pageSize: PAGE_SIZE }) diff --git a/src/pages/authors.astro b/src/pages/authors.astro index 3fb98e7..0f21fa3 100644 --- a/src/pages/authors.astro +++ b/src/pages/authors.astro @@ -1,7 +1,7 @@ --- -import type { MarkdownInstance } from 'astro' +import { getCollection } from 'astro:content' import type { Frontmatter } from '../config' -import { authorDetail } from '../config' +import { authorDetail, SiteMetadata } from '../config' import Base from '../layouts/base.astro' import PageHero from '../components/pagehero.astro' import Img from '../components/img.astro' @@ -11,21 +11,13 @@ const frontmatter: Frontmatter = { description: 'Contributors to this website', coverSVG: '../svg/undraw/undraw_windows.svg', socialImage: '../images/undraw/undraw_windows.png', - publishDate: '2022-08-08T00:00:00.000Z', + publishDate: SiteMetadata.buildTime, } -const allPosts = (await Astro.glob( - './blog/*.{md,mdx}' -)) as MarkdownInstance[] -const posts = allPosts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) +const posts = await getCollection('blog') +const latestPosts = posts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) -const authors = Array.from(new Set(posts.flatMap(post => post.frontmatter.author))) +const authors = Array.from(new Set(latestPosts.flatMap(post => post.data.author))) --- diff --git a/src/pages/blog/[...page].astro b/src/pages/blog/[...page].astro index 88b4031..af0314a 100644 --- a/src/pages/blog/[...page].astro +++ b/src/pages/blog/[...page].astro @@ -1,6 +1,8 @@ --- -import type { MarkdownInstance, Page, PaginateFunction } from 'astro' +import type { Page, PaginateFunction } from 'astro' +import type { CollectionEntry } from 'astro:content' import type { Frontmatter } from '../../config' +import { getCollection } from 'astro:content' import { SiteMetadata, PAGE_SIZE } from '../../config' import Base from '../../layouts/base.astro' import PageHero from '../../components/pagehero.astro' @@ -8,7 +10,7 @@ import BlogRoll from '../../components/blogroll.astro' import PaginateControl from '../../components/paginatecontrol.astro' export interface Props { - page: Page> + page: Page> } const { page } = Astro.props @@ -29,16 +31,8 @@ const frontmatter: Frontmatter = { } export async function getStaticPaths({ paginate }: { paginate: PaginateFunction }) { - const allPosts = (await Astro.glob>( - '../blog/**/*.{md,mdx}' - )) - const posts = allPosts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) + const allPosts = await getCollection('blog') + const posts = allPosts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) return paginate(posts, { pageSize: PAGE_SIZE }) } diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro new file mode 100644 index 0000000..0d9f9d4 --- /dev/null +++ b/src/pages/blog/[slug].astro @@ -0,0 +1,14 @@ +--- +import { getCollection } from 'astro:content' +// 1. Generate a new path for every collection entry +export async function getStaticPaths() { + const blogEntries = await getCollection('blog') + return blogEntries.map(entry => ({ + params: { slug: entry.slug }, props: { entry }, + })) +} +// 2. When its time to render, you can get the entry directly from the prop +const { entry } = Astro.props; +const { Content } = await entry.render() +--- + \ No newline at end of file diff --git a/src/pages/carousel.astro b/src/pages/carousel.astro index 319fc69..2dead3a 100644 --- a/src/pages/carousel.astro +++ b/src/pages/carousel.astro @@ -1,5 +1,5 @@ --- -import type { MarkdownInstance } from 'astro' +import { getCollection } from 'astro:content' import type { Frontmatter } from '../config' import { SiteMetadata } from '../config' import Base from '../layouts/base.astro' @@ -24,16 +24,8 @@ const carouselPages = [ { name: 'Oberon Dam', image: '../images/gallery/carousel/Oberon-Dam.jpeg' }, ] -const posts = (await Astro.glob( - './blog/**/*.{md,mdx}' -)) as MarkdownInstance[] -const latestPosts = posts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) +const posts = await getCollection('blog') +const latestPosts = posts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) --- diff --git a/src/pages/categories.astro b/src/pages/categories.astro index b00c40a..4e2b42d 100644 --- a/src/pages/categories.astro +++ b/src/pages/categories.astro @@ -1,5 +1,5 @@ --- -import type { MarkdownInstance } from 'astro' +import { getCollection } from 'astro:content' import type { Frontmatter } from '../config' import { categoryDetail, SiteMetadata } from '../config' import Base from '../layouts/base.astro' @@ -14,18 +14,10 @@ const frontmatter: Frontmatter = { publishDate: SiteMetadata.buildTime, } -const allPosts = (await Astro.glob( - './blog/*.{md,mdx}' -)) as MarkdownInstance[] -const posts = allPosts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) +const posts = await getCollection('blog') +const latestPosts = posts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) -const categories = Array.from(new Set(posts.flatMap(post => post.frontmatter.categories))) +const categories = Array.from(new Set(latestPosts.flatMap(post => post.data.categories))) --- diff --git a/src/pages/category/[category]/[...page].astro b/src/pages/category/[category]/[...page].astro index 1f1383b..74d393d 100644 --- a/src/pages/category/[category]/[...page].astro +++ b/src/pages/category/[category]/[...page].astro @@ -1,6 +1,8 @@ --- -import type { MarkdownInstance, PaginateFunction, Page } from 'astro' +import type { PaginateFunction, Page } from 'astro' +import type { CollectionEntry } from 'astro:content' import type { Frontmatter } from '../../../config' +import { getCollection } from 'astro:content' import { SiteMetadata, categoryDetail, PAGE_SIZE } from '../../../config' import Base from '../../../layouts/base.astro' import PageHero from '../../../components/pagehero.astro' @@ -8,7 +10,7 @@ import BlogRoll from '../../../components/blogroll.astro' import PaginateControl from '../../../components/paginatecontrol.astro' export interface Props { - page: Page> + page: Page> } const { category } = Astro.params @@ -33,21 +35,13 @@ const frontmatter: Frontmatter = { } export async function getStaticPaths({ paginate }: { paginate: PaginateFunction }) { - const allPosts = (await Astro.glob( - '../../blog/*.{md,mdx}' - )) as MarkdownInstance[] - const posts = allPosts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) + const allPosts = await getCollection('blog') + const posts = allPosts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) - const categories = Array.from(new Set(posts.flatMap(post => post.frontmatter.categories))) + const categories = Array.from(new Set(posts.flatMap(post => post.data.categories))) return categories.map(category => { - return paginate(posts.filter(post => category && post.frontmatter.categories?.includes(category)), { + return paginate(posts.filter(post => category && post.data.categories?.includes(category)), { params: { category }, pageSize: PAGE_SIZE }) diff --git a/src/pages/doc/[slug].astro b/src/pages/doc/[slug].astro new file mode 100644 index 0000000..f78d376 --- /dev/null +++ b/src/pages/doc/[slug].astro @@ -0,0 +1,14 @@ +--- +import { getCollection } from 'astro:content'; +// 1. Generate a new path for every collection entry +export async function getStaticPaths() { + const docEntries = await getCollection('doc'); + return docEntries.map(entry => ({ + params: { slug: entry.slug }, props: { entry }, + })); +} +// 2. When its time to render, you can get the entry directly from the prop +const { entry } = Astro.props; +const { Content } = await entry.render(); +--- + \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 9e4d41b..a0f890f 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,5 +1,5 @@ --- -import type { MarkdownInstance } from 'astro' +import { getCollection } from 'astro:content' import type { Frontmatter } from '../config' import { SiteMetadata } from '../config' import Base from '../layouts/base.astro' @@ -17,16 +17,8 @@ const frontmatter: Frontmatter = { publishDate: SiteMetadata.buildTime, } -const posts = (await Astro.glob( - './blog/**/*.{md,mdx}' -)) as MarkdownInstance[] -const latestPosts = posts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) +const posts = await getCollection('blog') +const latestPosts = posts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) --- diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index e230607..08e3f6e 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -1,11 +1,10 @@ import rss from '@astrojs/rss' +import { getCollection } from 'astro:content' import { SiteMetadata } from '../config' -const postImportResult = import.meta.glob('./blog/*.{md,mdx}', { eager: true }) -const posts = Object.values(postImportResult) - -export const get = () => - rss({ +export async function get() { + const posts = await getCollection('blog') + return rss({ // `` field in output xml title: SiteMetadata.title, // `<description>` field in output xml @@ -15,13 +14,14 @@ export const get = () => site: import.meta.env.SITE, // list of `<item>`s in output xml // simple example: generate items for every md file in /src/pages - // see "Generating items" section for required frontmatter and advanced use cases - items: posts.map(post => ({ - link: post.url, - title: post.frontmatter.title, - description: post.frontmatter.description, - pubDate: post.frontmatter.publishDate, + // see "Generating items" section for required data and advanced use cases + items: posts.filter(post => !post.data.draft).map(post => ({ + link: import.meta.env.BASE_URL + '/blog/' + post.slug, + title: post.data.title, + description: post.data.description, + pubDate: post.data.publishDate.toString(), })), // (optional) inject custom xml customData: `<language>en</language>`, }) +} diff --git a/src/pages/search-docs.json.js b/src/pages/search-docs.json.js index 587722e..04a105a 100644 --- a/src/pages/search-docs.json.js +++ b/src/pages/search-docs.json.js @@ -1,13 +1,14 @@ -const postImportResult = import.meta.glob('./**/*.{md,mdx}', { eager: true }) -const posts = Object.values(postImportResult).filter(post => !post.frontmatter.draft) +import { getCollection } from 'astro:content' + +const posts = await getCollection('blog', (p) => { return !p.data.draft}) const documents = posts.map(post => ({ - url: post.url, - title: post.frontmatter.title, - description: post.frontmatter.description, - author: post.frontmatter.author, - publishDate: post.frontmatter.publishDate, - categories: post.frontmatter.categories, - tags: post.frontmatter.tags, + url: import.meta.env.BASE_URL + '/blog/' + post.slug, + title: post.data.title, + description: post.data.description, + author: post.data.author, + publishDate: post.data.publishDate, + categories: post.data.categories, + tags: post.data.tags, })) export async function get() { diff --git a/src/pages/search-index.json.js b/src/pages/search-index.json.js index b732c95..e97d4d6 100644 --- a/src/pages/search-index.json.js +++ b/src/pages/search-index.json.js @@ -1,15 +1,15 @@ +import { getCollection } from 'astro:content' import lunr from 'lunr' -const postImportResult = import.meta.glob('./**/*.{md,mdx}', { eager: true }) -const posts = Object.values(postImportResult).filter(post => !post.frontmatter.draft) +const posts = await getCollection('blog', (p) => { return !p.data.draft}) const documents = posts.map(post => ({ - url: post.url, - title: post.frontmatter.title, - description: post.frontmatter.description, - author: post.frontmatter.author, - categories: post.frontmatter.categories && post.frontmatter.categories.join(' '), - tags: post.frontmatter.tags && post.frontmatter.tags.join(' '), - content: post.file.search(/.mdx$/) >= 0 ? '' : post.rawContent(), + url: import.meta.env.BASE_URL + '/blog/' + post.slug, + title: post.data.title, + description: post.data.description, + author: post.data.author, + categories: post.data.categories && post.data.categories.join(' '), + tags: post.data.tags && post.data.tags.join(' '), + content: post.body, })) const idx = lunr(function () { this.ref('url') diff --git a/src/pages/tag/[tag]/[...page].astro b/src/pages/tag/[tag]/[...page].astro index f9bbf80..7462296 100644 --- a/src/pages/tag/[tag]/[...page].astro +++ b/src/pages/tag/[tag]/[...page].astro @@ -1,14 +1,16 @@ --- -import type { MarkdownInstance, PaginateFunction, Page } from 'astro' +import type { PaginateFunction, Page } from 'astro' +import type { CollectionEntry } from 'astro:content' import type { Frontmatter } from '../../../config' import { SiteMetadata, PAGE_SIZE } from '../../../config' +import { getCollection } from 'astro:content' import Base from '../../../layouts/base.astro' import PageHero from '../../../components/pagehero.astro' import BlogRoll from '../../../components/blogroll.astro' import PaginateControl from '../../../components/paginatecontrol.astro' export interface Props { - page: Page<MarkdownInstance<Frontmatter>> + page: Page<CollectionEntry<'blog'>> } const { tag } = Astro.params @@ -30,21 +32,13 @@ const frontmatter: Frontmatter = { } export async function getStaticPaths({ paginate }: { paginate: PaginateFunction }) { - const allPosts = (await Astro.glob( - '../../blog/*.{md,mdx}' - )) as MarkdownInstance<Frontmatter>[] - const posts = allPosts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) + const allPosts = await getCollection('blog') + const posts = allPosts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) - const tags = Array.from(new Set(posts.flatMap(post => post.frontmatter.tags))) + const tags = Array.from(new Set(posts.flatMap(post => post.data.tags))) return tags.map(tag => { - return paginate(posts.filter(post => tag && post.frontmatter.tags?.includes(tag)), { + return paginate(posts.filter(post => tag && post.data.tags?.includes(tag)), { params: { tag }, pageSize: PAGE_SIZE }) diff --git a/src/pages/tags.astro b/src/pages/tags.astro index c6fce9e..aa247b1 100644 --- a/src/pages/tags.astro +++ b/src/pages/tags.astro @@ -1,5 +1,5 @@ --- -import type { MarkdownInstance } from 'astro' +import { getCollection } from 'astro:content' import type { Frontmatter, TagType } from '../config' import { SiteMetadata } from '../config' import Base from '../layouts/base.astro' @@ -98,21 +98,13 @@ const frontmatter: Frontmatter = { publishDate: SiteMetadata.buildTime, } -const allPosts = (await Astro.glob( - './blog/*.{md,mdx}' -)) as MarkdownInstance<Frontmatter>[] -const posts = allPosts - .sort( - (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - - new Date(a.frontmatter.publishDate).valueOf() - ) - .filter(post => !post.frontmatter.draft) +const posts = await getCollection('blog') +const latestPosts = posts.sort((a, b) => +b.data.publishDate - +a.data.publishDate).filter(p => !p.data.draft) const tagmap: Map<string, TagType> = new Map() -posts.forEach(post => { - post.frontmatter.tags?.forEach(tag => { +latestPosts.forEach(post => { + post.data.tags?.forEach(tag => { let utag = tagmap.get(tag) if (utag) { utag.count += 1 diff --git a/yarn.lock b/yarn.lock index 9f6bb41..79ce87f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -69,10 +69,10 @@ vscode-languageserver-types "^3.17.1" vscode-uri "^3.0.3" -"@astrojs/markdown-remark@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@astrojs/markdown-remark/-/markdown-remark-2.0.0.tgz#16fd5a4042f900c9a367d9afdcd7188a70344a46" - integrity sha512-PqDxi3L2jsxLWjsWRyn+BkaDtHKq2+ECI7PlW9NsEwu2jKKgl7sXj57s/Wjhyctr4efFdzewFArVFm1Gnb3rtw== +"@astrojs/markdown-remark@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@astrojs/markdown-remark/-/markdown-remark-2.0.1.tgz#48ecc33dde9231eb20df274e87099552834c4a1f" + integrity sha512-xQF1rXGJN18m+zZucwRRtmNehuhPMMhZhi6HWKrtpEAKnHSPk8lqf1GXgKH7/Sypglu8ivdECZ+EGs6kOYVasQ== dependencies: "@astrojs/prism" "^2.0.0" github-slugger "^1.4.0" @@ -88,12 +88,12 @@ unist-util-visit "^4.1.0" vfile "^5.3.2" -"@astrojs/mdx@^0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@astrojs/mdx/-/mdx-0.15.0.tgz#bbab44672929009fdbacf2fe31ba20e151012a17" - integrity sha512-KABnoWZJdtmzlbTbCJKLHRfX6fM9PS+BjSUSq/OHlkkejPUlmrZvGbDdN0Yfw1/gY/KDP48L7BLy/9VAk5Y/Wg== +"@astrojs/mdx@^0.15.1": + version "0.15.1" + resolved "https://registry.yarnpkg.com/@astrojs/mdx/-/mdx-0.15.1.tgz#65eac3af9e93abd62a0af5d4cd226257f7de7a4f" + integrity sha512-RzrJ2vq+XnAtqvhRdIeONYBINFEWetXnfAqiB2V4s/FB/jd+8y9fSOtBtGpWCGpRZfidtMYPIiQ/damz0yJxVA== dependencies: - "@astrojs/markdown-remark" "^2.0.0" + "@astrojs/markdown-remark" "^2.0.1" "@astrojs/prism" "^2.0.0" "@mdx-js/mdx" "^2.1.2" "@mdx-js/rollup" "^2.1.1" @@ -985,14 +985,14 @@ astro-seo@^0.7.0: resolved "https://registry.yarnpkg.com/astro-seo/-/astro-seo-0.7.0.tgz#74ff0accfbc0eb52475418988683f2a259fe9112" integrity sha512-G7zJUr4lfKLeqfWx2g5rfuBsOsIOfqxIOqErQfrMsMchDFfLFxNKAuW8yAo8hynJJwBvtGyS/vOXgGdMVVCFrA== -astro@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/astro/-/astro-2.0.1.tgz#7404ef119db41cdcd1b9e6094b4f87ef060cb6a3" - integrity sha512-EXq1lks+ylmArhtUs99PQelK0bQ3VS+698OO9UYkjG08Bd02ficqihsRGBnhEor7U9989hZb+1p4y0rNpgKH8g== +astro@2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/astro/-/astro-2.0.2.tgz#a465d8ba066e16bd21e3b6d2a7a1b7aa209ba2fa" + integrity sha512-47N1jLWNxSri7kWfIfgcEnQJZWTvd0gXhNC3P2ZHiiurl4nOxFC5ULsW5MDDTjTzQ1S7y1RoaL9XxYm+Rury7w== dependencies: "@astrojs/compiler" "^1.0.1" "@astrojs/language-server" "^0.28.3" - "@astrojs/markdown-remark" "^2.0.0" + "@astrojs/markdown-remark" "^2.0.1" "@astrojs/telemetry" "^2.0.0" "@astrojs/webapi" "^2.0.0" "@babel/core" "^7.18.2" @@ -1954,9 +1954,9 @@ html-void-elements@^2.0.0: integrity sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A== http-cache-semantics@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" - integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== + version "4.1.1" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" + integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== human-signals@^3.0.1: version "3.0.1" @@ -2276,19 +2276,20 @@ markdown-table@^3.0.0: integrity sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw== mdast-util-definitions@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/mdast-util-definitions/-/mdast-util-definitions-5.1.1.tgz#2c1d684b28e53f84938bb06317944bee8efa79db" - integrity sha512-rQ+Gv7mHttxHOBx2dkF4HWTg+EE+UR78ptQWDylzPKaQuVGdG4HIoY3SrS/pCp80nZ04greFvXbVFHT+uf0JVQ== + version "5.1.2" + resolved "https://registry.yarnpkg.com/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz#9910abb60ac5d7115d6819b57ae0bcef07a3f7a7" + integrity sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA== dependencies: "@types/mdast" "^3.0.0" "@types/unist" "^2.0.0" unist-util-visit "^4.0.0" mdast-util-find-and-replace@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.1.tgz#249901ef43c5f41d6e8a8d446b3b63b17e592d7c" - integrity sha512-SobxkQXFAdd4b5WmEakmkVoh18icjQRxGy5OWTCzgsLRm1Fu/KCtwD1HIQSsmq5ZRjVH0Ehwg6/Fn3xIUk+nKw== + version "2.2.2" + resolved "https://registry.yarnpkg.com/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.2.tgz#cc2b774f7f3630da4bd592f61966fecade8b99b1" + integrity sha512-MTtdFRz/eMDHXzeK6W3dO7mXUlF82Gom4y0oOgvHhh/HXZAGvIQDUvQ0SuUx+j2tv44b8xTHOm8K/9OoRFnXKw== dependencies: + "@types/mdast" "^3.0.0" escape-string-regexp "^5.0.0" unist-util-is "^5.0.0" unist-util-visit-parents "^5.0.0" @@ -3106,10 +3107,11 @@ path-to-regexp@^6.2.1: integrity sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw== periscopic@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/periscopic/-/periscopic-3.0.4.tgz#b3fbed0d1bc844976b977173ca2cd4a0ef4fa8d1" - integrity sha512-SFx68DxCv0Iyo6APZuw/AKewkkThGwssmU0QWtTlvov3VAtPX+QJ4CadwSaz8nrT5jPIuxdvJWB4PnD2KNDxQg== + version "3.1.0" + resolved "https://registry.yarnpkg.com/periscopic/-/periscopic-3.1.0.tgz#7e9037bf51c5855bd33b48928828db4afa79d97a" + integrity sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw== dependencies: + "@types/estree" "^1.0.0" estree-walker "^3.0.0" is-reference "^3.0.0" @@ -3234,7 +3236,7 @@ preferred-pm@^3.0.3: path-exists "^4.0.0" which-pm "2.0.0" -prettier-plugin-astro@^0.7.0, prettier-plugin-astro@^0.7.2: +prettier-plugin-astro@^0.7.0: version "0.7.2" resolved "https://registry.yarnpkg.com/prettier-plugin-astro/-/prettier-plugin-astro-0.7.2.tgz#d761cde54714c6871c731bec179d4cf75e2d86d6" integrity sha512-mmifnkG160BtC727gqoimoxnZT/dwr8ASxpoGGl6EHevhfblSOeu+pwH1LAm5Qu1MynizktztFujHHaijLCkww== @@ -3244,7 +3246,17 @@ prettier-plugin-astro@^0.7.0, prettier-plugin-astro@^0.7.2: sass-formatter "^0.7.5" synckit "^0.8.4" -prettier@^2.7.1: +prettier-plugin-astro@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/prettier-plugin-astro/-/prettier-plugin-astro-0.8.0.tgz#ae014f8263ca383ee853192cc40a516e914684a5" + integrity sha512-kt9wk33J7HvFGwFaHb8piwy4zbUmabC8Nu+qCw493jhe96YkpjscqGBPy4nJ9TPy9pd7+kEx1zM81rp+MIdrXg== + dependencies: + "@astrojs/compiler" "^1.0.1" + prettier "^2.8.3" + sass-formatter "^0.7.5" + synckit "^0.8.4" + +prettier@^2.7.1, prettier@^2.8.3: version "2.8.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.3.tgz#ab697b1d3dd46fb4626fbe2f543afe0cc98d8632" integrity sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw== @@ -3504,9 +3516,9 @@ reusify@^1.0.4: integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== rollup@^3.7.0: - version "3.10.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.10.1.tgz#56278901ed11fc2898421e8e3e2c8155bc7b40b4" - integrity sha512-3Er+yel3bZbZX1g2kjVM+FW+RUWDxbG87fcqFM5/9HbPCTpbVp6JOLn7jlxnNlbu7s/N/uDA4EV/91E2gWnxzw== + version "3.11.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.11.0.tgz#89c487441b18b7c689a0c9aa4221e03b87535461" + integrity sha512-+uWPPkpWQ2H3Qi7sNBcRfhhHJyUNgBYhG4wKe5wuGRj2m55kpo+0p5jubKNBjQODyPe6tSBE3tNpdDwEisQvAQ== optionalDependencies: fsevents "~2.3.2" @@ -3862,9 +3874,9 @@ tsconfig-resolver@^3.0.1: type-fest "^0.13.1" tslib@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" - integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== type-fest@^0.13.1: version "0.13.1"