aubade
Version:
filesystem-based content processor
106 lines (96 loc) • 2.58 kB
TypeScript
declare module 'aubade' {
export function parse(source: string): {
body: string;
frontmatter?: {
[key: string]: any;
estimate: number;
table: Array<{
id: string;
title: string;
level: number;
}>;
};
};
export {};
}
declare module 'aubade/artisan' {
import type { default as markdown } from 'markdown-it';
type Primitives = string | boolean | null;
export interface FrontMatter {
[key: string]: Primitives | Primitives[] | FrontMatter | FrontMatter[];
}
export function matter(raw: string, memo?: Record<string, any>): FrontMatter[string];
export const marker: markdown;
interface Dataset {
file?: string;
language?: string;
[data: string]: string | undefined;
}
export const highlighter: import("shiki").HighlighterGeneric<import("shiki").BundledLanguage, import("shiki").BundledTheme>;
export function transform(source: string, dataset: Dataset): string;
export {};
}
declare module 'aubade/browser' {
export function hydrate(signal?: any): (node: HTMLElement) => () => void;
export {};
}
declare module 'aubade/compass' {
import type { default as markdown } from 'markdown-it';
import * as fs from 'fs/promises';
interface Chunk {
buffer: Buffer;
marker: typeof marker;
parse: typeof parse;
siblings: Array<{
filename: string;
buffer: Promise<Buffer>;
}>;
/** register an async task to be executed in parallel with the traversal. */
task(fn: (tools: {
fs: typeof fs;
}) => Promise<void>): void;
}
interface Options {
breadcrumb: string[];
depth: number;
parent: string;
path: string;
}
type Falsy = false | null | undefined;
interface Inspect<Output extends Record<string, any>> {
(options: Options): Falsy | ((chunk: Chunk) => Promise<Falsy | Output>);
}
export function traverse<Output extends Record<string, any>>(entry: string, inspect?: Inspect<Output>): Promise<Output[]>;
function parse(source: string): {
body: string;
frontmatter?: {
[key: string]: any;
estimate: number;
table: Array<{
id: string;
title: string;
level: number;
}>;
};
};
const marker: markdown;
export {};
}
declare module 'aubade/transform' {
export function chain<Item extends Record<string, any>, Key extends string = 'flank', Output = {
slug?: string;
title?: any;
}>(items: Item[], options: {
breakpoint?(next: Item): boolean;
key?: Key;
sort?(x: Item, y: Item): number;
transform?(item: Item): Output;
}): Array<Item & {
[P in Key]: {
back?: Output;
next?: Output;
};
}>;
export {};
}
//# sourceMappingURL=index.d.ts.map