Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove d.ts #2427

Merged
merged 4 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
74 changes: 37 additions & 37 deletions src/runtime/types/index.d.ts β†’ src/runtime/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { LayoutKey } from '#build/types/layouts'
import type { Theme } from 'shiki-es'
import type { StorageValue } from 'unstorage'
import type { LayoutKey } from '#build/types/layouts'

export interface ParsedContentInternalMeta {
/**
Expand Down Expand Up @@ -45,27 +44,22 @@ export interface ParsedContentInternalMeta {
_extension?: 'md' | 'yaml' | 'yml' | 'json' | 'json5' | 'csv'
}

export interface ParsedContentMeta extends ParsedContentInternalMeta {
/**
* Layout
*/
layout?: LayoutKey
//

[key: string]: any
export interface TocLink {
id: string
text: string
depth: number
children?: TocLink[]
}

export interface ParsedContent extends ParsedContentMeta {
/**
* Excerpt
*/
excerpt?: MarkdownRoot
/**
* Content body
*/
body: MarkdownRoot | null
export interface Toc {
title: string
depth: number
searchDepth: number
links: TocLink[]
}

//
export interface MarkdownNode {
type: string
tag?: string
Expand All @@ -78,18 +72,18 @@ export interface MarkdownNode {
fmAttributes?: Record<string, any>
}

export interface MarkdownHtmlNode extends MarkdownNode {
type: 'html'
value: string
}

export interface MarkdownRoot {
type: 'root'
children: MarkdownNode[]
props?: Record<string, any>
toc?: Toc
}

export interface MarkdownHtmlNode extends MarkdownNode {
type: 'html'
value: string
}

export interface MarkdownPlugin extends Record<string, any> {}

export interface MarkdownOptions {
Expand All @@ -109,18 +103,24 @@ export interface MarkdownOptions {
rehypePlugins: Record<string, false | (MarkdownPlugin & { instance: any })>
}

export interface TocLink {
id: string
text: string
depth: number
children?: TocLink[]
export interface ParsedContentMeta extends ParsedContentInternalMeta {
/**
* Layout
*/
layout?: LayoutKey

[key: string]: any
}

export interface Toc {
title: string
depth: number
searchDepth: number
links: TocLink[]
export interface ParsedContent extends ParsedContentMeta {
/**
* Excerpt
*/
excerpt?: MarkdownRoot
/**
* Content body
*/
body: MarkdownRoot | null
}

export interface MarkdownParsedContent extends ParsedContent {
Expand Down Expand Up @@ -413,7 +413,7 @@ export interface QueryBuilderWhere extends Partial<Record<keyof ParsedContentInt
**/
$in?: string | Array<string | number | boolean>

[key: string]: string | number | boolean | RegExp | QueryBuilderWhere | Array<string | number | boolean | QueryBuilderWhere>
[key: string]: undefined | string | number | boolean | RegExp | QueryBuilderWhere | Array<string | number | boolean | QueryBuilderWhere>
}

export interface QueryBuilderParams {
Expand All @@ -437,8 +437,8 @@ export interface QueryBuilder<T = ParsedContentMeta> {
/**
* Select a subset of fields
*/
only<K extends keyof T | string>(keys: K): QueryBuilder<Pick<T, K>>
only<K extends (keyof T | string)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>
only<K extends keyof T>(keys: K): QueryBuilder<Pick<T, K>>
only<K extends (keyof T)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>

/**
* Remove a subset of fields
Expand Down Expand Up @@ -495,7 +495,7 @@ export interface QueryBuilder<T = ParsedContentMeta> {
* Retrieve query builder params
* @internal
*/
params: () => readonly QueryBuilderParams
params: () => QueryBuilderParams
}

export type QueryPipe<T = any> = (data: Array<T>, param: QueryBuilderParams) => Array<T> | void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,4 @@ export interface ContentQueryBuilder<T = ParsedContentMeta, Y = {}> {
withDirConfig(): ContentQueryBuilder<T, ContentQueryWithDirConfig>
}


export type ContentQueryFetcher<T> = (query: ContentQueryBuilder<T>) => Promise<ContentQueryResponse>