typedoc 0.24.7 → 0.25.0
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/README.md +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -1
- package/dist/lib/application.d.ts +16 -5
- package/dist/lib/application.js +53 -18
- package/dist/lib/cli.js +25 -21
- package/dist/lib/converter/comments/blockLexer.js +10 -1
- package/dist/lib/converter/comments/declarationReference.js +2 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.js +2 -1
- package/dist/lib/converter/comments/discovery.js +0 -1
- package/dist/lib/converter/comments/lexer.js +1 -1
- package/dist/lib/converter/comments/linkResolver.d.ts +5 -2
- package/dist/lib/converter/comments/linkResolver.js +21 -13
- package/dist/lib/converter/comments/parser.js +2 -1
- package/dist/lib/converter/converter.d.ts +2 -0
- package/dist/lib/converter/converter.js +14 -9
- package/dist/lib/converter/factories/index-signature.js +2 -1
- package/dist/lib/converter/plugins/CategoryPlugin.js +2 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +8 -4
- package/dist/lib/converter/plugins/GroupPlugin.js +3 -3
- package/dist/lib/converter/plugins/ImplementsPlugin.js +8 -6
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +2 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.js +11 -5
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +4 -3
- package/dist/lib/converter/plugins/PackagePlugin.js +2 -2
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +1 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +31 -13
- package/dist/lib/converter/plugins/TypePlugin.js +12 -11
- package/dist/lib/converter/symbols.js +15 -3
- package/dist/lib/converter/types.js +6 -1
- package/dist/lib/converter/utils/nodes.d.ts +2 -2
- package/dist/lib/converter/utils/repository.d.ts +15 -5
- package/dist/lib/converter/utils/repository.js +28 -11
- package/dist/lib/models/ReflectionGroup.d.ts +4 -2
- package/dist/lib/models/ReflectionGroup.js +3 -1
- package/dist/lib/models/comments/comment.d.ts +9 -2
- package/dist/lib/models/comments/comment.js +2 -0
- package/dist/lib/models/reflections/abstract.d.ts +2 -1
- package/dist/lib/models/reflections/abstract.js +4 -3
- package/dist/lib/models/reflections/container.d.ts +3 -0
- package/dist/lib/models/reflections/container.js +4 -1
- package/dist/lib/models/reflections/declaration.d.ts +1 -0
- package/dist/lib/models/reflections/declaration.js +2 -1
- package/dist/lib/models/reflections/kind.d.ts +4 -4
- package/dist/lib/models/reflections/kind.js +7 -9
- package/dist/lib/models/reflections/parameter.d.ts +3 -0
- package/dist/lib/models/reflections/parameter.js +3 -0
- package/dist/lib/models/reflections/project.d.ts +1 -0
- package/dist/lib/models/reflections/project.js +3 -1
- package/dist/lib/models/reflections/reference.d.ts +1 -0
- package/dist/lib/models/reflections/reference.js +1 -0
- package/dist/lib/models/reflections/signature.d.ts +3 -0
- package/dist/lib/models/reflections/signature.js +3 -0
- package/dist/lib/models/reflections/type-parameter.d.ts +3 -0
- package/dist/lib/models/reflections/type-parameter.js +3 -0
- package/dist/lib/models/sources/file.d.ts +2 -0
- package/dist/lib/models/sources/file.js +5 -0
- package/dist/lib/models/types.d.ts +24 -0
- package/dist/lib/models/types.js +21 -0
- package/dist/lib/output/components.js +2 -3
- package/dist/lib/output/events.d.ts +8 -2
- package/dist/lib/output/events.js +10 -4
- package/dist/lib/output/plugins/AssetsPlugin.js +2 -2
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +2 -2
- package/dist/lib/output/renderer.d.ts +2 -0
- package/dist/lib/output/renderer.js +7 -2
- package/dist/lib/output/theme.d.ts +1 -1
- package/dist/lib/output/theme.js +2 -2
- package/dist/lib/output/themes/MarkedPlugin.js +5 -3
- package/dist/lib/output/themes/default/DefaultTheme.js +1 -1
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +4 -8
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +3 -9
- package/dist/lib/output/themes/default/partials/comment.d.ts +3 -1
- package/dist/lib/output/themes/default/partials/comment.js +30 -10
- package/dist/lib/output/themes/default/partials/footer.js +1 -1
- package/dist/lib/output/themes/default/partials/header.js +1 -1
- package/dist/lib/output/themes/default/partials/icon.js +8 -12
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/member.declaration.js +34 -21
- package/dist/lib/output/themes/default/partials/member.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +6 -4
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +28 -15
- package/dist/lib/output/themes/default/partials/parameter.js +11 -7
- package/dist/lib/output/themes/default/partials/typeParameters.js +2 -1
- package/dist/lib/output/themes/default/templates/reflection.js +5 -2
- package/dist/lib/output/themes/lib.d.ts +1 -2
- package/dist/lib/output/themes/lib.js +1 -11
- package/dist/lib/serialization/schema.d.ts +37 -1
- package/dist/lib/serialization/serializer.js +1 -1
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +1 -1
- package/dist/lib/utils/entry-point.d.ts +0 -6
- package/dist/lib/utils/entry-point.js +0 -99
- package/dist/lib/utils/jsx.d.ts +4 -1
- package/dist/lib/utils/jsx.js +30 -16
- package/dist/lib/utils/loggers.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +4 -1
- package/dist/lib/utils/options/declaration.js +3 -3
- package/dist/lib/utils/options/options.d.ts +3 -9
- package/dist/lib/utils/options/options.js +5 -13
- package/dist/lib/utils/options/readers/typedoc.d.ts +4 -2
- package/dist/lib/utils/options/readers/typedoc.js +33 -7
- package/dist/lib/utils/options/sources/typedoc.js +15 -4
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +4 -0
- package/dist/lib/utils/package-manifest.d.ts +0 -25
- package/dist/lib/utils/package-manifest.js +7 -148
- package/dist/lib/utils/perf.js +26 -11
- package/dist/lib/utils/sort.js +0 -1
- package/dist/lib/validation/links.js +10 -2
- package/package.json +12 -12
- package/static/main.js +1 -1
- package/static/style.css +19 -7
- package/tsdoc.json +16 -0
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ https://github.com/Gerrit0/typedoc-packages-example
|
|
|
46
46
|
### Arguments
|
|
47
47
|
|
|
48
48
|
For a complete list of the command line arguments run `typedoc --help` or visit
|
|
49
|
-
[our website](https://typedoc.org/
|
|
49
|
+
[our website](https://typedoc.org/options/).
|
|
50
50
|
|
|
51
51
|
- `--out <path/to/documentation/>`<br>
|
|
52
52
|
Specifies the location the documentation should be written to. Defaults to `./docs`
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export { resetReflectionID } from "./lib/models/reflections/abstract";
|
|
|
5
5
|
* All symbols documented under the Models namespace are also available in the root import.
|
|
6
6
|
*/
|
|
7
7
|
export * as Models from "./lib/models";
|
|
8
|
+
/**
|
|
9
|
+
* All symbols documented under the Configuration namespace are also available in the root import.
|
|
10
|
+
*/
|
|
11
|
+
export * as Configuration from "./lib/utils/options";
|
|
8
12
|
export * from "./lib/models";
|
|
9
13
|
export { Converter, Context, type CommentParserConfig, type DeclarationReference, type SymbolReference, type ComponentPath, type Meaning, type MeaningKeyword, type ExternalResolveResult, type ExternalSymbolResolver, } from "./lib/converter";
|
|
10
14
|
export { Renderer, DefaultTheme, DefaultThemeRenderContext, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, IndexEvent, } from "./lib/output";
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.TypeScript = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.BindOption = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Models = exports.resetReflectionID = exports.Event = exports.EventDispatcher = exports.Application = void 0;
|
|
32
|
+
exports.TypeScript = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.BindOption = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Configuration = exports.Models = exports.resetReflectionID = exports.Event = exports.EventDispatcher = exports.Application = void 0;
|
|
33
33
|
var application_1 = require("./lib/application");
|
|
34
34
|
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
|
|
35
35
|
var events_1 = require("./lib/utils/events");
|
|
@@ -41,6 +41,10 @@ Object.defineProperty(exports, "resetReflectionID", { enumerable: true, get: fun
|
|
|
41
41
|
* All symbols documented under the Models namespace are also available in the root import.
|
|
42
42
|
*/
|
|
43
43
|
exports.Models = __importStar(require("./lib/models"));
|
|
44
|
+
/**
|
|
45
|
+
* All symbols documented under the Configuration namespace are also available in the root import.
|
|
46
|
+
*/
|
|
47
|
+
exports.Configuration = __importStar(require("./lib/utils/options"));
|
|
44
48
|
__exportStar(require("./lib/models"), exports);
|
|
45
49
|
var converter_1 = require("./lib/converter");
|
|
46
50
|
Object.defineProperty(exports, "Converter", { enumerable: true, get: function () { return converter_1.Converter; } });
|
|
@@ -2,11 +2,12 @@ import { Converter } from "./converter/index";
|
|
|
2
2
|
import { Renderer } from "./output/renderer";
|
|
3
3
|
import { Deserializer, Serializer } from "./serialization";
|
|
4
4
|
import type { ProjectReflection } from "./models/index";
|
|
5
|
-
import { Logger } from "./utils/index";
|
|
5
|
+
import { Logger, OptionsReader } from "./utils/index";
|
|
6
6
|
import { AbstractComponent, ChildableComponent } from "./utils/component";
|
|
7
7
|
import { Options } from "./utils";
|
|
8
8
|
import type { TypeDocOptions } from "./utils/options/declaration";
|
|
9
9
|
import { DocumentationEntryPoint, EntryPointStrategy } from "./utils/entry-point";
|
|
10
|
+
export declare function createAppForTesting(): Application;
|
|
10
11
|
/**
|
|
11
12
|
* The default TypeDoc main application class.
|
|
12
13
|
*
|
|
@@ -70,15 +71,25 @@ export declare class Application extends ChildableComponent<Application, Abstrac
|
|
|
70
71
|
/**
|
|
71
72
|
* Create a new TypeDoc application instance.
|
|
72
73
|
*/
|
|
73
|
-
constructor();
|
|
74
|
+
private constructor();
|
|
74
75
|
/**
|
|
75
76
|
* Initialize TypeDoc, loading plugins if applicable.
|
|
76
77
|
*/
|
|
77
|
-
bootstrapWithPlugins(options?: Partial<TypeDocOptions
|
|
78
|
+
static bootstrapWithPlugins(options?: Partial<TypeDocOptions>, readers?: readonly OptionsReader[]): Promise<Application>;
|
|
78
79
|
/**
|
|
79
80
|
* Initialize TypeDoc without loading plugins.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* Initialize the application with pretty-printing output disabled.
|
|
84
|
+
* ```ts
|
|
85
|
+
* const app = Application.bootstrap({ pretty: false });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @param options Options to set during initialization
|
|
89
|
+
* @param readers Option readers to use to discover options from config files.
|
|
80
90
|
*/
|
|
81
|
-
bootstrap(options?: Partial<TypeDocOptions
|
|
91
|
+
static bootstrap(options?: Partial<TypeDocOptions>, readers?: readonly OptionsReader[]): Promise<Application>;
|
|
92
|
+
private _bootstrap;
|
|
82
93
|
private setOptions;
|
|
83
94
|
/**
|
|
84
95
|
* Return the path to the TypeScript compiler.
|
|
@@ -95,7 +106,7 @@ export declare class Application extends ChildableComponent<Application, Abstrac
|
|
|
95
106
|
*
|
|
96
107
|
* @returns An instance of ProjectReflection on success, undefined otherwise.
|
|
97
108
|
*/
|
|
98
|
-
convert(): ProjectReflection | undefined
|
|
109
|
+
convert(): Promise<ProjectReflection | undefined>;
|
|
99
110
|
convertAndWatch(success: (project: ProjectReflection) => Promise<void>): void;
|
|
100
111
|
validate(project: ProjectReflection): void;
|
|
101
112
|
/**
|
package/dist/lib/application.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
33
|
};
|
|
34
34
|
var Application_1;
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Application = void 0;
|
|
36
|
+
exports.Application = exports.createAppForTesting = void 0;
|
|
37
37
|
const Path = __importStar(require("path"));
|
|
38
38
|
const typescript_1 = __importDefault(require("typescript"));
|
|
39
39
|
const index_1 = require("./converter/index");
|
|
@@ -59,6 +59,17 @@ const packageInfo = require("../../package.json");
|
|
|
59
59
|
const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
|
|
60
60
|
.split("||")
|
|
61
61
|
.map((version) => version.replace(/^\s*|\.x\s*$/g, ""));
|
|
62
|
+
const DETECTOR = Symbol();
|
|
63
|
+
function createAppForTesting() {
|
|
64
|
+
// @ts-expect-error private constructor
|
|
65
|
+
return new Application(DETECTOR);
|
|
66
|
+
}
|
|
67
|
+
exports.createAppForTesting = createAppForTesting;
|
|
68
|
+
const DEFAULT_READERS = [
|
|
69
|
+
new index_2.TypeDocReader(),
|
|
70
|
+
new index_2.PackageJsonReader(),
|
|
71
|
+
new index_2.TSConfigReader(),
|
|
72
|
+
];
|
|
62
73
|
/**
|
|
63
74
|
* The default TypeDoc main application class.
|
|
64
75
|
*
|
|
@@ -76,7 +87,10 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
76
87
|
/**
|
|
77
88
|
* Create a new TypeDoc application instance.
|
|
78
89
|
*/
|
|
79
|
-
constructor() {
|
|
90
|
+
constructor(detector) {
|
|
91
|
+
if (detector !== DETECTOR) {
|
|
92
|
+
throw new Error("An application handle must be retrieved with Application.bootstrap or Application.bootstrapWithPlugins");
|
|
93
|
+
}
|
|
80
94
|
super(null); // We own ourselves
|
|
81
95
|
/**
|
|
82
96
|
* The serializer used to generate JSON output.
|
|
@@ -86,29 +100,50 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
86
100
|
* The deserializer used to restore previously serialized JSON output.
|
|
87
101
|
*/
|
|
88
102
|
this.deserializer = new serialization_1.Deserializer(this);
|
|
103
|
+
/**
|
|
104
|
+
* The logger that should be used to output messages.
|
|
105
|
+
*/
|
|
89
106
|
this.logger = new index_2.ConsoleLogger();
|
|
90
|
-
this.options = new utils_1.Options(
|
|
107
|
+
this.options = new utils_1.Options();
|
|
91
108
|
this.converter = this.addComponent("converter", index_1.Converter);
|
|
92
109
|
this.renderer = this.addComponent("renderer", renderer_1.Renderer);
|
|
93
110
|
}
|
|
94
111
|
/**
|
|
95
112
|
* Initialize TypeDoc, loading plugins if applicable.
|
|
96
113
|
*/
|
|
97
|
-
async bootstrapWithPlugins(options = {}) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
await (
|
|
103
|
-
|
|
114
|
+
static async bootstrapWithPlugins(options = {}, readers = DEFAULT_READERS) {
|
|
115
|
+
const app = new Application_1(DETECTOR);
|
|
116
|
+
readers.forEach((r) => app.options.addReader(r));
|
|
117
|
+
app.options.reset();
|
|
118
|
+
app.setOptions(options, /* reportErrors */ false);
|
|
119
|
+
await app.options.read(new index_2.Logger());
|
|
120
|
+
app.logger.level = app.options.getValue("logLevel");
|
|
121
|
+
await (0, index_2.loadPlugins)(app, app.options.getValue("plugin"));
|
|
122
|
+
await app._bootstrap(options);
|
|
123
|
+
return app;
|
|
104
124
|
}
|
|
105
125
|
/**
|
|
106
126
|
* Initialize TypeDoc without loading plugins.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* Initialize the application with pretty-printing output disabled.
|
|
130
|
+
* ```ts
|
|
131
|
+
* const app = Application.bootstrap({ pretty: false });
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @param options Options to set during initialization
|
|
135
|
+
* @param readers Option readers to use to discover options from config files.
|
|
107
136
|
*/
|
|
108
|
-
bootstrap(options = {}) {
|
|
137
|
+
static async bootstrap(options = {}, readers = DEFAULT_READERS) {
|
|
138
|
+
const app = new Application_1(DETECTOR);
|
|
139
|
+
readers.forEach((r) => app.options.addReader(r));
|
|
140
|
+
await app._bootstrap(options);
|
|
141
|
+
return app;
|
|
142
|
+
}
|
|
143
|
+
async _bootstrap(options) {
|
|
109
144
|
this.options.reset();
|
|
110
145
|
this.setOptions(options, /* reportErrors */ false);
|
|
111
|
-
this.options.read(this.logger);
|
|
146
|
+
await this.options.read(this.logger);
|
|
112
147
|
this.setOptions(options);
|
|
113
148
|
this.logger.level = this.options.getValue("logLevel");
|
|
114
149
|
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
|
|
@@ -150,7 +185,7 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
150
185
|
*
|
|
151
186
|
* @returns An instance of ProjectReflection on success, undefined otherwise.
|
|
152
187
|
*/
|
|
153
|
-
convert() {
|
|
188
|
+
async convert() {
|
|
154
189
|
const start = Date.now();
|
|
155
190
|
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
|
|
156
191
|
// with a few different settings.
|
|
@@ -332,7 +367,7 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
332
367
|
"",
|
|
333
368
|
].join("\n");
|
|
334
369
|
}
|
|
335
|
-
_convertPackages() {
|
|
370
|
+
async _convertPackages() {
|
|
336
371
|
if (!this.options.isSet("entryPoints")) {
|
|
337
372
|
this.logger.error("No entry points provided to packages mode, documentation cannot be generated.");
|
|
338
373
|
return;
|
|
@@ -350,14 +385,14 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
350
385
|
const opts = origOptions.copyForPackage(dir);
|
|
351
386
|
// Invalid links should only be reported after everything has been merged.
|
|
352
387
|
opts.setValue("validation", { invalidLink: false });
|
|
353
|
-
opts.read(this.logger, dir);
|
|
388
|
+
await opts.read(this.logger, dir);
|
|
354
389
|
if (opts.getValue("entryPointStrategy") ===
|
|
355
390
|
entry_point_1.EntryPointStrategy.Packages) {
|
|
356
391
|
this.logger.error(`Project at ${(0, paths_1.nicePath)(dir)} has entryPointStrategy set to packages, but nested packages are not supported.`);
|
|
357
392
|
continue;
|
|
358
393
|
}
|
|
359
394
|
this.options = opts;
|
|
360
|
-
const project = this.convert();
|
|
395
|
+
const project = await this.convert();
|
|
361
396
|
if (project) {
|
|
362
397
|
this.validate(project);
|
|
363
398
|
projects.push(this.serializer.projectToObject(project, process.cwd()));
|
|
@@ -410,6 +445,7 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
410
445
|
return result;
|
|
411
446
|
}
|
|
412
447
|
};
|
|
448
|
+
exports.Application = Application;
|
|
413
449
|
/**
|
|
414
450
|
* The version number of TypeDoc.
|
|
415
451
|
*/
|
|
@@ -438,7 +474,6 @@ __decorate([
|
|
|
438
474
|
__decorate([
|
|
439
475
|
(0, utils_1.BindOption)("entryPoints")
|
|
440
476
|
], Application.prototype, "entryPoints", void 0);
|
|
441
|
-
Application = Application_1 = __decorate([
|
|
477
|
+
exports.Application = Application = Application_1 = __decorate([
|
|
442
478
|
(0, component_1.Component)({ name: "application", internal: true })
|
|
443
479
|
], Application);
|
|
444
|
-
exports.Application = Application;
|
package/dist/lib/cli.js
CHANGED
|
@@ -33,27 +33,32 @@ const ExitCodes = {
|
|
|
33
33
|
ExceptionThrown: 6,
|
|
34
34
|
};
|
|
35
35
|
const td = __importStar(require("typedoc"));
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
app
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
app.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
void main();
|
|
37
|
+
async function main() {
|
|
38
|
+
let app;
|
|
39
|
+
try {
|
|
40
|
+
const start = Date.now();
|
|
41
|
+
app = await td.Application.bootstrapWithPlugins({}, [
|
|
42
|
+
new td.ArgumentsReader(0),
|
|
43
|
+
new td.TypeDocReader(),
|
|
44
|
+
new td.PackageJsonReader(),
|
|
45
|
+
new td.TSConfigReader(),
|
|
46
|
+
new td.ArgumentsReader(300),
|
|
47
|
+
]);
|
|
48
|
+
const exitCode = await run(app);
|
|
49
|
+
app.logger.verbose(`Full run took ${Date.now() - start}ms`);
|
|
50
|
+
process.exit(exitCode);
|
|
48
51
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error("TypeDoc exiting with unexpected error:");
|
|
54
|
+
console.error(error);
|
|
55
|
+
if (app?.options.getValue("skipErrorChecking")) {
|
|
56
|
+
console.error("Try turning off --skipErrorChecking. If TypeDoc still crashes, please report a bug.");
|
|
57
|
+
}
|
|
58
|
+
process.exit(ExitCodes.ExceptionThrown);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
54
61
|
async function run(app) {
|
|
55
|
-
const start = Date.now();
|
|
56
|
-
await app.bootstrapWithPlugins();
|
|
57
62
|
if (app.options.getValue("version")) {
|
|
58
63
|
console.log(app.toString());
|
|
59
64
|
return ExitCodes.Ok;
|
|
@@ -85,7 +90,7 @@ async function run(app) {
|
|
|
85
90
|
});
|
|
86
91
|
return ExitCodes.Ok;
|
|
87
92
|
}
|
|
88
|
-
const project = app.convert();
|
|
93
|
+
const project = await app.convert();
|
|
89
94
|
if (!project) {
|
|
90
95
|
return ExitCodes.CompileError;
|
|
91
96
|
}
|
|
@@ -120,6 +125,5 @@ async function run(app) {
|
|
|
120
125
|
return ExitCodes.OutputError;
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
|
-
app.logger.verbose(`Full run took ${Date.now() - start}ms`);
|
|
124
128
|
return ExitCodes.Ok;
|
|
125
129
|
}
|
|
@@ -259,7 +259,7 @@ function* lexBlockComment2(file, pos, end, linkTags, checker) {
|
|
|
259
259
|
linkTags[linkTagIndex].pos === token.pos - 1) {
|
|
260
260
|
const link = linkTags[linkTagIndex];
|
|
261
261
|
if (link.name) {
|
|
262
|
-
const tsTarget = checker?.getSymbolAtLocation(link.name);
|
|
262
|
+
const tsTarget = checker?.getSymbolAtLocation(getRightmostName(link.name));
|
|
263
263
|
if (tsTarget) {
|
|
264
264
|
token.tsLinkTarget = new ReflectionSymbolId_1.ReflectionSymbolId((0, symbols_1.resolveAliasedSymbol)(tsTarget, checker));
|
|
265
265
|
token.tsLinkText = link.text.replace(/^\s*\|\s*/, "");
|
|
@@ -368,3 +368,12 @@ function discoverIndent(file, pos, end) {
|
|
|
368
368
|
const commentHasStars = pos < end && file[pos] === "*";
|
|
369
369
|
return [commentHasStars, indent];
|
|
370
370
|
}
|
|
371
|
+
function getRightmostName(name) {
|
|
372
|
+
if (typescript_1.default.isJSDocMemberName(name)) {
|
|
373
|
+
return name.right;
|
|
374
|
+
}
|
|
375
|
+
if (typescript_1.default.isQualifiedName(name)) {
|
|
376
|
+
return name.right;
|
|
377
|
+
}
|
|
378
|
+
return name;
|
|
379
|
+
}
|
|
@@ -126,7 +126,8 @@ function resolveKeyword(refl, kw) {
|
|
|
126
126
|
break;
|
|
127
127
|
case "new":
|
|
128
128
|
case "constructor":
|
|
129
|
-
if (refl.kindOf(models_1.ReflectionKind.ClassOrInterface |
|
|
129
|
+
if (refl.kindOf(models_1.ReflectionKind.ClassOrInterface |
|
|
130
|
+
models_1.ReflectionKind.TypeLiteral)) {
|
|
130
131
|
const ctor = refl.children?.find((c) => c.kindOf(models_1.ReflectionKind.Constructor));
|
|
131
132
|
return ctor?.signatures;
|
|
132
133
|
}
|
|
@@ -91,7 +91,6 @@ const wantedKinds = {
|
|
|
91
91
|
[models_1.ReflectionKind.Accessor]: [typescript_1.default.SyntaxKind.PropertyDeclaration],
|
|
92
92
|
[models_1.ReflectionKind.GetSignature]: [typescript_1.default.SyntaxKind.GetAccessor],
|
|
93
93
|
[models_1.ReflectionKind.SetSignature]: [typescript_1.default.SyntaxKind.SetAccessor],
|
|
94
|
-
[models_1.ReflectionKind.ObjectLiteral]: [typescript_1.default.SyntaxKind.ObjectLiteralExpression],
|
|
95
94
|
[models_1.ReflectionKind.TypeAlias]: [typescript_1.default.SyntaxKind.TypeAliasDeclaration],
|
|
96
95
|
[models_1.ReflectionKind.Reference]: [
|
|
97
96
|
typescript_1.default.SyntaxKind.NamespaceExport,
|
|
@@ -10,4 +10,4 @@ var TokenSyntaxKind;
|
|
|
10
10
|
TokenSyntaxKind["Tag"] = "tag";
|
|
11
11
|
TokenSyntaxKind["Code"] = "code";
|
|
12
12
|
TokenSyntaxKind["TypeAnnotation"] = "type";
|
|
13
|
-
})(TokenSyntaxKind
|
|
13
|
+
})(TokenSyntaxKind || (exports.TokenSyntaxKind = TokenSyntaxKind = {}));
|
|
@@ -13,5 +13,8 @@ export type ExternalResolveResult = {
|
|
|
13
13
|
* on and TypeScript resolved the link to some symbol, the ID of that symbol.
|
|
14
14
|
*/
|
|
15
15
|
export type ExternalSymbolResolver = (ref: DeclarationReference, refl: Reflection, part: Readonly<CommentDisplayPart> | undefined, symbolId: ReflectionSymbolId | undefined) => ExternalResolveResult | string | undefined;
|
|
16
|
-
export
|
|
17
|
-
|
|
16
|
+
export type LinkResolverOptions = {
|
|
17
|
+
preserveLinkText: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function resolveLinks(comment: Comment, reflection: Reflection, externalResolver: ExternalSymbolResolver, options: LinkResolverOptions): void;
|
|
20
|
+
export declare function resolvePartLinks(reflection: Reflection, parts: readonly CommentDisplayPart[], externalResolver: ExternalSymbolResolver, options: LinkResolverOptions): CommentDisplayPart[];
|
|
@@ -9,31 +9,31 @@ const models_1 = require("../../models");
|
|
|
9
9
|
const declarationReference_1 = require("./declarationReference");
|
|
10
10
|
const declarationReferenceResolver_1 = require("./declarationReferenceResolver");
|
|
11
11
|
const urlPrefix = /^(http|ftp)s?:\/\//;
|
|
12
|
-
function resolveLinks(comment, reflection, externalResolver) {
|
|
13
|
-
comment.summary = resolvePartLinks(reflection, comment.summary, externalResolver);
|
|
12
|
+
function resolveLinks(comment, reflection, externalResolver, options) {
|
|
13
|
+
comment.summary = resolvePartLinks(reflection, comment.summary, externalResolver, options);
|
|
14
14
|
for (const tag of comment.blockTags) {
|
|
15
|
-
tag.content = resolvePartLinks(reflection, tag.content, externalResolver);
|
|
15
|
+
tag.content = resolvePartLinks(reflection, tag.content, externalResolver, options);
|
|
16
16
|
}
|
|
17
17
|
if (reflection instanceof models_1.DeclarationReflection && reflection.readme) {
|
|
18
|
-
reflection.readme = resolvePartLinks(reflection, reflection.readme, externalResolver);
|
|
18
|
+
reflection.readme = resolvePartLinks(reflection, reflection.readme, externalResolver, options);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.resolveLinks = resolveLinks;
|
|
22
|
-
function resolvePartLinks(reflection, parts, externalResolver) {
|
|
23
|
-
return parts.flatMap((part) => processPart(reflection, part, externalResolver));
|
|
22
|
+
function resolvePartLinks(reflection, parts, externalResolver, options) {
|
|
23
|
+
return parts.flatMap((part) => processPart(reflection, part, externalResolver, options));
|
|
24
24
|
}
|
|
25
25
|
exports.resolvePartLinks = resolvePartLinks;
|
|
26
|
-
function processPart(reflection, part, externalResolver) {
|
|
26
|
+
function processPart(reflection, part, externalResolver, options) {
|
|
27
27
|
if (part.kind === "inline-tag") {
|
|
28
28
|
if (part.tag === "@link" ||
|
|
29
29
|
part.tag === "@linkcode" ||
|
|
30
30
|
part.tag === "@linkplain") {
|
|
31
|
-
return resolveLinkTag(reflection, part, externalResolver);
|
|
31
|
+
return resolveLinkTag(reflection, part, externalResolver, options);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return part;
|
|
35
35
|
}
|
|
36
|
-
function resolveLinkTag(reflection, part, externalResolver) {
|
|
36
|
+
function resolveLinkTag(reflection, part, externalResolver, options) {
|
|
37
37
|
let defaultDisplayText = "";
|
|
38
38
|
let pos = 0;
|
|
39
39
|
const end = part.text.length;
|
|
@@ -49,7 +49,9 @@ function resolveLinkTag(reflection, part, externalResolver) {
|
|
|
49
49
|
if (tsTarget) {
|
|
50
50
|
target = tsTarget;
|
|
51
51
|
pos = end;
|
|
52
|
-
defaultDisplayText =
|
|
52
|
+
defaultDisplayText =
|
|
53
|
+
part.tsLinkText ||
|
|
54
|
+
(options.preserveLinkText ? part.text : target.name);
|
|
53
55
|
}
|
|
54
56
|
else if (declRef) {
|
|
55
57
|
// If we didn't find a target, we might be pointing to a symbol in another project that will be merged in
|
|
@@ -58,7 +60,9 @@ function resolveLinkTag(reflection, part, externalResolver) {
|
|
|
58
60
|
const externalResolveResult = externalResolver(declRef[0], reflection, part, part.target instanceof models_1.ReflectionSymbolId
|
|
59
61
|
? part.target
|
|
60
62
|
: undefined);
|
|
61
|
-
defaultDisplayText =
|
|
63
|
+
defaultDisplayText = options.preserveLinkText
|
|
64
|
+
? part.text
|
|
65
|
+
: part.text.substring(0, pos);
|
|
62
66
|
switch (typeof externalResolveResult) {
|
|
63
67
|
case "string":
|
|
64
68
|
target = externalResolveResult;
|
|
@@ -75,14 +79,18 @@ function resolveLinkTag(reflection, part, externalResolver) {
|
|
|
75
79
|
target = (0, declarationReferenceResolver_1.resolveDeclarationReference)(reflection, declRef[0]);
|
|
76
80
|
pos = declRef[1];
|
|
77
81
|
if (target) {
|
|
78
|
-
defaultDisplayText =
|
|
82
|
+
defaultDisplayText = options.preserveLinkText
|
|
83
|
+
? part.text
|
|
84
|
+
: target.name;
|
|
79
85
|
}
|
|
80
86
|
else {
|
|
81
87
|
// If we didn't find a link, it might be a @link tag to an external symbol, check that next.
|
|
82
88
|
const externalResolveResult = externalResolver(declRef[0], reflection, part, part.target instanceof models_1.ReflectionSymbolId
|
|
83
89
|
? part.target
|
|
84
90
|
: undefined);
|
|
85
|
-
defaultDisplayText =
|
|
91
|
+
defaultDisplayText = options.preserveLinkText
|
|
92
|
+
? part.text
|
|
93
|
+
: part.text.substring(0, pos);
|
|
86
94
|
switch (typeof externalResolveResult) {
|
|
87
95
|
case "string":
|
|
88
96
|
target = externalResolveResult;
|
|
@@ -135,7 +135,8 @@ function blockTag(comment, lexer, config, warning) {
|
|
|
135
135
|
if (tagName === "@example" && config.jsDocCompatibility.exampleTag) {
|
|
136
136
|
content = exampleBlockContent(comment, lexer, config, warning);
|
|
137
137
|
}
|
|
138
|
-
else if (
|
|
138
|
+
else if (["@default", "@defaultValue"].includes(tagName) &&
|
|
139
|
+
config.jsDocCompatibility.defaultTag) {
|
|
139
140
|
content = defaultBlockContent(comment, lexer, config, warning);
|
|
140
141
|
}
|
|
141
142
|
else {
|
|
@@ -36,6 +36,8 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
36
36
|
externalSymbolLinkMappings: Record<string, Record<string, string>>;
|
|
37
37
|
/** @internal */
|
|
38
38
|
useTsLinkResolution: boolean;
|
|
39
|
+
/** @internal */
|
|
40
|
+
preserveLinkText: boolean;
|
|
39
41
|
private _config?;
|
|
40
42
|
private _externalSymbolResolvers;
|
|
41
43
|
get config(): CommentParserConfig;
|
|
@@ -122,10 +122,10 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
122
122
|
}
|
|
123
123
|
resolveLinks(comment, owner) {
|
|
124
124
|
if (comment instanceof index_1.Comment) {
|
|
125
|
-
(0, linkResolver_1.resolveLinks)(comment, owner, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id));
|
|
125
|
+
(0, linkResolver_1.resolveLinks)(comment, owner, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
|
-
return (0, linkResolver_1.resolvePartLinks)(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id));
|
|
128
|
+
return (0, linkResolver_1.resolvePartLinks)(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
@@ -192,13 +192,13 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
192
192
|
}
|
|
193
193
|
const allExports = getExports(context, node, symbol);
|
|
194
194
|
for (const exp of allExports.filter((exp) => isDirectExport(context.resolveAliasedSymbol(exp), node))) {
|
|
195
|
-
|
|
195
|
+
this.convertSymbol(moduleContext, exp);
|
|
196
196
|
}
|
|
197
197
|
return moduleContext;
|
|
198
198
|
}
|
|
199
199
|
convertReExports(moduleContext, node) {
|
|
200
200
|
for (const exp of getExports(moduleContext, node, moduleContext.project.getSymbolFromReflection(moduleContext.scope)).filter((exp) => !isDirectExport(moduleContext.resolveAliasedSymbol(exp), node))) {
|
|
201
|
-
|
|
201
|
+
this.convertSymbol(moduleContext, exp);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
@@ -210,8 +210,8 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
210
210
|
resolve(context) {
|
|
211
211
|
this.trigger(Converter_1.EVENT_RESOLVE_BEGIN, context);
|
|
212
212
|
const project = context.project;
|
|
213
|
-
for (const
|
|
214
|
-
this.trigger(Converter_1.EVENT_RESOLVE, context,
|
|
213
|
+
for (const id in project.reflections) {
|
|
214
|
+
this.trigger(Converter_1.EVENT_RESOLVE, context, project.reflections[id]);
|
|
215
215
|
}
|
|
216
216
|
this.trigger(Converter_1.EVENT_RESOLVE_END, context);
|
|
217
217
|
}
|
|
@@ -248,6 +248,7 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
248
248
|
return this._config;
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
+
exports.Converter = Converter;
|
|
251
252
|
/**
|
|
252
253
|
* General events
|
|
253
254
|
*/
|
|
@@ -343,14 +344,16 @@ __decorate([
|
|
|
343
344
|
__decorate([
|
|
344
345
|
(0, utils_1.BindOption)("useTsLinkResolution")
|
|
345
346
|
], Converter.prototype, "useTsLinkResolution", void 0);
|
|
346
|
-
|
|
347
|
+
__decorate([
|
|
348
|
+
(0, utils_1.BindOption)("preserveLinkText")
|
|
349
|
+
], Converter.prototype, "preserveLinkText", void 0);
|
|
350
|
+
exports.Converter = Converter = Converter_1 = __decorate([
|
|
347
351
|
(0, component_1.Component)({
|
|
348
352
|
name: "converter",
|
|
349
353
|
internal: true,
|
|
350
354
|
childClass: components_1.ConverterComponent,
|
|
351
355
|
})
|
|
352
356
|
], Converter);
|
|
353
|
-
exports.Converter = Converter;
|
|
354
357
|
function getSymbolForModuleLike(context, node) {
|
|
355
358
|
const symbol = context.checker.getSymbolAtLocation(node) ?? node.symbol;
|
|
356
359
|
if (symbol) {
|
|
@@ -362,7 +365,9 @@ function getSymbolForModuleLike(context, node) {
|
|
|
362
365
|
const sourceFile = node.getSourceFile();
|
|
363
366
|
const globalSymbols = context.checker
|
|
364
367
|
.getSymbolsInScope(node, typescript_1.default.SymbolFlags.ModuleMember)
|
|
365
|
-
.filter((s) => s
|
|
368
|
+
.filter((s) => s
|
|
369
|
+
.getDeclarations()
|
|
370
|
+
?.some((d) => d.getSourceFile() === sourceFile));
|
|
366
371
|
// Detect declaration files with declare module "foo" as their only export
|
|
367
372
|
// and lift that up one level as the source file symbol
|
|
368
373
|
if (globalSymbols.length === 1 &&
|
|
@@ -16,7 +16,8 @@ function convertIndexSignature(context, symbol) {
|
|
|
16
16
|
// and number index signatures... { [x: string]: 1 | 2; [x: number]: 2 }
|
|
17
17
|
// will be misrepresented.
|
|
18
18
|
const indexDeclaration = indexSymbol.getDeclarations()?.[0];
|
|
19
|
-
(0, assert_1.default)(indexDeclaration &&
|
|
19
|
+
(0, assert_1.default)(indexDeclaration &&
|
|
20
|
+
typescript_1.default.isIndexSignatureDeclaration(indexDeclaration));
|
|
20
21
|
const param = indexDeclaration.parameters[0];
|
|
21
22
|
(0, assert_1.default)(param && typescript_1.default.isParameter(param));
|
|
22
23
|
const index = new models_1.SignatureReflection("__index", models_1.ReflectionKind.IndexSignature, context.scope);
|
|
@@ -217,6 +217,7 @@ let CategoryPlugin = CategoryPlugin_1 = class CategoryPlugin extends components_
|
|
|
217
217
|
return aWeight - bWeight;
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
|
+
exports.CategoryPlugin = CategoryPlugin;
|
|
220
221
|
// For use in static methods
|
|
221
222
|
CategoryPlugin.defaultCategory = "Other";
|
|
222
223
|
CategoryPlugin.WEIGHTS = [];
|
|
@@ -232,7 +233,6 @@ __decorate([
|
|
|
232
233
|
__decorate([
|
|
233
234
|
(0, utils_1.BindOption)("searchCategoryBoosts")
|
|
234
235
|
], CategoryPlugin.prototype, "boosts", void 0);
|
|
235
|
-
CategoryPlugin = CategoryPlugin_1 = __decorate([
|
|
236
|
+
exports.CategoryPlugin = CategoryPlugin = CategoryPlugin_1 = __decorate([
|
|
236
237
|
(0, components_1.Component)({ name: "category" })
|
|
237
238
|
], CategoryPlugin);
|
|
238
|
-
exports.CategoryPlugin = CategoryPlugin;
|
|
@@ -289,11 +289,15 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
289
289
|
if (!signatures.length) {
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
const comment = reflection.
|
|
292
|
+
const comment = reflection.kindOf(models_1.ReflectionKind.ClassOrInterface)
|
|
293
|
+
? undefined
|
|
294
|
+
: reflection.comment;
|
|
293
295
|
// Since this reflection has signatures, remove the comment from the parent
|
|
294
296
|
// reflection. This is important so that in type aliases we don't end up with
|
|
295
297
|
// a comment rendered twice.
|
|
296
|
-
|
|
298
|
+
if (!reflection.kindOf(models_1.ReflectionKind.ClassOrInterface)) {
|
|
299
|
+
delete reflection.comment;
|
|
300
|
+
}
|
|
297
301
|
for (const signature of signatures) {
|
|
298
302
|
const childComment = (signature.comment || (signature.comment = comment?.clone()));
|
|
299
303
|
if (!childComment)
|
|
@@ -399,6 +403,7 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
399
403
|
return isHidden;
|
|
400
404
|
}
|
|
401
405
|
};
|
|
406
|
+
exports.CommentPlugin = CommentPlugin;
|
|
402
407
|
__decorate([
|
|
403
408
|
(0, utils_1.BindOption)("excludeTags")
|
|
404
409
|
], CommentPlugin.prototype, "excludeTags", void 0);
|
|
@@ -414,10 +419,9 @@ __decorate([
|
|
|
414
419
|
__decorate([
|
|
415
420
|
(0, utils_1.BindOption)("excludeNotDocumented")
|
|
416
421
|
], CommentPlugin.prototype, "excludeNotDocumented", void 0);
|
|
417
|
-
CommentPlugin = __decorate([
|
|
422
|
+
exports.CommentPlugin = CommentPlugin = __decorate([
|
|
418
423
|
(0, components_1.Component)({ name: "comment" })
|
|
419
424
|
], CommentPlugin);
|
|
420
|
-
exports.CommentPlugin = CommentPlugin;
|
|
421
425
|
function inTypeLiteral(refl) {
|
|
422
426
|
while (refl) {
|
|
423
427
|
if (refl.kind === models_1.ReflectionKind.TypeLiteral) {
|