mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
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
This commit is contained in:
parent
fe1bfc1fde
commit
8fae3aeedd
2 changed files with 47 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
40
apps/web-roo-code/src/types/gray-matter.d.ts
vendored
Normal file
40
apps/web-roo-code/src/types/gray-matter.d.ts
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Type declarations for gray-matter
|
||||
* @see https://github.com/jonschlinkert/gray-matter
|
||||
*/
|
||||
|
||||
declare module "gray-matter" {
|
||||
interface GrayMatterFile<T = Record<string, unknown>> {
|
||||
/** 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<string, unknown>
|
||||
/** Language to use for parsing */
|
||||
language?: string
|
||||
/** Custom delimiters */
|
||||
delimiters?: string | [string, string]
|
||||
}
|
||||
|
||||
function matter<T = Record<string, unknown>>(input: string | Buffer, options?: GrayMatterOption): GrayMatterFile<T>
|
||||
|
||||
export = matter
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue