typedoc 0.28.0-beta.2 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/lib/application.d.ts +3 -3
- package/dist/lib/converter/converter.d.ts +12 -0
- package/dist/lib/converter/converter.js +27 -11
- package/dist/lib/converter/plugins/IncludePlugin.js +2 -3
- package/dist/lib/converter/symbols.js +2 -1
- package/dist/lib/converter/types.js +1 -1
- package/dist/lib/models/types.d.ts +1 -1
- package/dist/lib/models/types.js +7 -1
- package/dist/lib/output/components.d.ts +3 -3
- package/dist/lib/output/events.d.ts +4 -3
- package/dist/lib/output/events.js +4 -0
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +4 -2
- package/dist/lib/output/renderer.d.ts +2 -2
- package/dist/lib/output/renderer.js +3 -3
- package/dist/lib/output/router.d.ts +49 -37
- package/dist/lib/output/router.js +77 -47
- package/dist/lib/output/theme.d.ts +1 -2
- package/dist/lib/output/themes/MarkedPlugin.js +19 -4
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +1 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +9 -2
- package/dist/lib/output/themes/default/layouts/default.js +1 -1
- package/dist/lib/utils/entry-point.d.ts +1 -1
- package/dist/lib/utils/entry-point.js +14 -4
- package/dist/lib/utils/html.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +4 -3
- package/dist/lib/utils/options/options.d.ts +2 -2
- package/package.json +8 -8
- package/static/main.js +3 -3
- package/static/style.css +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export * from "./lib/models/index.js";
|
|
|
37
37
|
/** @primaryExport */
|
|
38
38
|
export * as Configuration from "./lib/utils/options/index.js";
|
|
39
39
|
export { BaseRouter, CategoryRouter, DefaultTheme, DefaultThemeRenderContext, GroupRouter, IndexEvent, KindDirRouter, KindRouter, MarkdownEvent, PageEvent, PageKind, Renderer, RendererEvent, Slugger, StructureDirRouter, StructureRouter, Theme, } from "./lib/output/index.js";
|
|
40
|
-
export type { Icons, NavigationElement, PageDefinition, PageHeading, RendererEvents, RendererHooks, RenderTemplate, Router, } from "./lib/output/index.js";
|
|
40
|
+
export type { Icons, NavigationElement, PageDefinition, PageHeading, RendererEvents, RendererHooks, RenderTemplate, Router, RouterTarget, } from "./lib/output/index.js";
|
|
41
41
|
export { Outputs } from "./lib/output/output.js";
|
|
42
42
|
export { ArgumentsReader, CommentStyle, EntryPointStrategy, normalizePath, Option, OptionDefaults, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, ValidatingFileRegistry, } from "./lib/utils/index.js";
|
|
43
43
|
export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, DocumentationEntryPoint, FancyConsoleLogger, FlagsDeclarationOption, JsDocCompatibility, KeyToDeclaration, ManuallyValidatedOption, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, ObjectDeclarationOption, OptionsReader, OutputSpecification, ParameterTypeToOptionTypeMap, SortStrategy, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, TypeDocOptionValues, ValidationOptions, } from "./lib/utils/index.js";
|
|
@@ -102,7 +102,7 @@ export declare class Application extends AbstractComponent<Application, Applicat
|
|
|
102
102
|
/**
|
|
103
103
|
* Initialize TypeDoc, loading plugins if applicable.
|
|
104
104
|
*/
|
|
105
|
-
static bootstrapWithPlugins(options?:
|
|
105
|
+
static bootstrapWithPlugins(options?: TypeDocOptions, readers?: readonly OptionsReader[]): Promise<Application>;
|
|
106
106
|
/**
|
|
107
107
|
* Initialize TypeDoc without loading plugins.
|
|
108
108
|
*
|
|
@@ -115,10 +115,10 @@ export declare class Application extends AbstractComponent<Application, Applicat
|
|
|
115
115
|
* @param options Options to set during initialization
|
|
116
116
|
* @param readers Option readers to use to discover options from config files.
|
|
117
117
|
*/
|
|
118
|
-
static bootstrap(options?:
|
|
118
|
+
static bootstrap(options?: TypeDocOptions, readers?: readonly OptionsReader[]): Promise<Application>;
|
|
119
119
|
private _bootstrap;
|
|
120
120
|
/** @internal */
|
|
121
|
-
setOptions(options:
|
|
121
|
+
setOptions(options: TypeDocOptions, reportErrors?: boolean): boolean;
|
|
122
122
|
/**
|
|
123
123
|
* Return the path to the TypeScript compiler.
|
|
124
124
|
*/
|
|
@@ -189,8 +189,20 @@ export declare class Converter extends AbstractComponent<Application, ConverterE
|
|
|
189
189
|
resolveExternalLink(ref: DeclarationReference, refl: Reflection, part: CommentDisplayPart | undefined, symbolId: ReflectionSymbolId | undefined): ExternalResolveResult | string | undefined;
|
|
190
190
|
resolveLinks(comment: Comment, owner: Reflection): void;
|
|
191
191
|
resolveLinks(parts: readonly CommentDisplayPart[], owner: Reflection): CommentDisplayPart[];
|
|
192
|
+
/**
|
|
193
|
+
* Permit deferred conversion steps to take place. Until this is called, {@link deferConversion}
|
|
194
|
+
* will throw if used.
|
|
195
|
+
* @since 0.28.1
|
|
196
|
+
*/
|
|
197
|
+
permitDeferredConversion(): void;
|
|
198
|
+
/**
|
|
199
|
+
* Finalize deferred conversion, must be called by the caller of {@link permitDeferredConversion}
|
|
200
|
+
* @since 0.28.1
|
|
201
|
+
*/
|
|
202
|
+
finalizeDeferredConversion(): void;
|
|
192
203
|
/**
|
|
193
204
|
* Defer a conversion step until later. This may only be called during conversion.
|
|
205
|
+
* @since 0.28.0
|
|
194
206
|
*/
|
|
195
207
|
deferConversion(cb: () => void): void;
|
|
196
208
|
/**
|
|
@@ -372,8 +372,33 @@ let Converter = (() => {
|
|
|
372
372
|
return resolvePartLinks(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Permit deferred conversion steps to take place. Until this is called, {@link deferConversion}
|
|
377
|
+
* will throw if used.
|
|
378
|
+
* @since 0.28.1
|
|
379
|
+
*/
|
|
380
|
+
permitDeferredConversion() {
|
|
381
|
+
ok(!this._deferPermitted, "Attempted to allow deferred conversion when already permitted");
|
|
382
|
+
this._deferPermitted = true;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Finalize deferred conversion, must be called by the caller of {@link permitDeferredConversion}
|
|
386
|
+
* @since 0.28.1
|
|
387
|
+
*/
|
|
388
|
+
finalizeDeferredConversion() {
|
|
389
|
+
this.application.logger.verbose(`Have ${this._defer.length} initial deferred tasks`);
|
|
390
|
+
let count = 0;
|
|
391
|
+
while (this._defer.length) {
|
|
392
|
+
++count;
|
|
393
|
+
const first = this._defer.shift();
|
|
394
|
+
first();
|
|
395
|
+
}
|
|
396
|
+
this.application.logger.verbose(`Ran ${count} total deferred tasks`);
|
|
397
|
+
this._deferPermitted = false;
|
|
398
|
+
}
|
|
375
399
|
/**
|
|
376
400
|
* Defer a conversion step until later. This may only be called during conversion.
|
|
401
|
+
* @since 0.28.0
|
|
377
402
|
*/
|
|
378
403
|
deferConversion(cb) {
|
|
379
404
|
ok(this._deferPermitted, "Attempted to defer conversion when not permitted");
|
|
@@ -386,8 +411,7 @@ let Converter = (() => {
|
|
|
386
411
|
* @returns An array containing all errors generated by the TypeScript compiler.
|
|
387
412
|
*/
|
|
388
413
|
compile(entryPoints, context) {
|
|
389
|
-
|
|
390
|
-
this._deferPermitted = true;
|
|
414
|
+
this.permitDeferredConversion();
|
|
391
415
|
let createModuleReflections = entryPoints.length > 1;
|
|
392
416
|
if (!createModuleReflections) {
|
|
393
417
|
const opts = this.application.options;
|
|
@@ -404,15 +428,7 @@ let Converter = (() => {
|
|
|
404
428
|
entryContext.setActiveProgram(entry.program);
|
|
405
429
|
this.convertExports(entryContext, entry, createModuleReflections);
|
|
406
430
|
}
|
|
407
|
-
this.
|
|
408
|
-
let count = 0;
|
|
409
|
-
while (this._defer.length) {
|
|
410
|
-
++count;
|
|
411
|
-
const first = this._defer.shift();
|
|
412
|
-
first();
|
|
413
|
-
}
|
|
414
|
-
this.application.logger.verbose(`Ran ${count} total deferred tasks`);
|
|
415
|
-
this._deferPermitted = false;
|
|
431
|
+
this.finalizeDeferredConversion();
|
|
416
432
|
}
|
|
417
433
|
convertExports(context, entryPoint, createModuleReflections) {
|
|
418
434
|
const node = entryPoint.sourceFile;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
2
|
import { ConverterComponent } from "../components.js";
|
|
4
3
|
import { ConverterEvents } from "../converter-events.js";
|
|
5
4
|
import { MinimalSourceFile } from "#utils";
|
|
6
|
-
import { isFile } from "../../utils/fs.js";
|
|
5
|
+
import { isFile, readFile } from "../../utils/fs.js";
|
|
7
6
|
import { dedent, escapeRegExp, i18n } from "#utils";
|
|
8
7
|
import { normalizePath } from "#node-utils";
|
|
9
8
|
/**
|
|
@@ -51,7 +50,7 @@ export class IncludePlugin extends ConverterComponent {
|
|
|
51
50
|
this.logger.error(i18n.include_0_in_1_specified_2_circular_include_3(part.tag, refl.getFriendlyFullName(), part.text, included.join("\n\t")));
|
|
52
51
|
}
|
|
53
52
|
else if (isFile(file)) {
|
|
54
|
-
const text =
|
|
53
|
+
const text = readFile(file).replaceAll("\r\n", "\n");
|
|
55
54
|
const ext = path.extname(file).substring(1);
|
|
56
55
|
const includedText = regionTarget
|
|
57
56
|
? this.getRegions(refl, file, ext, part.text, text, regionTarget, part.tag, part.tag === "@includeCode")
|
|
@@ -586,7 +586,8 @@ function convertVariable(context, symbol, exportSymbol) {
|
|
|
586
586
|
setModifiers(symbol, declaration, reflection);
|
|
587
587
|
reflection.defaultValue = convertDefaultValue(declaration);
|
|
588
588
|
context.finalizeDeclarationReflection(reflection);
|
|
589
|
-
|
|
589
|
+
// Exclude ValueModule to handle `module.exports = []`
|
|
590
|
+
return ts.SymbolFlags.Property | ts.SymbolFlags.ValueModule;
|
|
590
591
|
}
|
|
591
592
|
function isEnumLike(checker, type, location) {
|
|
592
593
|
if (!location || !hasAllFlags(type.flags, ts.TypeFlags.Object)) {
|
|
@@ -122,7 +122,7 @@ const arrayConverter = {
|
|
|
122
122
|
return new ArrayType(convertType(context, node.elementType));
|
|
123
123
|
},
|
|
124
124
|
convertType(context, type) {
|
|
125
|
-
const params = context.checker.getTypeArguments(type);
|
|
125
|
+
const params = type.aliasTypeArguments || context.checker.getTypeArguments(type);
|
|
126
126
|
// This is *almost* always true... except for when this type is in the constraint of a type parameter see GH#1408
|
|
127
127
|
// assert(params.length === 1);
|
|
128
128
|
assert(params.length > 0);
|
|
@@ -415,7 +415,7 @@ export declare class ReflectionType extends Type {
|
|
|
415
415
|
readonly type = "reflection";
|
|
416
416
|
constructor(declaration: DeclarationReflection);
|
|
417
417
|
protected getTypeString(): string;
|
|
418
|
-
needsParenthesis(): boolean;
|
|
418
|
+
needsParenthesis(where: TypeContext): boolean;
|
|
419
419
|
toObject(serializer: Serializer): JSONOutput.ReflectionType;
|
|
420
420
|
}
|
|
421
421
|
/**
|
package/dist/lib/models/types.js
CHANGED
|
@@ -917,7 +917,13 @@ export class ReflectionType extends Type {
|
|
|
917
917
|
}
|
|
918
918
|
return `{ ${parts.join("; ")} }`;
|
|
919
919
|
}
|
|
920
|
-
needsParenthesis() {
|
|
920
|
+
needsParenthesis(where) {
|
|
921
|
+
if (this.declaration.children || this.declaration.indexSignatures) {
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
if (this.declaration.signatures?.length === 1) {
|
|
925
|
+
return where === TypeContext.arrayElement || where === TypeContext.unionElement;
|
|
926
|
+
}
|
|
921
927
|
return false;
|
|
922
928
|
}
|
|
923
929
|
toObject(serializer) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractComponent } from "../utils/component.js";
|
|
2
|
-
import type { ProjectReflection
|
|
2
|
+
import type { ProjectReflection } from "../models/index.js";
|
|
3
3
|
import type { Renderer } from "./renderer.js";
|
|
4
4
|
import { PageEvent, RendererEvent } from "./events.js";
|
|
5
5
|
export declare abstract class RendererComponent extends AbstractComponent<Renderer, {}> {
|
|
@@ -15,7 +15,7 @@ export declare abstract class ContextAwareRendererComponent extends RendererComp
|
|
|
15
15
|
/**
|
|
16
16
|
* The reflection that is currently processed.
|
|
17
17
|
*/
|
|
18
|
-
protected page?: PageEvent
|
|
18
|
+
protected page?: PageEvent;
|
|
19
19
|
/**
|
|
20
20
|
* The url of the document that is being currently generated.
|
|
21
21
|
* Set when a page begins rendering.
|
|
@@ -49,5 +49,5 @@ export declare abstract class ContextAwareRendererComponent extends RendererComp
|
|
|
49
49
|
*
|
|
50
50
|
* @param page An event object describing the current render operation.
|
|
51
51
|
*/
|
|
52
|
-
protected onBeginPage(page: PageEvent
|
|
52
|
+
protected onBeginPage(page: PageEvent): void;
|
|
53
53
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProjectReflection } from "../models/ProjectReflection.js";
|
|
2
|
-
import type
|
|
3
|
-
import type { PageDefinition, PageKind } from "./router.js";
|
|
2
|
+
import { type DeclarationReflection, type DocumentReflection, Reflection, type ReflectionKind } from "../models/index.js";
|
|
3
|
+
import type { PageDefinition, PageKind, RouterTarget } from "./router.js";
|
|
4
4
|
/**
|
|
5
5
|
* An event emitted by the {@link Renderer} class at the very beginning and
|
|
6
6
|
* ending of the entire rendering process.
|
|
@@ -47,7 +47,7 @@ export interface PageHeading {
|
|
|
47
47
|
* @see {@link Renderer.EVENT_BEGIN_PAGE}
|
|
48
48
|
* @see {@link Renderer.EVENT_END_PAGE}
|
|
49
49
|
*/
|
|
50
|
-
export declare class PageEvent<out Model =
|
|
50
|
+
export declare class PageEvent<out Model extends RouterTarget = RouterTarget> {
|
|
51
51
|
/**
|
|
52
52
|
* The project the renderer is currently processing.
|
|
53
53
|
*/
|
|
@@ -102,6 +102,7 @@ export declare class PageEvent<out Model = unknown> {
|
|
|
102
102
|
*/
|
|
103
103
|
static readonly END = "endPage";
|
|
104
104
|
constructor(model: Model);
|
|
105
|
+
isReflectionEvent(): this is PageEvent<Reflection>;
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
108
|
* An event emitted when markdown is being parsed. Allows other plugins to manipulate the result.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Reflection, } from "../models/index.js";
|
|
1
2
|
/**
|
|
2
3
|
* An event emitted by the {@link Renderer} class at the very beginning and
|
|
3
4
|
* ending of the entire rendering process.
|
|
@@ -106,6 +107,9 @@ export class PageEvent {
|
|
|
106
107
|
constructor(model) {
|
|
107
108
|
this.model = model;
|
|
108
109
|
}
|
|
110
|
+
isReflectionEvent() {
|
|
111
|
+
return this.model instanceof Reflection;
|
|
112
|
+
}
|
|
109
113
|
}
|
|
110
114
|
/**
|
|
111
115
|
* An event emitted when markdown is being parsed. Allows other plugins to manipulate the result.
|
|
@@ -6,4 +6,4 @@ export { DefaultTheme, type NavigationElement, type RenderTemplate } from "./the
|
|
|
6
6
|
export { DefaultThemeRenderContext } from "./themes/default/DefaultThemeRenderContext.js";
|
|
7
7
|
export type { Icons } from "./themes/default/partials/icon.js";
|
|
8
8
|
export { Slugger } from "./themes/default/Slugger.js";
|
|
9
|
-
export { BaseRouter, CategoryRouter, GroupRouter, KindDirRouter, KindRouter, type PageDefinition, PageKind, type Router, StructureDirRouter, StructureRouter, } from "./router.js";
|
|
9
|
+
export { BaseRouter, CategoryRouter, GroupRouter, KindDirRouter, KindRouter, type PageDefinition, PageKind, type Router, type RouterTarget, StructureDirRouter, StructureRouter, } from "./router.js";
|
|
@@ -34,6 +34,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
};
|
|
35
35
|
import * as Path from "path";
|
|
36
36
|
import lunr from "lunr";
|
|
37
|
+
import { Reflection } from "../../models/index.js";
|
|
37
38
|
import { RendererComponent } from "../components.js";
|
|
38
39
|
import { IndexEvent, RendererEvent } from "../events.js";
|
|
39
40
|
import { Option, writeFile } from "../../utils/index.js";
|
|
@@ -112,8 +113,9 @@ let JavascriptIndexPlugin = (() => {
|
|
|
112
113
|
const theme = this.owner.theme;
|
|
113
114
|
const rows = [];
|
|
114
115
|
const initialSearchResults = this.owner
|
|
115
|
-
.router.
|
|
116
|
-
.filter((refl) =>
|
|
116
|
+
.router.getLinkTargets()
|
|
117
|
+
.filter((refl) => refl instanceof Reflection &&
|
|
118
|
+
(refl.isDeclaration() || refl.isDocument()) &&
|
|
117
119
|
refl.name &&
|
|
118
120
|
!refl.flags.isExternal);
|
|
119
121
|
const indexEvent = new IndexEvent(initialSearchResults);
|
|
@@ -79,8 +79,8 @@ export interface RendererHooks {
|
|
|
79
79
|
}
|
|
80
80
|
export interface RendererEvents {
|
|
81
81
|
beginRender: [RendererEvent];
|
|
82
|
-
beginPage: [PageEvent
|
|
83
|
-
endPage: [PageEvent
|
|
82
|
+
beginPage: [PageEvent];
|
|
83
|
+
endPage: [PageEvent];
|
|
84
84
|
endRender: [RendererEvent];
|
|
85
85
|
parseMarkdown: [MarkdownEvent];
|
|
86
86
|
prepareIndex: [IndexEvent];
|
|
@@ -263,7 +263,7 @@ let Renderer = (() => {
|
|
|
263
263
|
await this.runPreRenderJobs(output);
|
|
264
264
|
this.application.logger.verbose(`There are ${pages.length} pages to write.`);
|
|
265
265
|
for (const page of pages) {
|
|
266
|
-
this.renderDocument(outputDirectory, page);
|
|
266
|
+
this.renderDocument(outputDirectory, page, project);
|
|
267
267
|
}
|
|
268
268
|
this.postRenderAsyncJobs.push(async (o) => await this.theme.postRender(o));
|
|
269
269
|
await Promise.all(this.postRenderAsyncJobs.map((job) => job(output)));
|
|
@@ -286,13 +286,13 @@ let Renderer = (() => {
|
|
|
286
286
|
* @param page An event describing the current page.
|
|
287
287
|
* @return TRUE if the page has been saved to disc, otherwise FALSE.
|
|
288
288
|
*/
|
|
289
|
-
renderDocument(outputDirectory, page) {
|
|
289
|
+
renderDocument(outputDirectory, page, project) {
|
|
290
290
|
const momento = this.hooks.saveMomento();
|
|
291
291
|
const event = new PageEvent(page.model);
|
|
292
292
|
event.url = page.url;
|
|
293
293
|
event.filename = path.join(outputDirectory, page.url);
|
|
294
294
|
event.pageKind = page.kind;
|
|
295
|
-
event.project =
|
|
295
|
+
event.project = project;
|
|
296
296
|
this.trigger(PageEvent.BEGIN, event);
|
|
297
297
|
event.contents = this.theme.render(event);
|
|
298
298
|
this.trigger(PageEvent.END, event);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Application } from "../application.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ProjectReflection, Reflection, ReflectionKind } from "../models/index.js";
|
|
3
3
|
import { type TypeDocOptionMap } from "../utils/index.js";
|
|
4
4
|
import { Slugger } from "./themes/default/Slugger.js";
|
|
5
5
|
/**
|
|
6
6
|
* The type of page which should be rendered. This may be extended in the future.
|
|
7
|
+
*
|
|
8
|
+
* Note: TypeDoc any string may be used as the page kind. TypeDoc defines a few
|
|
9
|
+
* described by this object.
|
|
7
10
|
* @enum
|
|
8
11
|
*/
|
|
9
12
|
export declare const PageKind: {
|
|
@@ -12,11 +15,20 @@ export declare const PageKind: {
|
|
|
12
15
|
readonly Document: "document";
|
|
13
16
|
readonly Hierarchy: "hierarchy";
|
|
14
17
|
};
|
|
15
|
-
export type PageKind = (typeof PageKind)[keyof typeof PageKind];
|
|
16
|
-
|
|
18
|
+
export type PageKind = (typeof PageKind)[keyof typeof PageKind] | string & {};
|
|
19
|
+
/**
|
|
20
|
+
* A router target is something that may be linked to within a page. Notably,
|
|
21
|
+
* {@link Reflection} is compatible with this interface. TypeDoc supports non-reflection
|
|
22
|
+
* router targets, but does not currently create any.
|
|
23
|
+
*/
|
|
24
|
+
export type RouterTarget = {
|
|
25
|
+
name: string;
|
|
26
|
+
parent: RouterTarget;
|
|
27
|
+
} | Reflection;
|
|
28
|
+
export interface PageDefinition<out Model extends RouterTarget = RouterTarget> {
|
|
17
29
|
readonly url: string;
|
|
18
30
|
readonly kind: PageKind;
|
|
19
|
-
readonly model:
|
|
31
|
+
readonly model: Model;
|
|
20
32
|
}
|
|
21
33
|
/**
|
|
22
34
|
* Interface which routers must conform to.
|
|
@@ -28,36 +40,36 @@ export interface Router {
|
|
|
28
40
|
*/
|
|
29
41
|
buildPages(project: ProjectReflection): PageDefinition[];
|
|
30
42
|
/**
|
|
31
|
-
* Can be used to check if the
|
|
43
|
+
* Can be used to check if the target can be linked to.
|
|
32
44
|
*/
|
|
33
|
-
hasUrl(
|
|
45
|
+
hasUrl(target: RouterTarget): boolean;
|
|
34
46
|
/**
|
|
35
|
-
* Get a list of all
|
|
47
|
+
* Get a list of all targets which can be linked to.
|
|
36
48
|
* This is used for creating the search index.
|
|
37
49
|
*/
|
|
38
|
-
|
|
50
|
+
getLinkTargets(): RouterTarget[];
|
|
39
51
|
/**
|
|
40
|
-
* Gets an anchor for this
|
|
41
|
-
* May be undefined if this
|
|
52
|
+
* Gets an anchor for this target within its containing page.
|
|
53
|
+
* May be undefined if this target owns its own page.
|
|
42
54
|
*/
|
|
43
|
-
getAnchor(refl:
|
|
55
|
+
getAnchor(refl: RouterTarget): string | undefined;
|
|
44
56
|
/**
|
|
45
|
-
* Returns true if the
|
|
57
|
+
* Returns true if the target has its own page, false if embedded within
|
|
46
58
|
* another page.
|
|
47
59
|
*/
|
|
48
|
-
hasOwnDocument(refl:
|
|
60
|
+
hasOwnDocument(refl: RouterTarget): boolean;
|
|
49
61
|
/**
|
|
50
62
|
* Should return a URL which when clicked on the page containing `from`
|
|
51
63
|
* takes the user to the page/anchor containing `to`.
|
|
52
64
|
*/
|
|
53
|
-
relativeUrl(from:
|
|
65
|
+
relativeUrl(from: RouterTarget, to: RouterTarget): string;
|
|
54
66
|
/**
|
|
55
67
|
* Should return a URL relative to the project base. This is used for
|
|
56
68
|
* determining links to items in the assets folder.
|
|
57
69
|
*/
|
|
58
|
-
baseRelativeUrl(from:
|
|
70
|
+
baseRelativeUrl(from: RouterTarget, target: string): string;
|
|
59
71
|
/**
|
|
60
|
-
* Get the full URL to the
|
|
72
|
+
* Get the full URL to the target. In TypeDoc's default router this
|
|
61
73
|
* is equivalent to `relativeUrl(project, refl)`, but this might not be
|
|
62
74
|
* the case for custom routers which place the project somewhere else
|
|
63
75
|
* besides `index.html`.
|
|
@@ -65,13 +77,13 @@ export interface Router {
|
|
|
65
77
|
* The URL returned by this by the frontend JS when building dynamic URLs
|
|
66
78
|
* for the search, full hierarchy, and navigation components.
|
|
67
79
|
*/
|
|
68
|
-
getFullUrl(refl:
|
|
80
|
+
getFullUrl(refl: RouterTarget): string;
|
|
69
81
|
/**
|
|
70
|
-
* Responsible for getting a slugger for the given
|
|
71
|
-
*
|
|
72
|
-
*
|
|
82
|
+
* Responsible for getting a slugger for the given target. If a
|
|
83
|
+
* target is not associated with a page, the slugger for the parent
|
|
84
|
+
* target should be returned instead.
|
|
73
85
|
*/
|
|
74
|
-
getSlugger(reflection:
|
|
86
|
+
getSlugger(reflection: RouterTarget): Slugger;
|
|
75
87
|
}
|
|
76
88
|
/**
|
|
77
89
|
* Base router class intended to make it easier to implement a router.
|
|
@@ -84,36 +96,36 @@ export declare abstract class BaseRouter implements Router {
|
|
|
84
96
|
readonly application: Application;
|
|
85
97
|
extension: string;
|
|
86
98
|
protected usedFileNames: Set<string>;
|
|
87
|
-
protected sluggers: Map<
|
|
88
|
-
protected fullUrls: Map<
|
|
89
|
-
protected anchors: Map<
|
|
99
|
+
protected sluggers: Map<RouterTarget, Slugger>;
|
|
100
|
+
protected fullUrls: Map<RouterTarget, string>;
|
|
101
|
+
protected anchors: Map<RouterTarget, string>;
|
|
90
102
|
protected accessor sluggerConfiguration: TypeDocOptionMap["sluggerConfiguration"];
|
|
91
103
|
protected accessor includeHierarchySummary: boolean;
|
|
92
104
|
constructor(application: Application);
|
|
93
105
|
/**
|
|
94
|
-
* Should return the base-relative desired file name for a
|
|
106
|
+
* Should return the base-relative desired file name for a router target.
|
|
95
107
|
* This name may not be used exactly as TypeDoc will detect conflicts
|
|
96
108
|
* and automatically introduce a unique identifier to the URL to resolve
|
|
97
109
|
* them.
|
|
98
110
|
*/
|
|
99
|
-
protected abstract getIdealBaseName(reflection:
|
|
111
|
+
protected abstract getIdealBaseName(reflection: RouterTarget): string;
|
|
100
112
|
buildPages(project: ProjectReflection): PageDefinition[];
|
|
101
|
-
hasUrl(
|
|
102
|
-
|
|
103
|
-
getAnchor(
|
|
104
|
-
hasOwnDocument(
|
|
105
|
-
relativeUrl(from:
|
|
106
|
-
baseRelativeUrl(from:
|
|
107
|
-
getFullUrl(
|
|
108
|
-
getSlugger(
|
|
113
|
+
hasUrl(target: RouterTarget): boolean;
|
|
114
|
+
getLinkTargets(): RouterTarget[];
|
|
115
|
+
getAnchor(target: RouterTarget): string | undefined;
|
|
116
|
+
hasOwnDocument(target: RouterTarget): boolean;
|
|
117
|
+
relativeUrl(from: RouterTarget, to: RouterTarget): string;
|
|
118
|
+
baseRelativeUrl(from: RouterTarget, target: string): string;
|
|
119
|
+
getFullUrl(target: RouterTarget): string;
|
|
120
|
+
getSlugger(target: RouterTarget): Slugger;
|
|
109
121
|
/**
|
|
110
122
|
* Should the page kind to use if a reflection should have its own rendered
|
|
111
123
|
* page in the output. Note that once `undefined` is returned, children of
|
|
112
124
|
* that reflection will not have their own document.
|
|
113
125
|
*/
|
|
114
|
-
protected getPageKind(
|
|
115
|
-
protected buildChildPages(
|
|
116
|
-
protected buildAnchors(
|
|
126
|
+
protected getPageKind(target: RouterTarget): PageKind | undefined;
|
|
127
|
+
protected buildChildPages(target: RouterTarget, outPages: PageDefinition[]): void;
|
|
128
|
+
protected buildAnchors(target: RouterTarget, pageTarget: RouterTarget): void;
|
|
117
129
|
/** Strip non-url safe characters from the specified string. */
|
|
118
130
|
protected getUrlSafeName(name: string): string;
|
|
119
131
|
protected getFileName(baseName: string): string;
|