From 8fae3aeedd485302a91f2cb207107fad677087c1 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 28 Jan 2026 00:49:10 +0000 Subject: [PATCH] fix(blog): add gray-matter types and fix client/server code separation - Add type declaration file for gray-matter module - Fix blog-analytics.tsx to import from specific modules instead of barrel export to prevent fs module from being bundled into client code --- .../src/components/blog/blog-analytics.tsx | 9 ++++- apps/web-roo-code/src/types/gray-matter.d.ts | 40 +++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 apps/web-roo-code/src/types/gray-matter.d.ts diff --git a/apps/web-roo-code/src/components/blog/blog-analytics.tsx b/apps/web-roo-code/src/components/blog/blog-analytics.tsx index 026a9a3816..7fc1f23066 100644 --- a/apps/web-roo-code/src/components/blog/blog-analytics.tsx +++ b/apps/web-roo-code/src/components/blog/blog-analytics.tsx @@ -1,8 +1,13 @@ "use client" import { useEffect, useRef } from "react" -import type { BlogPost } from "@/lib/blog" -import { trackBlogIndexView, trackBlogPostView, trackBlogPostScrollDepth, trackBlogPostTimeSpent } from "@/lib/blog" +import type { BlogPost } from "@/lib/blog/types" +import { + trackBlogIndexView, + trackBlogPostView, + trackBlogPostScrollDepth, + trackBlogPostTimeSpent, +} from "@/lib/blog/analytics" interface BlogIndexAnalyticsProps { postCount: number diff --git a/apps/web-roo-code/src/types/gray-matter.d.ts b/apps/web-roo-code/src/types/gray-matter.d.ts new file mode 100644 index 0000000000..a1aaf87539 --- /dev/null +++ b/apps/web-roo-code/src/types/gray-matter.d.ts @@ -0,0 +1,40 @@ +/** + * Type declarations for gray-matter + * @see https://github.com/jonschlinkert/gray-matter + */ + +declare module "gray-matter" { + interface GrayMatterFile> { + /** The parsed frontmatter data */ + data: T + /** The content of the file without the frontmatter */ + content: string + /** The original input string */ + orig: string | Buffer + /** The language of the frontmatter */ + language: string + /** The raw frontmatter string (excluding delimiters) */ + matter: string + /** Whether the input string is empty */ + isEmpty: boolean + /** Alias for content */ + excerpt?: string + } + + interface GrayMatterOption { + /** Custom excerpt function or boolean */ + excerpt?: boolean | ((file: GrayMatterFile, options: GrayMatterOption) => void) + /** Custom separator for excerpt */ + excerpt_separator?: string + /** Custom engines for parsing */ + engines?: Record + /** Language to use for parsing */ + language?: string + /** Custom delimiters */ + delimiters?: string | [string, string] + } + + function matter>(input: string | Buffer, options?: GrayMatterOption): GrayMatterFile + + export = matter +}