@creadigme/aurelia-docgen
Version:
Aurelia + Storybook (can be) ❤. Aurelia documentation generator.
196 lines (192 loc) • 5.47 kB
TypeScript
// Generated by dts-bundle-generator v7.2.0
import * as fs from 'node:fs';
import { Comment, DeclarationReflection, LogLevel, Reflection, ReflectionGroup, Type } from 'typedoc';
/** Aurelia Docgen Common Options */
export type AureliaDocgenOptions = {
/**
* Output directory for generated stories
*
* If null or empty, stories will be written next to the classes.
*
* ⚠️ Write (on drive) the files in CLI usage (*command-line* or `AureliaDocgenCLI`), not with `AureliaDocgen`.
*/
out?: string;
/**
* ⚠️ Write (on drive) the file in CLI usage (*command-line* or `AureliaDocgenCLI`), not with `AureliaDocgen`.
*/
mergeOut?: boolean;
/** You [can] speak too much! */
verbose?: boolean;
/** Target project directory */
projectDir?: string;
/**
* Path of Eta template (https://eta.js.org/)
* If null, the default template is used
*/
etaTemplate?: string;
/**
* Specify the TS file for Aurelia configuration (**without extension**).
*
* @remark *If null or empty, only the current component will be register.*
*
* @example `./src/configure`
*
* ```typescript
* import * as Aurelia from 'aurelia';
*
* // If specified, this function is called to retrieve the instance of Aurelia
* let au: Aurelia;
* export async function getOrCreateAurelia(): Promise<Aurelia> {
* if (!au) {
* au = new Aurelia().register(...);
* // Do some stuff;
* }
* return au;
* }
* ```
*/
auConfigure?: string;
};
/** Aurelia Docgen CLI Options */
export type AureliaDocgenCLIOptions = AureliaDocgenOptions & {
/**
* **ONLY WITH CLI USAGE**
* Watch modifications
*/
watch?: boolean;
};
/** Aurelia Docgen API Options */
export type AureliaDocgenAPIOptions = AureliaDocgenOptions & {
/**
* **ONLY WITH API USAGE**
*/
logger?: (msg: string, level: LogLevel) => void;
};
/**
* Aurelia Docgen Options
* CommandLines definitions
*/
export declare const AureliaDocgenCLIOptions: OptionDefinition[];
type AureliaDocgenStory = {
title?: string;
help?: string;
tags?: string[];
code: string;
};
type AuType = "customElement" | "valueConverter" | "service" | "customAttribute" | "bindingBehavior";
interface Decorator {
/**
* The name of the decorator being applied.
*/
name: string;
/**
* The type declaring the decorator.
* Usually a ReferenceType instance pointing to the decorator function.
*/
type?: Type;
/**
* A named map of arguments the decorator is applied with.
*/
arguments?: any;
}
type DeclarationReflectionWithD = DeclarationReflection & {
/**
* A list of all decorators attached to this reflection.
*/
decorators?: Decorator[];
/**
* A list of all types that are decorated by this reflection.
*/
decorates?: Type[];
};
declare abstract class BaseDeclaration {
readonly original: DeclarationReflectionWithD;
auType: AuType;
/** Component tag */
tag?: string;
/** Public methods */
readonly publicMethods?: DeclarationReflection[];
/** Properties (without bindables) */
readonly properties: DeclarationReflection[];
/** Bindables properties */
readonly bindables: DeclarationReflection[];
/** Main category */
readonly category?: string;
/** Embedded stories */
readonly stories: AureliaDocgenStory[];
/** Parent */
get parent(): Reflection & {
groups?: ReflectionGroup[];
};
/** Original name */
get name(): string;
/** Original comment */
get comment(): Comment;
constructor(original: DeclarationReflectionWithD, auType: AuType);
protected abstract _fillTag(): void;
}
/** Aurelia Docgen Eligible stories generated */
export type AureliaDocgenEligible = {
/** Plain text stories generated with the specified Eta template */
stories: string;
/** Component Reflection */
component: BaseDeclaration;
/**
* Full path of the component without extension
* @example [...]src/components/au2-button
*/
componentPath: string;
};
/**
* Aurelia Docgen
*/
export declare class AureliaDocgen {
private readonly _options;
private readonly _typedocManager;
private readonly _eta;
/** Target project directory */
readonly projectDir: string;
/** Output directory */
readonly outDir?: string;
/** Merge all stories ? */
readonly mergeOut: boolean;
/** Sources directory */
readonly srcDir: string;
private readonly _tplPath;
private readonly _defaultLogger;
private readonly _auConfigure?;
/** Current template */
private _tpl?;
constructor(_options: AureliaDocgenAPIOptions);
private _init;
/** Get stories from TS project */
getStories(): Generator<AureliaDocgenEligible>;
private _buildElementStory;
/** Get customElement, valueConverters, etc recursively */
private _getEligibleDeclarations;
}
/**
* Aurelia Docgen CLI
*/
export declare class AureliaDocgenCLI {
static readonly MSG_WRITE_STORIES_DONE = "aurelia-docgen:write-stories:done";
static readonly MSG_WRITE_STORIES_FAIL = "aurelia-docgen:write-stories:failed";
static readonly MSG_WATCHING = "aurelia-docgen:watching";
static readonly MSG_EXIT = "aurelia-docgen:exit";
private static readonly _RE_WATCH_IGNORE;
private static readonly _RE_WATCH_EVENT;
/** Aurelia Docgen */
private readonly _aureliaDocgen;
/** Output file extension */
private readonly _outExtension;
/** Watch mode ? */
readonly mustWatch: boolean;
constructor();
/** Write stories */
writeStories(): void;
/** Watch and write stories */
watchStories(): fs.FSWatcher;
/** Ensure output directory */
private _ensureOutDir;
private static _sendMessage;
}