import type { Folder } from './lib/build-tree.ts'; import type { DossierDocument } from './types.ts'; export interface DossierOptions { root: string; documents: Map; tree: Folder; } export declare class Dossier { #private; constructor({ root, documents, tree }: DossierOptions); get root(): string; get tree(): Folder; /** * Array of all documents in traversal order. */ get documents(): DossierDocument[]; /** * Array of document paths. * * @example * ```ts * const dossier = await createDossier(new URL('./docs', import.meta.url)) * console.log(dossier.paths) * // ['/docs/guide', '/docs/api', '/docs/api/reference'] * ``` */ get paths(): string[]; /** * Get a document by path. * * @param path - Path to the document * @returns The document if found, otherwise `undefined` * * @example * ```ts * // Given this file structure: * // docs/ * // guide.mdx * // api/ * // index.mdx * // reference.mdx * * const dossier = await createDossier(new URL('./docs', import.meta.url)) * * dossier.get('/docs/guide') // docs/guide.mdx * dossier.get('/docs/api/reference') // docs/api/reference.mdx * dossier.get('/docs/api') // docs/api/index.mdx * ``` */ get(path: string): DossierDocument | undefined; /** * Get the previous and next documents relative to the given path. * Useful for implementing pagination or navigation between documents. * * @param path - Path to the document * @returns An object with `prev` and `next` documents, or `undefined` if the path doesn't exist * * @example * ```ts * const dossier = await createDossier(new URL('./docs', import.meta.url)) * const sibs = dossier.siblings('/docs/api/reference') * * if (sibs) { * if (sibs.prev) { * console.log('Previous:', sibs.prev.title) * } * if (sibs.next) { * console.log('Next:', sibs.next.title) * } * } * ``` */ adjacent(path: string): { prev?: DossierDocument; next?: DossierDocument; } | undefined; /** * Iterate over all documents in traversal order. * Each iteration yields an object with the relative path and document. * * @example * ```ts * const dossier = await createDossier(new URL('./docs', import.meta.url)) * * for (const { path, document } of dossier) { * console.log(`${path}: ${document.title}`) * } * * // Convert to array * const docs = [...dossier] * ``` */ [Symbol.iterator](): Generator<{ path: string; document: DossierDocument; }>; }