A TypeDoc plugin collection for generating enhanced documentation for AWS SDK client libraries.
npx @tessl/cli install tessl/npm-aws-sdk--client-documentation-generator@3.37.0The AWS SDK Client Documentation Generator is a TypeDoc plugin collection that provides enhanced documentation generation for AWS SDK client libraries. It automatically improves documentation formatting, table of contents organization, project naming, and navigation for TypeDoc-generated AWS SDK client documentation.
npm install @aws-sdk/client-documentation-generatorThe package exports a single loader function used by TypeDoc's plugin system:
const loader = require("@aws-sdk/client-documentation-generator");This package is designed for use as a TypeDoc plugin. Configure it in your TypeDoc configuration:
// typedoc.json
{
"plugin": ["@aws-sdk/client-documentation-generator"],
"entryPoints": ["./src/index.ts"],
"out": "./docs"
}When TypeDoc runs, the plugin loader will automatically register all four plugin components to enhance the documentation generation process.
The plugin collection consists of four specialized components that integrate with TypeDoc's plugin system:
Each plugin operates at different phases of TypeDoc's documentation generation pipeline and is automatically registered when the plugin is loaded.
The main entry point that registers all plugin components with TypeDoc.
/**
* Main plugin loader function for TypeDoc
* @param pluginHost - TypeDoc plugin host instance
*/
function load(pluginHost: PluginHost): void;Processes and cleans documentation comments by removing empty lines for better formatting.
class SdkClientCommentUpdatePlugin extends ConverterComponent {
/**
* Initialize the plugin and register event listeners
*/
initialize(): void;
/**
* Process declaration comments during TypeDoc conversion
* @param context - TypeDoc conversion context
* @param reflection - The reflection being processed
* @param node - Optional TypeScript AST node
*/
private onDeclaration(context: Context, reflection: Reflection, node?: ts.Node): void;
/**
* Clean empty comment lines from documentation blocks
* @param comment - Raw comment string
* @returns Cleaned comment string
*/
private cleanEmptyCommentLines(comment: string): string;
}Customizes TypeDoc's table of contents by organizing AWS SDK elements into logical groups.
class SdkClientTocPlugin extends RendererComponent {
private commandsNavigationItem?: NavigationItem;
private clientsNavigationItem?: NavigationItem;
private paginatorsNavigationItem?: NavigationItem;
private waitersNavigationItem?: NavigationItem;
private clientDir?: string;
/**
* Initialize the plugin by disabling default ToC plugin and setting up custom rendering
*/
initialize(): void;
/**
* Generate custom table of contents structure for pages
* @param page - Page event containing project details
*/
private onRendererBeginPage(page: PageEvent): void;
/**
* Build hierarchical table of contents with custom grouping
* @param model - Reflection model to process
* @param trail - Active trail of expanded ToC entries
* @param parent - Parent navigation item
* @param restriction - Optional ToC restrictions
*/
buildToc(model: Reflection, trail: Reflection[], parent: NavigationItem, restriction?: string[]): void;
/**
* Check if declaration belongs to the client package
* @param model - Declaration reflection to check
* @returns True if belongs to client package
*/
private belongsToClientPackage(model: DeclarationReflection): boolean;
/**
* Identify client class declarations
* @param model - Declaration reflection to check
* @returns True if it's a client class
*/
private isClient(model: DeclarationReflection): boolean;
/**
* Identify command class declarations
* @param model - Declaration reflection to check
* @returns True if it's a command class
*/
private isCommand(model: DeclarationReflection): boolean;
/**
* Identify paginator function declarations
* @param model - Declaration reflection to check
* @returns True if it's a paginator function
*/
private isPaginator(model: DeclarationReflection): boolean;
/**
* Identify input/output interface declarations
* @param model - Declaration reflection to check
* @returns True if it's an input/output interface
*/
private isInputOrOutput(model: DeclarationReflection): boolean;
/**
* Identify waiter function declarations
* @param model - Declaration reflection to check
* @returns True if it's a waiter function
*/
private isWaiter(model: DeclarationReflection): boolean;
/**
* Load and determine the client directory path
* @param model - Reflection model to process
* @returns Client directory path string
*/
private loadClientDir(model: Reflection): string;
}Updates project names in documentation based on AWS service IDs or package names.
class SdkClientRenameProjectPlugin extends RendererComponent {
private projectName: string | undefined;
/**
* Initialize the plugin and register event listeners
*/
initialize(): void;
/**
* Update project name when rendering begins
* @param event - Renderer event with project details
*/
onRenderedBegin(event: RendererEvent): void;
}Removes unnecessary navigation elements for cleaner documentation.
class SdkClientRemoveNavigatorPlugin extends RendererComponent {
private navigationPlugin: NavigationPlugin;
/**
* Initialize the plugin and get navigation plugin reference
*/
initialize(): void;
/**
* Clear navigation children when rendering begins
* @param event - Renderer event
*/
onRenderedBegin(event: RendererEvent): void;
}Helper functions for plugin operations.
/**
* Get the current client directory from project structure
* @param event - Event containing project reflection
* @returns SourceDirectory of the current client
*/
function getCurrentClientDirectory(event: { project: ProjectReflection }): SourceDirectory;The package relies on TypeDoc's internal type system and exports the following internal interfaces:
// TypeDoc Core Types (from typedoc library)
interface PluginHost {
owner: Application;
}
interface Context {
// TypeDoc conversion context
}
interface Reflection {
comment?: Comment;
name: string;
parent?: Reflection;
// Additional TypeDoc reflection properties
}
interface DeclarationReflection extends Reflection {
sources?: SourceReference[];
children?: DeclarationReflection[];
extendedTypes?: Type[];
kindOf(kind: ReflectionKind): boolean;
getFullName(): string;
}
interface ProjectReflection extends Reflection {
name: string;
directory: SourceDirectory;
}
interface SourceDirectory {
directories: { [name: string]: SourceDirectory };
files: SourceFile[];
}
interface SourceFile {
name: string;
fileName: string;
fullFileName: string;
reflections?: Reflection[];
}
class NavigationItem {
title: string;
children: NavigationItem[];
isInPath?: boolean;
isCurrent?: boolean;
constructor(title: string, url?: string, parent?: NavigationItem);
static create(child: Reflection, parent: NavigationItem, shallow?: boolean): NavigationItem;
}
interface NavigationPlugin {
navigation?: NavigationItem;
}
interface PageEvent {
model: Reflection;
project: ProjectReflection;
toc?: NavigationItem;
}
interface RendererEvent {
project: ProjectReflection;
}
interface ReferenceType {
name: string;
}
enum ReflectionKind {
SomeModule = 1,
Class = 2,
Interface = 4,
Function = 16,
// Additional kinds as needed
}
// Component Base Classes
abstract class ConverterComponent {
protected owner: Converter;
protected listenTo(owner: any, events: { [event: string]: Function }): void;
}
abstract class RendererComponent {
protected owner: Renderer;
protected listenTo(owner: any, events: { [event: string]: Function }): void;
}