UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

24 lines (23 loc) 1.49 kB
import { type DirectoryElement, type DocumentationElement, type FileElement } from "../util/element.js"; import { Extractor } from "./Extractor.js"; /** Input for a `ModuleExtractor`. */ export interface ModuleExtractorInput { /** Display name for the module, derived from the package.json export key (e.g. `"util/string"`, `"firestore/client"`). */ readonly name: string; /** * The source element this module is built from. * - `FileElement` — the module is backed by a single source file (with its `.md` sibling already merged in by `MergingExtractor`). * - `DirectoryElement` — the module is backed by a directory; its absorbed index file provides the content. */ readonly source: FileElement | DirectoryElement; } /** * Extractor that builds a `kind: "module"` `DocumentationElement` from a source file or directory. * - The module's `content`, `description`, and `title` are taken from the source element (`MergingExtractor` and * `IndexFileExtractor` are expected to have run upstream so `.md` siblings and `README.md` are already folded in). * - The module's `children` are every `tree-documentation` element found by deep-walking the source — flattened across * files and subdirectories, but never descending into a `tree-documentation`'s own members. */ export declare class ModuleExtractor extends Extractor<ModuleExtractorInput, DocumentationElement> { extract({ name, source }: ModuleExtractorInput): DocumentationElement; }