jsii-docgen
- Version 10.6.3
- Published
- 661 kB
- 8 dependencies
- Apache-2.0 license
Install
npm i jsii-docgen
yarn add jsii-docgen
pnpm add jsii-docgen
Overview
generates api docs for jsii modules
Index
Variables
Functions
Classes
MarkdownRenderer
- fromSchema()
- fromSubmodules()
- visitApiReference()
- visitClass()
- visitClasses()
- visitConstant()
- visitConstants()
- visitConstruct()
- visitConstructs()
- visitEnum()
- visitEnumMember()
- visitEnumMembers()
- visitEnums()
- visitInitializer()
- visitInstanceMethod()
- visitInstanceMethods()
- visitInterface()
- visitInterfaces()
- visitParameter()
- visitProperties()
- visitProperty()
- visitStaticFunction()
- visitStaticFunctions()
- visitStruct()
- visitStructs()
- visitSubmodules()
Interfaces
Variables
variable CURRENT_SCHEMA_VERSION
const CURRENT_SCHEMA_VERSION: string;
Functions
function defaultAnchorFormatter
defaultAnchorFormatter: (type: JsiiEntity) => string;
function defaultLinkFormatter
defaultLinkFormatter: ( type: JsiiEntity, metadata: AssemblyMetadataSchema) => string;
function defaultTypeFormatter
defaultTypeFormatter: ( type: TypeSchema, metadata: AssemblyMetadataSchema, linkFormatter: (type: JsiiEntity, metadata: AssemblyMetadataSchema) => string) => string;
function extractDocs
extractDocs: (docs: reflect.Docs) => DocsSchema;
function filterUndefined
filterUndefined: <T extends object>(obj: T) => T;
function submodulePath
submodulePath: (module?: reflect.Submodule) => string | undefined;
Generates the name of the submodule.
Classes
class CorruptedAssemblyError
class CorruptedAssemblyError extends DocGenError {}
Raised when docgen detects corrupted assemblies, preventing it from generating documentation for a specific language. This can happen either due to jsii compiler bugs, or authoring mistakes.
For example: https://github.com/aws/jsii/pull/3147
class DocGenError
class DocGenError extends Error {}
Generic error thrown by the library.
property name
readonly name: string;
class Documentation
class Documentation {}
Render documentation pages for a jsii library.
method cleanup
cleanup: () => Promise<void>;
Removes any internal working directories.
method forAssembly
static forAssembly: ( assemblyName: string, assembliesDir: string) => Promise<Documentation>;
Create a
Documentation
object for a specific assembly from a directory of assemblies.Parameter assemblyName
The assembly name.
Parameter assembliesDir
The directory containing the assemblies that comprise the type-system.
method forPackage
static forPackage: ( target: string, options?: ForPackageDocumentationOptions) => Promise<Documentation>;
Create a
Documentation
object from a package installable by npm.Note that this method installs the target package to the local file-system. Make sure to call
Documentation.cleanup
once you are done rendering.Parameter target
The target to install. This can either be a local path or a registry identifier (e.g @)
Parameter options
Additional options.
Throws
NoSpaceLeftOnDevice if the installation fails due to running out of disk space
Throws
NpmError if some
npm
command fails when preparing the working set
method forProject
static forProject: ( root: string, options?: ForLocalPackageDocumentationOptions) => Promise<Documentation>;
Create a
Documentation
object from a local directory containing a node project.Parameter root
The local directory path. Must contain a package.json file.
Parameter options
Additional options.
method listSubmodules
listSubmodules: () => Promise<readonly reflect.Submodule[]>;
List all submodules in the assembly.
method toIndexMarkdown
toIndexMarkdown: ( fileSuffix: string, options: RenderOptions) => Promise<MarkdownDocument>;
method toJson
toJson: (options: RenderOptions) => Promise<Json<Schema>>;
Generate markdown.
method toMarkdown
toMarkdown: (options: MarkdownRenderOptions) => Promise<MarkdownDocument>;
class Language
class Language {}
Supported languages to generate documentation in.
property CSHARP
static readonly CSHARP: Language;
C#
property GO
static readonly GO: Language;
Go
property JAVA
static readonly JAVA: Language;
Java.
property name
readonly name: string;
property PYTHON
static readonly PYTHON: Language;
Python.
property targetName
readonly targetName: string;
property TYPESCRIPT
static readonly TYPESCRIPT: Language;
TypeScript.
method fromString
static fromString: (lang: string) => Language;
Transform a literal string to the
Language
object.Throws an
UnsupportedLanguageError
if the language is not supported.
method isValidConfiguration
isValidConfiguration: (config: Record<string, unknown> | undefined) => boolean;
method toString
toString: () => string;
method values
static values: () => Language[];
class LanguageNotSupportedError
class LanguageNotSupportedError extends DocGenError {}
Raised when a render is requested for a language the package does not support.
class MarkdownDocument
class MarkdownDocument {}
Markdown element.
constructor
constructor(options?: MarkdownOptions);
property EMPTY
static readonly EMPTY: MarkdownDocument;
An empty markdown element.
method bold
static bold: (text: string) => string;
method bullet
bullet: (line: string) => void;
method code
code: (language: string, ...snippet: string[]) => void;
method docs
docs: (docs: DocsSchema, language?: Language) => void;
Render a docs element into the markdown.
method italic
static italic: (text: string) => string;
method lines
lines: (...lines: string[]) => void;
method pre
static pre: (text: string) => string;
method quote
quote: (line: string) => void;
method removeNewlines
static removeNewlines: (line: string) => string;
Remove newlines from markdown.
method render
render: (headerSize?: number) => string;
method sanitize
static sanitize: (line: string) => string;
Sanitize markdown reserved characters from external input.
method section
section: (section: MarkdownDocument) => void;
method split
split: () => void;
method table
table: (data: string[][]) => void;
class MarkdownRenderer
class MarkdownRenderer {}
Generates
MarkdownDocument
instances fromAPI.json
or its parts.This class can be used in two ways:
1. Instantiate it via the constructor with
options
, which requires passing in some global context about the module and language you are generated for. (This context can be found in the top-levelmetadata
field of API.json.) Then, call avisitXxx
method to generate aMarkdownDocument
for the appropriate part of the schema.2. Generate a
MarkdownDocument
from the completeAPI.json
using thefromSchema
static method (no instantiation needed). Global context is automatically inferred from the API.json.Both choices allow customizing the output via
MarkdownFormattingOptions
.
constructor
constructor(options: MarkdownRendererOptions);
method fromSchema
static fromSchema: ( schema: Schema, options: MarkdownFormattingOptions) => MarkdownDocument;
method fromSubmodules
static fromSubmodules: ( submodules: readonly reflect.Submodule[], fileSuffix: string, options: MarkdownRendererOptions) => MarkdownDocument;
method visitApiReference
visitApiReference: ( apiRef: ApiReferenceSchema, header?: { title: string; id: string }) => MarkdownDocument;
method visitClass
visitClass: (klass: ClassSchema) => MarkdownDocument;
method visitClasses
visitClasses: (classes: ClassSchema[]) => MarkdownDocument;
method visitConstant
visitConstant: (constant: PropertySchema) => MarkdownDocument;
method visitConstants
visitConstants: (constants: PropertySchema[]) => MarkdownDocument;
method visitConstruct
visitConstruct: (construct: ConstructSchema) => MarkdownDocument;
method visitConstructs
visitConstructs: (constructs: ConstructSchema[]) => MarkdownDocument;
method visitEnum
visitEnum: (enu: EnumSchema) => MarkdownDocument;
method visitEnumMember
visitEnumMember: (em: EnumMemberSchema) => MarkdownDocument;
method visitEnumMembers
visitEnumMembers: (enus: EnumMemberSchema[]) => MarkdownDocument;
method visitEnums
visitEnums: (enums: EnumSchema[]) => MarkdownDocument;
method visitInitializer
visitInitializer: (init: InitializerSchema) => MarkdownDocument;
method visitInstanceMethod
visitInstanceMethod: (method: MethodSchema) => MarkdownDocument;
method visitInstanceMethods
visitInstanceMethods: (methods: MethodSchema[]) => MarkdownDocument;
method visitInterface
visitInterface: (iface: InterfaceSchema) => MarkdownDocument;
method visitInterfaces
visitInterfaces: (ifaces: InterfaceSchema[]) => MarkdownDocument;
method visitParameter
visitParameter: (parameter: ParameterSchema) => MarkdownDocument;
method visitProperties
visitProperties: (properties: PropertySchema[]) => MarkdownDocument;
method visitProperty
visitProperty: (prop: PropertySchema) => MarkdownDocument;
method visitStaticFunction
visitStaticFunction: (method: MethodSchema) => MarkdownDocument;
method visitStaticFunctions
visitStaticFunctions: (methods: MethodSchema[]) => MarkdownDocument;
method visitStruct
visitStruct: (struct: StructSchema) => MarkdownDocument;
method visitStructs
visitStructs: (structs: StructSchema[]) => MarkdownDocument;
method visitSubmodules
visitSubmodules: ( submodules: readonly reflect.Submodule[], fileSuffix: string) => MarkdownDocument;
class NoSpaceLeftOnDevice
class NoSpaceLeftOnDevice extends Error {}
The error raised when processing a package fails due to running out of disk space while installing it's dependency closure in a temporary directory. This error cannot be immediately recovered, short of deleting files to make more space availabe, then retrying.
Users may perform an
err instanceof NoSpaceLeftOnDevice
test to determine whether this error was raised or not, and cut retry attempts.
property name
readonly name: string;
class NpmError
class NpmError<T = unknown> extends DocGenError {}
The error raised when
npm
commands fail with an "opaque" exit code, attempting to obtain more information from the commands output.
property name
readonly name: string;
The name of this error.
property npmErrorCode
readonly npmErrorCode: string;
The error code npm printed out to stderr or stdout before exiting. This can provide more information about the error in a machine-friendlier way.
This is extracted from log-parsing, and is hence not guaranteed to be accurate.
Example 1
'EPROTO'
Example 2
'E429'
Example 3
'E404'
property stdout
readonly stdout: {};
Data the command produced to
STDOUT
.
class TransliterationError
class TransliterationError extends DocGenError {}
Raised when snippet transliteration into a target language failed.
class UnInstallablePackageError
class UnInstallablePackageError extends DocGenError {}
Raised when docgen is unable to install the given package. This can happen due to invalid dependency clojures for example.
class UnsupportedLanguageError
class UnsupportedLanguageError extends Error {}
constructor
constructor(lang: string, supported: Language[]);
Interfaces
interface ApiReferenceSchema
interface ApiReferenceSchema {}
Describes the API Reference.
property classes
readonly classes: ClassSchema[];
Classes.
property constructs
readonly constructs: ConstructSchema[];
Constructs.
property enums
readonly enums: EnumSchema[];
Enums.
property interfaces
readonly interfaces: InterfaceSchema[];
Interfaces.
property structs
readonly structs: StructSchema[];
Structs.
interface AssemblyMetadataSchema
interface AssemblyMetadataSchema {}
Metadata about a particular jsii assembly.
property packageName
readonly packageName: string;
Name of the jsii assembly/package.
property packageVersion
readonly packageVersion: string;
Version of the jsii assembly/package.
property submodule
readonly submodule?: string;
Language-independent name of the jsii submodule. if undefined, it is implicitly the root module.
Example 1
aws_sqs
interface CallableSchema
interface CallableSchema extends Usage {}
Common properties of a callable.
property displayName
readonly displayName: string;
The friendly language-specific name for the callable.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this callable among all entities in the document and is same across languages.
property parameters
readonly parameters: ParameterSchema[];
Parameters of the callable.
interface ClassSchema
interface ClassSchema extends Documentable {}
Describes a class.
property constants
readonly constants: PropertySchema[];
Constants.
property displayName
readonly displayName: string;
The friendly language-specific name for the class.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this class among all entities in the document and is same across languages.
property initializer
readonly initializer?: InitializerSchema;
Class initializer.
property instanceMethods
readonly instanceMethods: MethodSchema[];
Instance methods.
property interfaces
readonly interfaces: JsiiEntity[];
Interfaces this class implements.
property properties
readonly properties: PropertySchema[];
Properties.
property staticMethods
readonly staticMethods: MethodSchema[];
Static methods.
interface ConstructSchema
interface ConstructSchema extends ClassSchema {}
Describes a construct.
interface DocsSchema
interface DocsSchema {}
Docstring information.
See Also
jsii.Docs
property deprecated
readonly deprecated?: boolean;
Whether or not it is deprecated.
property deprecationReason
readonly deprecationReason?: string;
Deprecation reason (if applicable).
property example
readonly example?: string;
Code snippet showing example usage of an API item, that has been provided by the construct library authors.
property links
readonly links?: string[];
@see
and@link
links with more information.
property remarks
readonly remarks?: string;
Detailed information about an API item.
Either the explicitly tagged
@remarks
section, otherwise everything past the first paragraph if there is no@remarks
tag.
property summary
readonly summary?: string;
Summary documentation for an API item.
The first part of the documentation before hitting a
@remarks
tags, or the first line of the doc comment block if there is no@remarks
tag.
interface Documentable
interface Documentable {}
An entity that can have a doc string.
property docs
readonly docs: DocsSchema;
Doc string.
interface EnumMemberSchema
interface EnumMemberSchema extends Documentable {}
Describes an enum member.
property displayName
readonly displayName: string;
The friendly language-specific name for the enum member.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this enum member among all entities in the document and is same across languages.
interface EnumSchema
interface EnumSchema extends Documentable {}
Describes an enum.
property displayName
readonly displayName: string;
The friendly language-specific name for the enum.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this enum among all entities in the document and is same across languages.
property members
readonly members: EnumMemberSchema[];
Enum members.
interface InitializerSchema
interface InitializerSchema extends CallableSchema {}
Describes a constructor.
interface InterfaceSchema
interface InterfaceSchema extends Documentable {}
Describes a behavioral interface, also sometimes known as a protocol.
property displayName
readonly displayName: string;
The friendly language-specific name for the interface.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this interface among all entities in the document and is same across languages.
property implementations
readonly implementations: JsiiEntity[];
Types implementing this interface.
property instanceMethods
readonly instanceMethods: MethodSchema[];
Methods.
property interfaces
readonly interfaces: JsiiEntity[];
Interfaces that this interface extends.
property properties
readonly properties: PropertySchema[];
Properties.
interface JsiiEntity
interface JsiiEntity extends AssemblyMetadataSchema {}
Describes a single "entity" in the jsii type system. This may be a type, but it could also be a property, method, parameter, enum member, etc.
property displayName
readonly displayName: string;
The friendly language-specific name for the entity.
property fqn
readonly fqn: string;
The language-specific type FQN.
property id
readonly id: string;
An id that uniquely identifies this type among all entities in the document and is same across languages.
interface MarkdownFormattingOptions
interface MarkdownFormattingOptions {}
property anchorFormatter
readonly anchorFormatter?: (type: JsiiEntity) => string;
How jsii entity IDs should be formatted into anchors. This should be customized in conjunction with
linkFormatter
.Parameter type
the entity we are creating an anchor for
- use the full id
Modifiers
@experimental
property header
readonly header?: { title: string; id: string;};
property linkFormatter
readonly linkFormatter?: ( type: JsiiEntity, metadata: AssemblyMetadataSchema) => string;
How should links to entities be rendered. For example, if a class or a property is referenced within a description or table.
The
metadata
parameter can be optionally used to customize links based on whether or not the type belongs to the package / submodule that is being generated.Parameter type
the entity we are creating a link for
Parameter metadata
information about the module being docgen-ed
- '{type.displayName}' if the type belongs to this package, '{type.fqn}' otherwise
Modifiers
@experimental
property typeFormatter
readonly typeFormatter?: ( type: TypeSchema, metadata: AssemblyMetadataSchema, linkFormatter: (type: JsiiEntity, metadata: AssemblyMetadataSchema) => string) => string;
How type signatures should be formatted, including those made of nested types (like
Map<string, Bucket>
).The
metadata
andlinkFormatter
parameters are provided so that links can be included in the formatted types if desired.Parameter type
the type being formatted
Parameter metadata
information about the module being docgen-ed
Parameter linkFormatter
the type link formatter
- HTML code block with type references linked according to
linkFormatter
Modifiers
@experimental
interface MarkdownRendererOptions
interface MarkdownRendererOptions extends MarkdownFormattingOptions, AssemblyMetadataSchema {}
property language
readonly language: Language;
Language the documentation is rendered for.
interface MethodSchema
interface MethodSchema extends CallableSchema, Documentable {}
Describes a method.
interface Optional
interface Optional {}
An entity that may be optional.
interface ParameterSchema
interface ParameterSchema extends Optional, Documentable {}
Describes a parameter.
property displayName
readonly displayName: string;
The friendly language-specific name for the parameter.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this parameter among all entities in the document and is same across languages.
property type
readonly type: TypeSchema;
The type of the parameter.
property variadic
readonly variadic: boolean;
Whether the parameter is variadic.
interface PropertySchema
interface PropertySchema extends Usage, Optional, Documentable {}
Describes a property.
property const
readonly const?: boolean;
Whether the property is a constant. false
property displayName
readonly displayName: string;
The friendly language-specific name for the property.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this property among all entities in the document and is same across languages.
property type
readonly type: TypeSchema;
The type of the property.
interface Schema
interface Schema {}
Describes the top-level schema.
property allSubmodules
readonly allSubmodules?: boolean;
Whether this document represents documentation for all submodules (including the root).
false
property apiReference
readonly apiReference?: ApiReferenceSchema;
API Reference.
property language
readonly language: string;
Language that the documentation has been transliterated to.
property metadata
readonly metadata: AssemblyMetadataSchema;
Assembly metadata.
property readme
readonly readme?: string;
Readme.
property version
readonly version: string;
Schema version number.
interface StructSchema
interface StructSchema extends Usage, Documentable {}
Describes a struct.
property displayName
readonly displayName: string;
The friendly language-specific name for the struct.
property fqn
readonly fqn: string;
The language-specific fqn.
property id
readonly id: string;
An id that uniquely identifies this struct among all entities in the document and is same across languages.
property properties
readonly properties: PropertySchema[];
Properties.
interface TypeSchema
interface TypeSchema {}
Describes any kind of type. This could be a primitive, a user-defined type (like
Bucket
), or a composition of types (likeMap<string, Bucket>[]
).
property formattingPattern
readonly formattingPattern: string;
The language-specific name of the type. May contain "%" placeholder values to indicate references to types defined in the "types" field.
Example 1
"string"
Example 2
"%"
Example 3
"typing.List[%]"
Example 4
"Map<%, %>"
property types
readonly types?: (TypeSchema | JsiiEntity)[];
Types referenced within the "name" field. The order of these corresponds to the order of the %'s in
formattingPattern
.
Package Files (7)
Dependencies (8)
Dev Dependencies (20)
- @stylistic/eslint-plugin
- @types/fs-extra
- @types/jest
- @types/node
- @types/semver
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- cdklabs-projen-project-types
- commit-and-tag-version
- constructs
- eslint
- eslint-import-resolver-typescript
- eslint-plugin-import
- jest
- jest-junit
- jsii-rosetta
- projen
- ts-jest
- ts-node
- typescript
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/jsii-docgen
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/jsii-docgen)
- HTML<a href="https://www.jsdocs.io/package/jsii-docgen"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4999 ms. - Missing or incorrect documentation? Open an issue for this package.