import ts from 'typescript'; import { type EntryProp, type EntryVariant, type Registry } from './schema'; export interface BuildOptions { /** The repository's top folder. */ root?: string; /** The name this registry's entries are recorded under. */ repo?: string; } /** One name as `index.ts` exports it. */ interface RawExport { name: string; /** The sibling it comes from, without `./`. */ module: string; isType: boolean; } /** What the parser found above and about one top-level declaration. */ interface Declared { /** The doc comment, cleaned, or `''`. */ doc: string; deprecated: boolean; /** * Its first parameter's type, as written. Kept as the node and resolved after * the whole file is walked: a props interface is often declared *below* the * component that takes it. */ propsType?: ts.TypeNode; } export declare const PACKAGE_IMPORT = "@estiva-app/ui"; /** The editor corner (UIG-31): parts that import Tiptap, kept off the main entry. */ export declare const EDITOR_IMPORT = "@estiva-app/ui/editor"; /** Whether an import names the package: its main entry, or its editor corner. */ export declare const isPackageImport: (specifier: string) => specifier is "@estiva-app/ui" | "@estiva-app/ui/editor"; /** * Storybook's own `sanitize`, which is what turns a title and a story's export * name into the id in the URL. Copied rather than imported: `storybook` is a * dev dependency of this repo and must not become a runtime dependency of the * builder, which apps run. A test holds this to the ids a real Storybook build * produces. */ export declare function sanitize(name: string): string; export declare const toId: (title: string, name: string) => string; /** Read `src/index.ts`. Its `export { … } from './Sibling'` statements are the target set. */ export declare function readIndexExports(source: string): RawExport[]; /** * The first sentence of a block of prose, which is the purpose. * * A sentence ends at `.`, `!` or `?` followed by a space and something that * starts a new one. A very short first sentence takes the next as well — * "A list of actions from a trigger." is a purpose; "One row, two parts." is * not, on its own. */ export declare function firstSentence(prose: string): string; /** A page's opening paragraph: everything between its `# Heading` and the first blank line. */ export declare function pageOpening(mdx: string): string; /** A type’s finished props and word-choices, read by the module that declares them. */ export interface Resolved { props: EntryProp[]; variants: EntryVariant[]; } /** * Ask another file for a type it declares, already resolved. `specifier` is the * import as written (`./IconButton`, `@/lib/types`); the caller decides what it * points at, and answers `undefined` for anything outside the library it reads. */ export type Sibling = (specifier: string, typeName: string) => Resolved | undefined; export interface ReadOptions { /** * Whether a file with no comment of its own at the top lends the comment on * its first declaration to the file. The package: yes — `Skeleton.tsx`'s * family paragraph sits there, and taking it as `SkeletonBar`'s was wrong. An * app: no — a comment directly above a part is that part's, which is what a * person writing one expects; a file's own goes at the very top. */ lendFirstComment?: boolean; } export declare function readModule(source: string, sibling?: Sibling, { lendFirstComment }?: ReadOptions): { declarations: Map; headerDoc: string; resolve: (propsType: ts.TypeNode | undefined) => Resolved; resolveName: (name: string) => Resolved; }; /** The `title` a stories file gives Storybook, and the stories it exports. */ export declare function readStories(source: string): { title: string | null; stories: string[]; }; /** * Read the repository and return the catalogue. * * Throws on anything it cannot explain — a missing sibling, a name with no * purpose anywhere. A registry that quietly drops what it could not read is * worse than no registry, because a reader cannot tell the difference between * "we have nothing for that" and "the builder gave up". */ export declare function buildRegistry({ root, repo }?: BuildOptions): Registry; /** The committed file's text, so a check and a write produce the same bytes. */ export declare function serializeRegistry(registry: Registry): string; export {}; //# sourceMappingURL=build.d.ts.map