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