UNPKG

@irwinproject/storybook-addon-tsdoc

Version:
112 lines (111 loc) 3.39 kB
import { SourceFile } from "ts-morph"; import { FSWatcher } from "fs"; import { TSDocOptions } from "./types"; import './utils'; /** * TS is a central repository for options. This will also handle code compiling based off a tsconfig */ export default class TS { static watcher?: FSWatcher; static hasUpdates: boolean; /** * The document folder path */ static docs: string; /** * Describes the glob used to identify tsdocs documentation. */ static get docsGlob(): string; /** * The tsconfig path */ static tsconfig: string; /** * @todo change to accept multiple entries. * @todo add automatic entry based on tsconfig */ static entry: string; /** * @todo add configurable option */ static aliases: [RegExp, string][]; /** * I hate this property * @todo virtualize docs in dev environment. */ static shouldClearDocsOnStart: boolean; /** * @todo support not documenting private variables. */ static documentPrivate: boolean; /** * Declaration based documentation is in development. IT DOES NOT YET WORK!!! */ static documentStyle: "declaration" | "file"; /** * Documents a project but catches the errors and outputs it with tsdocs prefix. */ static document({ tsconfig, entry, docs, shouldClearDocsOnStart }?: Partial<TSDocOptions>): void; static watch(): void; /** * 1 stange case I have encountered is when declarations are differenciated by case such as m and M in svg overwrite the file because file systems are not case specific. as such * a record of all links will be tracked and if an overlap is detected a different path will be provided. */ static decs: Record<string, string>; /** * Resolves the url to its path name that wil be used. for the path name and the path title * @param url * @returns */ static resolveUrl(url: string): string | undefined; /** * Resolves the url to a doc url * * This should not be used on urls outside the entry path. * @param url * @returns */ static resolvedDocFilePath(url: string): string; /** * Resolves to a storybook url path value. * @param url * @returns {string} */ static resolveDocPath(url: string): string; /** * Create a project (program) and crawl the parsed data. */ static documentProject(documentor?: (node: SourceFile) => void): void; /** * Document the source file. * * at this time this will create an mdx file if any nodes are traversed in said directory * * * @todo wrap style in style tag since it will never be used in any other way. * @param source * @returns */ static documentSourceFile(source: SourceFile): void; static documentByDeclaration(source: SourceFile): void; /** * A prefixed log method to make identification easier * @param args */ static log(...args: unknown[]): void; /** * A red prefixed log method. * @param args */ static err(...args: unknown[]): void; /** * A yellow prefixed log method. * @param args */ static warn(...args: unknown[]): void; /** * A green prefixed log method. * @param args */ static success(...args: unknown[]): void; }