typedoc 0.24.8 → 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 +10 -8
- package/dist/lib/application.js +47 -20
- 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/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 -8
- package/dist/lib/converter/factories/index-signature.js +2 -1
- package/dist/lib/converter/plugins/CategoryPlugin.js +2 -1
- package/dist/lib/converter/plugins/CommentPlugin.js +2 -1
- package/dist/lib/converter/plugins/GroupPlugin.js +3 -2
- package/dist/lib/converter/plugins/ImplementsPlugin.js +8 -5
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +2 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.js +11 -4
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +4 -2
- package/dist/lib/converter/plugins/PackagePlugin.js +2 -1
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +1 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +31 -12
- package/dist/lib/converter/plugins/TypePlugin.js +12 -10
- 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 +1 -0
- 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 +1 -0
- package/dist/lib/models/reflections/kind.d.ts +4 -4
- package/dist/lib/models/reflections/kind.js +5 -7
- 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 +2 -2
- package/dist/lib/output/plugins/AssetsPlugin.js +2 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +2 -1
- package/dist/lib/output/renderer.js +3 -2
- package/dist/lib/output/theme.d.ts +1 -1
- package/dist/lib/output/theme.js +2 -1
- package/dist/lib/output/themes/MarkedPlugin.js +2 -1
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +2 -9
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +1 -10
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +16 -14
- 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 +0 -3
- package/dist/lib/output/themes/default/partials/member.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +3 -3
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +27 -14
- package/dist/lib/output/themes/default/partials/parameter.js +3 -3
- 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/utils/entry-point.d.ts +0 -6
- package/dist/lib/utils/entry-point.js +0 -99
- package/dist/lib/utils/jsx.d.ts +1 -1
- package/dist/lib/utils/jsx.js +23 -14
- package/dist/lib/utils/options/declaration.d.ts +3 -1
- package/dist/lib/utils/options/declaration.js +1 -1
- 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 +14 -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,24 +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.
|
|
80
81
|
*
|
|
81
82
|
* @example
|
|
82
83
|
* Initialize the application with pretty-printing output disabled.
|
|
83
84
|
* ```ts
|
|
84
|
-
* const app =
|
|
85
|
-
* app.bootstrap({ pretty: false });
|
|
85
|
+
* const app = Application.bootstrap({ pretty: false });
|
|
86
86
|
* ```
|
|
87
87
|
*
|
|
88
|
-
* @param options
|
|
88
|
+
* @param options Options to set during initialization
|
|
89
|
+
* @param readers Option readers to use to discover options from config files.
|
|
89
90
|
*/
|
|
90
|
-
bootstrap(options?: Partial<TypeDocOptions
|
|
91
|
+
static bootstrap(options?: Partial<TypeDocOptions>, readers?: readonly OptionsReader[]): Promise<Application>;
|
|
92
|
+
private _bootstrap;
|
|
91
93
|
private setOptions;
|
|
92
94
|
/**
|
|
93
95
|
* Return the path to the TypeScript compiler.
|
|
@@ -104,7 +106,7 @@ export declare class Application extends ChildableComponent<Application, Abstrac
|
|
|
104
106
|
*
|
|
105
107
|
* @returns An instance of ProjectReflection on success, undefined otherwise.
|
|
106
108
|
*/
|
|
107
|
-
convert(): ProjectReflection | undefined
|
|
109
|
+
convert(): Promise<ProjectReflection | undefined>;
|
|
108
110
|
convertAndWatch(success: (project: ProjectReflection) => Promise<void>): void;
|
|
109
111
|
validate(project: ProjectReflection): void;
|
|
110
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
|
*
|
|
@@ -72,11 +83,14 @@ const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
|
|
|
72
83
|
* Both the {@link Converter} and the {@link Renderer} emit a series of events while processing the project.
|
|
73
84
|
* Subscribe to these Events to control the application flow or alter the output.
|
|
74
85
|
*/
|
|
75
|
-
let Application =
|
|
86
|
+
let Application = Application_1 = class Application extends component_1.ChildableComponent {
|
|
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,21 +100,27 @@ let Application = exports.Application = Application_1 = class Application extend
|
|
|
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.
|
|
@@ -108,16 +128,22 @@ let Application = exports.Application = Application_1 = class Application extend
|
|
|
108
128
|
* @example
|
|
109
129
|
* Initialize the application with pretty-printing output disabled.
|
|
110
130
|
* ```ts
|
|
111
|
-
* const app =
|
|
112
|
-
* app.bootstrap({ pretty: false });
|
|
131
|
+
* const app = Application.bootstrap({ pretty: false });
|
|
113
132
|
* ```
|
|
114
133
|
*
|
|
115
|
-
* @param options
|
|
134
|
+
* @param options Options to set during initialization
|
|
135
|
+
* @param readers Option readers to use to discover options from config files.
|
|
116
136
|
*/
|
|
117
|
-
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) {
|
|
118
144
|
this.options.reset();
|
|
119
145
|
this.setOptions(options, /* reportErrors */ false);
|
|
120
|
-
this.options.read(this.logger);
|
|
146
|
+
await this.options.read(this.logger);
|
|
121
147
|
this.setOptions(options);
|
|
122
148
|
this.logger.level = this.options.getValue("logLevel");
|
|
123
149
|
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
|
|
@@ -159,7 +185,7 @@ let Application = exports.Application = Application_1 = class Application extend
|
|
|
159
185
|
*
|
|
160
186
|
* @returns An instance of ProjectReflection on success, undefined otherwise.
|
|
161
187
|
*/
|
|
162
|
-
convert() {
|
|
188
|
+
async convert() {
|
|
163
189
|
const start = Date.now();
|
|
164
190
|
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
|
|
165
191
|
// with a few different settings.
|
|
@@ -341,7 +367,7 @@ let Application = exports.Application = Application_1 = class Application extend
|
|
|
341
367
|
"",
|
|
342
368
|
].join("\n");
|
|
343
369
|
}
|
|
344
|
-
_convertPackages() {
|
|
370
|
+
async _convertPackages() {
|
|
345
371
|
if (!this.options.isSet("entryPoints")) {
|
|
346
372
|
this.logger.error("No entry points provided to packages mode, documentation cannot be generated.");
|
|
347
373
|
return;
|
|
@@ -359,14 +385,14 @@ let Application = exports.Application = Application_1 = class Application extend
|
|
|
359
385
|
const opts = origOptions.copyForPackage(dir);
|
|
360
386
|
// Invalid links should only be reported after everything has been merged.
|
|
361
387
|
opts.setValue("validation", { invalidLink: false });
|
|
362
|
-
opts.read(this.logger, dir);
|
|
388
|
+
await opts.read(this.logger, dir);
|
|
363
389
|
if (opts.getValue("entryPointStrategy") ===
|
|
364
390
|
entry_point_1.EntryPointStrategy.Packages) {
|
|
365
391
|
this.logger.error(`Project at ${(0, paths_1.nicePath)(dir)} has entryPointStrategy set to packages, but nested packages are not supported.`);
|
|
366
392
|
continue;
|
|
367
393
|
}
|
|
368
394
|
this.options = opts;
|
|
369
|
-
const project = this.convert();
|
|
395
|
+
const project = await this.convert();
|
|
370
396
|
if (project) {
|
|
371
397
|
this.validate(project);
|
|
372
398
|
projects.push(this.serializer.projectToObject(project, process.cwd()));
|
|
@@ -419,6 +445,7 @@ let Application = exports.Application = Application_1 = class Application extend
|
|
|
419
445
|
return result;
|
|
420
446
|
}
|
|
421
447
|
};
|
|
448
|
+
exports.Application = Application;
|
|
422
449
|
/**
|
|
423
450
|
* The version number of TypeDoc.
|
|
424
451
|
*/
|
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,
|
|
@@ -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;
|
|
@@ -28,7 +28,7 @@ const linkResolver_1 = require("./comments/linkResolver");
|
|
|
28
28
|
/**
|
|
29
29
|
* Compiles source files using TypeScript and converts compiler symbols to reflections.
|
|
30
30
|
*/
|
|
31
|
-
let Converter =
|
|
31
|
+
let Converter = Converter_1 = class Converter extends component_1.ChildableComponent {
|
|
32
32
|
get config() {
|
|
33
33
|
return this._config || this._buildCommentParserConfig();
|
|
34
34
|
}
|
|
@@ -122,10 +122,10 @@ let Converter = exports.Converter = Converter_1 = class Converter extends compon
|
|
|
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 = exports.Converter = Converter_1 = class Converter extends compon
|
|
|
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 = exports.Converter = Converter_1 = class Converter extends compon
|
|
|
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 = exports.Converter = Converter_1 = class Converter extends compon
|
|
|
248
248
|
return this._config;
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
+
exports.Converter = Converter;
|
|
251
252
|
/**
|
|
252
253
|
* General events
|
|
253
254
|
*/
|
|
@@ -343,6 +344,9 @@ __decorate([
|
|
|
343
344
|
__decorate([
|
|
344
345
|
(0, utils_1.BindOption)("useTsLinkResolution")
|
|
345
346
|
], Converter.prototype, "useTsLinkResolution", void 0);
|
|
347
|
+
__decorate([
|
|
348
|
+
(0, utils_1.BindOption)("preserveLinkText")
|
|
349
|
+
], Converter.prototype, "preserveLinkText", void 0);
|
|
346
350
|
exports.Converter = Converter = Converter_1 = __decorate([
|
|
347
351
|
(0, component_1.Component)({
|
|
348
352
|
name: "converter",
|
|
@@ -361,7 +365,9 @@ function getSymbolForModuleLike(context, node) {
|
|
|
361
365
|
const sourceFile = node.getSourceFile();
|
|
362
366
|
const globalSymbols = context.checker
|
|
363
367
|
.getSymbolsInScope(node, typescript_1.default.SymbolFlags.ModuleMember)
|
|
364
|
-
.filter((s) => s
|
|
368
|
+
.filter((s) => s
|
|
369
|
+
.getDeclarations()
|
|
370
|
+
?.some((d) => d.getSourceFile() === sourceFile));
|
|
365
371
|
// Detect declaration files with declare module "foo" as their only export
|
|
366
372
|
// and lift that up one level as the source file symbol
|
|
367
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);
|
|
@@ -18,7 +18,7 @@ const utils_1 = require("../../utils");
|
|
|
18
18
|
*
|
|
19
19
|
* The handler sets the ´category´ property of all reflections.
|
|
20
20
|
*/
|
|
21
|
-
let CategoryPlugin =
|
|
21
|
+
let CategoryPlugin = CategoryPlugin_1 = class CategoryPlugin extends components_1.ConverterComponent {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
24
24
|
this.usedBoosts = new Set();
|
|
@@ -217,6 +217,7 @@ let CategoryPlugin = exports.CategoryPlugin = CategoryPlugin_1 = class CategoryP
|
|
|
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 = [];
|
|
@@ -88,7 +88,7 @@ const NEVER_RENDERED = [
|
|
|
88
88
|
* - Resolve `@link` tags to point to target reflections
|
|
89
89
|
*
|
|
90
90
|
*/
|
|
91
|
-
let CommentPlugin =
|
|
91
|
+
let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent {
|
|
92
92
|
get excludeNotDocumentedKinds() {
|
|
93
93
|
this._excludeKinds ?? (this._excludeKinds = this.application.options
|
|
94
94
|
.getValue("excludeNotDocumentedKinds")
|
|
@@ -403,6 +403,7 @@ let CommentPlugin = exports.CommentPlugin = class CommentPlugin extends componen
|
|
|
403
403
|
return isHidden;
|
|
404
404
|
}
|
|
405
405
|
};
|
|
406
|
+
exports.CommentPlugin = CommentPlugin;
|
|
406
407
|
__decorate([
|
|
407
408
|
(0, utils_1.BindOption)("excludeTags")
|
|
408
409
|
], CommentPlugin.prototype, "excludeTags", void 0);
|
|
@@ -20,7 +20,7 @@ const models_1 = require("../../models");
|
|
|
20
20
|
*
|
|
21
21
|
* The handler sets the `groups` property of all container reflections.
|
|
22
22
|
*/
|
|
23
|
-
let GroupPlugin =
|
|
23
|
+
let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.ConverterComponent {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
26
26
|
this.usedBoosts = new Set();
|
|
@@ -131,7 +131,7 @@ let GroupPlugin = exports.GroupPlugin = GroupPlugin_1 = class GroupPlugin extend
|
|
|
131
131
|
for (const name of this.getGroups(child)) {
|
|
132
132
|
let group = groups.get(name);
|
|
133
133
|
if (!group) {
|
|
134
|
-
group = new ReflectionGroup_1.ReflectionGroup(name);
|
|
134
|
+
group = new ReflectionGroup_1.ReflectionGroup(name, child);
|
|
135
135
|
groups.set(name, group);
|
|
136
136
|
}
|
|
137
137
|
group.children.push(child);
|
|
@@ -163,6 +163,7 @@ let GroupPlugin = exports.GroupPlugin = GroupPlugin_1 = class GroupPlugin extend
|
|
|
163
163
|
return aWeight - bWeight;
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
+
exports.GroupPlugin = GroupPlugin;
|
|
166
167
|
GroupPlugin.WEIGHTS = [];
|
|
167
168
|
__decorate([
|
|
168
169
|
(0, utils_1.BindOption)("searchGroupBoosts")
|