1 | import ts from "typescript";
|
2 | import type { Application } from "../application";
|
3 | import { Comment, type CommentDisplayPart, type ContainerReflection, type DeclarationReflection, type ParameterReflection, ProjectReflection, type Reflection, type ReflectionSymbolId, type SignatureReflection, type SomeType, type TypeParameterReflection } from "../models/index";
|
4 | import { Context } from "./context";
|
5 | import { ConverterComponent } from "./components";
|
6 | import { ChildableComponent } from "../utils/component";
|
7 | import { MinimalSourceFile } from "../utils";
|
8 | import type { DocumentationEntryPoint } from "../utils/entry-point";
|
9 | import type { CommentParserConfig } from "./comments";
|
10 | import type { CommentStyle, ValidationOptions } from "../utils/options/declaration";
|
11 | import { type ExternalSymbolResolver, type ExternalResolveResult } from "./comments/linkResolver";
|
12 | import { type DeclarationReference } from "./comments/declarationReference";
|
13 | import type { FileRegistry } from "../models/FileRegistry";
|
14 | export interface ConverterEvents {
|
15 | begin: [Context];
|
16 | end: [Context];
|
17 | createDeclaration: [Context, DeclarationReflection];
|
18 | createSignature: [
|
19 | Context,
|
20 | SignatureReflection,
|
21 | (ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature)?,
|
22 | ts.Signature?
|
23 | ];
|
24 | createParameter: [Context, ParameterReflection, ts.Node?];
|
25 | createTypeParameter: [
|
26 | Context,
|
27 | TypeParameterReflection,
|
28 | ts.TypeParameterDeclaration?
|
29 | ];
|
30 | resolveBegin: [Context];
|
31 | resolveReflection: [Context, Reflection];
|
32 | resolveEnd: [Context];
|
33 | }
|
34 |
|
35 |
|
36 |
|
37 | export declare class Converter extends ChildableComponent<Application, ConverterComponent, ConverterEvents> {
|
38 |
|
39 | accessor externalPattern: string[];
|
40 | private externalPatternCache?;
|
41 | private excludeCache?;
|
42 |
|
43 | accessor excludeExternals: boolean;
|
44 |
|
45 | accessor excludeNotDocumented: boolean;
|
46 |
|
47 | accessor excludePrivate: boolean;
|
48 |
|
49 | accessor excludeProtected: boolean;
|
50 |
|
51 | accessor excludeReferences: boolean;
|
52 |
|
53 | accessor commentStyle: CommentStyle;
|
54 |
|
55 | accessor validation: ValidationOptions;
|
56 |
|
57 | accessor externalSymbolLinkMappings: Record<string, Record<string, string>>;
|
58 |
|
59 | accessor preserveLinkText: boolean;
|
60 |
|
61 | accessor maxTypeConversionDepth: number;
|
62 | private _config?;
|
63 | private _externalSymbolResolvers;
|
64 | get config(): CommentParserConfig;
|
65 | |
66 |
|
67 |
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 | static readonly EVENT_BEGIN: "begin";
|
74 | |
75 |
|
76 |
|
77 |
|
78 |
|
79 | static readonly EVENT_END: "end";
|
80 | |
81 |
|
82 |
|
83 | |
84 |
|
85 |
|
86 |
|
87 |
|
88 | static readonly EVENT_CREATE_DECLARATION: "createDeclaration";
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | static readonly EVENT_CREATE_SIGNATURE: "createSignature";
|
97 | |
98 |
|
99 |
|
100 |
|
101 |
|
102 | static readonly EVENT_CREATE_PARAMETER: "createParameter";
|
103 | |
104 |
|
105 |
|
106 |
|
107 |
|
108 | static readonly EVENT_CREATE_TYPE_PARAMETER: "createTypeParameter";
|
109 | |
110 |
|
111 |
|
112 | |
113 |
|
114 |
|
115 |
|
116 |
|
117 | static readonly EVENT_RESOLVE_BEGIN: "resolveBegin";
|
118 | |
119 |
|
120 |
|
121 |
|
122 |
|
123 | static readonly EVENT_RESOLVE: "resolveReflection";
|
124 | |
125 |
|
126 |
|
127 |
|
128 |
|
129 | static readonly EVENT_RESOLVE_END: "resolveEnd";
|
130 | constructor(owner: Application);
|
131 | /**
|
132 | * Compile the given source files and create a project reflection for them.
|
133 | */
|
134 | convert(entryPoints: readonly DocumentationEntryPoint[]): ProjectReflection;
|
135 | /** @internal */
|
136 | addProjectDocuments(project: ProjectReflection): void;
|
137 | /** @internal */
|
138 | convertSymbol(context: Context, symbol: ts.Symbol, exportSymbol?: ts.Symbol): void;
|
139 | /**
|
140 | * Convert the given TypeScript type into its TypeDoc type reflection.
|
141 | *
|
142 | * @param context The context object describing the current state the converter is in.
|
143 | * @returns The TypeDoc type reflection representing the given node and type.
|
144 | * @internal
|
145 | */
|
146 | convertType(context: Context, node: ts.TypeNode | ts.Type | undefined): SomeType;
|
147 | /**
|
148 | * Parse the given file into a comment. Intended to be used with markdown files.
|
149 | */
|
150 | parseRawComment(file: MinimalSourceFile, files: FileRegistry): {
|
151 | content: CommentDisplayPart[];
|
152 | frontmatter: Record<string, unknown>;
|
153 | };
|
154 | |
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | addUnknownSymbolResolver(resolver: ExternalSymbolResolver): void;
|
167 |
|
168 | resolveExternalLink(ref: DeclarationReference, refl: Reflection, part: CommentDisplayPart | undefined, symbolId: ReflectionSymbolId | undefined): ExternalResolveResult | string | undefined;
|
169 | resolveLinks(comment: Comment, owner: Reflection): void;
|
170 | resolveLinks(parts: readonly CommentDisplayPart[], owner: Reflection): CommentDisplayPart[];
|
171 | |
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 | private compile;
|
178 | private convertExports;
|
179 | private convertReExports;
|
180 | |
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 | private resolve;
|
187 | |
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 | shouldIgnore(symbol: ts.Symbol): boolean;
|
194 | private isExcluded;
|
195 |
|
196 | isExternal(symbol: ts.Symbol): boolean;
|
197 | processDocumentTags(reflection: Reflection, parent: ContainerReflection): void;
|
198 | private addDocument;
|
199 | private _buildCommentParserConfig;
|
200 | }
|