Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 8fae3ae

Browse files
committed
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
1 parent fe1bfc1 commit 8fae3ae

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

apps/web-roo-code/src/components/blog/blog-analytics.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
"use client"
22

33
import { useEffect, useRef } from "react"
4-
import type { BlogPost } from "@/lib/blog"
5-
import { trackBlogIndexView, trackBlogPostView, trackBlogPostScrollDepth, trackBlogPostTimeSpent } from "@/lib/blog"
4+
import type { BlogPost } from "@/lib/blog/types"
5+
import {
6+
trackBlogIndexView,
7+
trackBlogPostView,
8+
trackBlogPostScrollDepth,
9+
trackBlogPostTimeSpent,
10+
} from "@/lib/blog/analytics"
611

712
interface BlogIndexAnalyticsProps {
813
postCount: number
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Type declarations for gray-matter
3+
* @see https://github.com/jonschlinkert/gray-matter
4+
*/
5+
6+
declare module "gray-matter" {
7+
interface GrayMatterFile<T = Record<string, unknown>> {
8+
/** The parsed frontmatter data */
9+
data: T
10+
/** The content of the file without the frontmatter */
11+
content: string
12+
/** The original input string */
13+
orig: string | Buffer
14+
/** The language of the frontmatter */
15+
language: string
16+
/** The raw frontmatter string (excluding delimiters) */
17+
matter: string
18+
/** Whether the input string is empty */
19+
isEmpty: boolean
20+
/** Alias for content */
21+
excerpt?: string
22+
}
23+
24+
interface GrayMatterOption {
25+
/** Custom excerpt function or boolean */
26+
excerpt?: boolean | ((file: GrayMatterFile, options: GrayMatterOption) => void)
27+
/** Custom separator for excerpt */
28+
excerpt_separator?: string
29+
/** Custom engines for parsing */
30+
engines?: Record<string, unknown>
31+
/** Language to use for parsing */
32+
language?: string
33+
/** Custom delimiters */
34+
delimiters?: string | [string, string]
35+
}
36+
37+
function matter<T = Record<string, unknown>>(input: string | Buffer, options?: GrayMatterOption): GrayMatterFile<T>
38+
39+
export = matter
40+
}

0 commit comments

Comments
 (0)