typedoc 0.26.3 → 0.26.5
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 +2 -2
- package/dist/index.js +2 -1
- package/dist/lib/application.js +1 -1
- package/dist/lib/converter/comments/discovery.js +5 -0
- package/dist/lib/converter/comments/parser.js +2 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +2 -4
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.js +91 -72
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +5 -3
- package/dist/lib/internationalization/translatable.d.ts +2 -0
- package/dist/lib/internationalization/translatable.js +2 -0
- package/dist/lib/models/FileRegistry.js +3 -0
- package/dist/lib/models/comments/comment.d.ts +12 -0
- package/dist/lib/models/comments/comment.js +33 -0
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +25 -16
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.reference.js +10 -4
- package/dist/lib/utils/array.d.ts +2 -2
- package/dist/lib/utils/array.js +3 -3
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +2 -1
- package/dist/lib/utils/minimalSourceFile.d.ts +1 -1
- package/dist/lib/utils/minimalSourceFile.js +9 -1
- package/dist/lib/utils/options/defaults.d.ts +23 -0
- package/dist/lib/utils/options/defaults.js +120 -0
- package/dist/lib/utils/options/index.d.ts +1 -0
- package/dist/lib/utils/options/index.js +3 -1
- package/dist/lib/utils/options/sources/typedoc.js +12 -64
- package/dist/lib/utils/sort.js +4 -29
- package/dist/lib/validation/documentation.js +5 -1
- package/dist/lib/validation/links.js +45 -27
- package/package.json +1 -1
- package/static/main.js +4 -4
package/dist/lib/utils/array.js
CHANGED
|
@@ -15,12 +15,12 @@ exports.filter = filter;
|
|
|
15
15
|
exports.emptyArray = [];
|
|
16
16
|
/**
|
|
17
17
|
* Inserts an item into an array sorted by priority. If two items have the same priority,
|
|
18
|
-
* the item will be inserted later will be placed
|
|
18
|
+
* the item will be inserted later will be placed later in the array.
|
|
19
19
|
* @param arr modified by inserting item.
|
|
20
20
|
* @param item
|
|
21
21
|
*/
|
|
22
22
|
function insertPrioritySorted(arr, item) {
|
|
23
|
-
const index = binaryFindPartition(arr, (v) => v.priority
|
|
23
|
+
const index = binaryFindPartition(arr, (v) => v.priority < item.priority);
|
|
24
24
|
arr.splice(index === -1 ? arr.length : index, 0, item);
|
|
25
25
|
return arr;
|
|
26
26
|
}
|
|
@@ -119,7 +119,7 @@ function* zip(...args) {
|
|
|
119
119
|
}
|
|
120
120
|
function filterMap(iter, fn) {
|
|
121
121
|
const result = [];
|
|
122
|
-
for (const item of iter) {
|
|
122
|
+
for (const item of iter || []) {
|
|
123
123
|
const newItem = fn(item);
|
|
124
124
|
if (newItem !== void 0) {
|
|
125
125
|
result.push(newItem);
|
|
@@ -8,7 +8,7 @@ export type { IfInternal, NeverIfInternal, Chars } from "./general";
|
|
|
8
8
|
export { assertNever } from "./general";
|
|
9
9
|
export { ConsoleLogger, Logger, LogLevel } from "./loggers";
|
|
10
10
|
export { DefaultMap } from "./map";
|
|
11
|
-
export { ArgumentsReader, Option, CommentStyle, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, } from "./options";
|
|
11
|
+
export { ArgumentsReader, Option, CommentStyle, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, OptionDefaults, } from "./options";
|
|
12
12
|
export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, KeyToDeclaration, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, FlagsDeclarationOption, ObjectDeclarationOption, OptionsReader, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, ValidationOptions, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, JsDocCompatibility, } from "./options";
|
|
13
13
|
export { loadPlugins } from "./plugins";
|
|
14
14
|
export { getSortFunction } from "./sort";
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.MinimalSourceFile = exports.Validation = exports.renderElement = exports.Raw = exports.Fragment = exports.JSX = exports.EventHooks = exports.getSortFunction = exports.loadPlugins = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.CommentStyle = exports.Option = exports.ArgumentsReader = exports.DefaultMap = exports.LogLevel = exports.Logger = exports.ConsoleLogger = exports.assertNever = exports.normalizePath = exports.discoverPackageJson = exports.discoverInParentDir = exports.writeFileSync = exports.writeFile = exports.readFile = exports.getCommonDirectory = exports.copySync = exports.copy = exports.isFile = exports.EventDispatcher = exports.Component = exports.ChildableComponent = exports.AbstractComponent = exports.unique = exports.removeIfPresent = exports.removeIf = exports.partition = exports.insertPrioritySorted = exports.filterMap = void 0;
|
|
29
|
+
exports.MinimalSourceFile = exports.Validation = exports.renderElement = exports.Raw = exports.Fragment = exports.JSX = exports.EventHooks = exports.getSortFunction = exports.loadPlugins = exports.OptionDefaults = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.CommentStyle = exports.Option = exports.ArgumentsReader = exports.DefaultMap = exports.LogLevel = exports.Logger = exports.ConsoleLogger = exports.assertNever = exports.normalizePath = exports.discoverPackageJson = exports.discoverInParentDir = exports.writeFileSync = exports.writeFile = exports.readFile = exports.getCommonDirectory = exports.copySync = exports.copy = exports.isFile = exports.EventDispatcher = exports.Component = exports.ChildableComponent = exports.AbstractComponent = exports.unique = exports.removeIfPresent = exports.removeIf = exports.partition = exports.insertPrioritySorted = exports.filterMap = void 0;
|
|
30
30
|
var array_1 = require("./array");
|
|
31
31
|
Object.defineProperty(exports, "filterMap", { enumerable: true, get: function () { return array_1.filterMap; } });
|
|
32
32
|
Object.defineProperty(exports, "insertPrioritySorted", { enumerable: true, get: function () { return array_1.insertPrioritySorted; } });
|
|
@@ -71,6 +71,7 @@ Object.defineProperty(exports, "ParameterHint", { enumerable: true, get: functio
|
|
|
71
71
|
Object.defineProperty(exports, "ParameterType", { enumerable: true, get: function () { return options_1.ParameterType; } });
|
|
72
72
|
Object.defineProperty(exports, "TSConfigReader", { enumerable: true, get: function () { return options_1.TSConfigReader; } });
|
|
73
73
|
Object.defineProperty(exports, "TypeDocReader", { enumerable: true, get: function () { return options_1.TypeDocReader; } });
|
|
74
|
+
Object.defineProperty(exports, "OptionDefaults", { enumerable: true, get: function () { return options_1.OptionDefaults; } });
|
|
74
75
|
var plugins_1 = require("./plugins");
|
|
75
76
|
Object.defineProperty(exports, "loadPlugins", { enumerable: true, get: function () { return plugins_1.loadPlugins; } });
|
|
76
77
|
var sort_1 = require("./sort");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LineAndCharacter, SourceFileLike } from "typescript";
|
|
2
2
|
export declare class MinimalSourceFile implements SourceFileLike {
|
|
3
|
-
readonly text: string;
|
|
4
3
|
readonly fileName: string;
|
|
4
|
+
readonly text: string;
|
|
5
5
|
constructor(text: string, fileName: string);
|
|
6
6
|
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
|
7
7
|
}
|
|
@@ -8,8 +8,16 @@ const array_1 = require("./array");
|
|
|
8
8
|
const lineStarts = new WeakMap();
|
|
9
9
|
class MinimalSourceFile {
|
|
10
10
|
constructor(text, fileName) {
|
|
11
|
-
this.text = text;
|
|
12
11
|
this.fileName = fileName;
|
|
12
|
+
// This is unfortunate, but the yaml library we use relies on the source
|
|
13
|
+
// text using LF line endings https://github.com/eemeli/yaml/issues/127.
|
|
14
|
+
// If we don't do this, in a simple document which includes a single key
|
|
15
|
+
// like:
|
|
16
|
+
// ---<CR><LF>
|
|
17
|
+
// title: Windows line endings<CR><LF>
|
|
18
|
+
// ---<CR><LF>
|
|
19
|
+
// we'll end up with a parsed title of "Windows line endings\r"
|
|
20
|
+
this.text = text.replaceAll("\r\n", "\n");
|
|
13
21
|
lineStarts.set(this, [0]);
|
|
14
22
|
}
|
|
15
23
|
getLineAndCharacterOfPosition(pos) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BundledLanguage } from "shiki" with { "resolution-mode": "import" };
|
|
2
|
+
import type { EnumKeys } from "../enum";
|
|
3
|
+
import type { ReflectionKind } from "../../models/index";
|
|
4
|
+
/**
|
|
5
|
+
* Default values for TypeDoc options. This object should not be modified.
|
|
6
|
+
*
|
|
7
|
+
* @privateRemarks
|
|
8
|
+
* These are declared here, rather than within the option declaration, so that
|
|
9
|
+
* they can be exposed as a part of the public API. The unfortunate type declaration
|
|
10
|
+
* is to control the type which appears in the generated documentation.
|
|
11
|
+
*/
|
|
12
|
+
export declare const OptionDefaults: {
|
|
13
|
+
excludeNotDocumentedKinds: readonly EnumKeys<typeof ReflectionKind>[];
|
|
14
|
+
excludeTags: readonly `@${string}`[];
|
|
15
|
+
blockTags: readonly `@${string}`[];
|
|
16
|
+
inlineTags: readonly `@${string}`[];
|
|
17
|
+
modifierTags: readonly `@${string}`[];
|
|
18
|
+
cascadedModifierTags: readonly `@${string}`[];
|
|
19
|
+
highlightLanguages: readonly BundledLanguage[];
|
|
20
|
+
sort: readonly string[];
|
|
21
|
+
kindSortOrder: readonly EnumKeys<typeof ReflectionKind>[];
|
|
22
|
+
requiredToBeDocumented: readonly EnumKeys<typeof ReflectionKind>[];
|
|
23
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.OptionDefaults = void 0;
|
|
27
|
+
const TagDefaults = __importStar(require("./tsdoc-defaults"));
|
|
28
|
+
/**
|
|
29
|
+
* Default values for TypeDoc options. This object should not be modified.
|
|
30
|
+
*
|
|
31
|
+
* @privateRemarks
|
|
32
|
+
* These are declared here, rather than within the option declaration, so that
|
|
33
|
+
* they can be exposed as a part of the public API. The unfortunate type declaration
|
|
34
|
+
* is to control the type which appears in the generated documentation.
|
|
35
|
+
*/
|
|
36
|
+
exports.OptionDefaults = {
|
|
37
|
+
excludeNotDocumentedKinds: [
|
|
38
|
+
"Module",
|
|
39
|
+
"Namespace",
|
|
40
|
+
"Enum",
|
|
41
|
+
// Not including enum member here by default
|
|
42
|
+
"Variable",
|
|
43
|
+
"Function",
|
|
44
|
+
"Class",
|
|
45
|
+
"Interface",
|
|
46
|
+
"Constructor",
|
|
47
|
+
"Property",
|
|
48
|
+
"Method",
|
|
49
|
+
"CallSignature",
|
|
50
|
+
"IndexSignature",
|
|
51
|
+
"ConstructorSignature",
|
|
52
|
+
"Accessor",
|
|
53
|
+
"GetSignature",
|
|
54
|
+
"SetSignature",
|
|
55
|
+
"TypeAlias",
|
|
56
|
+
"Reference",
|
|
57
|
+
],
|
|
58
|
+
excludeTags: [
|
|
59
|
+
"@override",
|
|
60
|
+
"@virtual",
|
|
61
|
+
"@privateRemarks",
|
|
62
|
+
"@satisfies",
|
|
63
|
+
"@overload",
|
|
64
|
+
],
|
|
65
|
+
blockTags: TagDefaults.blockTags,
|
|
66
|
+
inlineTags: TagDefaults.inlineTags,
|
|
67
|
+
modifierTags: TagDefaults.modifierTags,
|
|
68
|
+
cascadedModifierTags: ["@alpha", "@beta", "@experimental"],
|
|
69
|
+
highlightLanguages: [
|
|
70
|
+
"bash",
|
|
71
|
+
"console",
|
|
72
|
+
"css",
|
|
73
|
+
"html",
|
|
74
|
+
"javascript",
|
|
75
|
+
"json",
|
|
76
|
+
"jsonc",
|
|
77
|
+
"json5",
|
|
78
|
+
"tsx",
|
|
79
|
+
"typescript",
|
|
80
|
+
],
|
|
81
|
+
sort: ["kind", "instance-first", "alphabetical"],
|
|
82
|
+
kindSortOrder: [
|
|
83
|
+
"Document",
|
|
84
|
+
"Reference",
|
|
85
|
+
"Project",
|
|
86
|
+
"Module",
|
|
87
|
+
"Namespace",
|
|
88
|
+
"Enum",
|
|
89
|
+
"EnumMember",
|
|
90
|
+
"Class",
|
|
91
|
+
"Interface",
|
|
92
|
+
"TypeAlias",
|
|
93
|
+
"Constructor",
|
|
94
|
+
"Property",
|
|
95
|
+
"Variable",
|
|
96
|
+
"Function",
|
|
97
|
+
"Accessor",
|
|
98
|
+
"Method",
|
|
99
|
+
"Parameter",
|
|
100
|
+
"TypeParameter",
|
|
101
|
+
"TypeLiteral",
|
|
102
|
+
"CallSignature",
|
|
103
|
+
"ConstructorSignature",
|
|
104
|
+
"IndexSignature",
|
|
105
|
+
"GetSignature",
|
|
106
|
+
"SetSignature",
|
|
107
|
+
],
|
|
108
|
+
requiredToBeDocumented: [
|
|
109
|
+
"Enum",
|
|
110
|
+
"EnumMember",
|
|
111
|
+
"Variable",
|
|
112
|
+
"Function",
|
|
113
|
+
"Class",
|
|
114
|
+
"Interface",
|
|
115
|
+
"Property",
|
|
116
|
+
"Method",
|
|
117
|
+
"Accessor",
|
|
118
|
+
"TypeAlias",
|
|
119
|
+
],
|
|
120
|
+
};
|
|
@@ -3,3 +3,4 @@ export type { OptionsReader } from "./options";
|
|
|
3
3
|
export { ArgumentsReader, PackageJsonReader, TypeDocReader, TSConfigReader, } from "./readers";
|
|
4
4
|
export { CommentStyle, EmitStrategy, ParameterType, ParameterHint, } from "./declaration";
|
|
5
5
|
export type { TypeDocOptions, TypeDocOptionMap, ValidationOptions, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, ObjectDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, JsDocCompatibility, } from "./declaration";
|
|
6
|
+
export { OptionDefaults } from "./defaults";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParameterHint = exports.ParameterType = exports.EmitStrategy = exports.CommentStyle = exports.TSConfigReader = exports.TypeDocReader = exports.PackageJsonReader = exports.ArgumentsReader = exports.Option = exports.Options = void 0;
|
|
3
|
+
exports.OptionDefaults = exports.ParameterHint = exports.ParameterType = exports.EmitStrategy = exports.CommentStyle = exports.TSConfigReader = exports.TypeDocReader = exports.PackageJsonReader = exports.ArgumentsReader = exports.Option = exports.Options = void 0;
|
|
4
4
|
var options_1 = require("./options");
|
|
5
5
|
Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return options_1.Options; } });
|
|
6
6
|
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return options_1.Option; } });
|
|
@@ -14,3 +14,5 @@ Object.defineProperty(exports, "CommentStyle", { enumerable: true, get: function
|
|
|
14
14
|
Object.defineProperty(exports, "EmitStrategy", { enumerable: true, get: function () { return declaration_1.EmitStrategy; } });
|
|
15
15
|
Object.defineProperty(exports, "ParameterType", { enumerable: true, get: function () { return declaration_1.ParameterType; } });
|
|
16
16
|
Object.defineProperty(exports, "ParameterHint", { enumerable: true, get: function () { return declaration_1.ParameterHint; } });
|
|
17
|
+
var defaults_1 = require("./defaults");
|
|
18
|
+
Object.defineProperty(exports, "OptionDefaults", { enumerable: true, get: function () { return defaults_1.OptionDefaults; } });
|
|
@@ -30,10 +30,10 @@ const sort_1 = require("../../sort");
|
|
|
30
30
|
const entry_point_1 = require("../../entry-point");
|
|
31
31
|
const kind_1 = require("../../../models/reflections/kind");
|
|
32
32
|
const Validation = __importStar(require("../../validation"));
|
|
33
|
-
const tsdoc_defaults_1 = require("../tsdoc-defaults");
|
|
34
33
|
const enum_1 = require("../../enum");
|
|
35
34
|
const highlighter_1 = require("../../highlighter");
|
|
36
35
|
const set_1 = require("../../set");
|
|
36
|
+
const defaults_1 = require("../defaults");
|
|
37
37
|
// For convenience, added in the same order as they are documented on the website.
|
|
38
38
|
function addTypeDocOptions(options) {
|
|
39
39
|
///////////////////////////
|
|
@@ -172,27 +172,7 @@ function addTypeDocOptions(options) {
|
|
|
172
172
|
throw new Error(i18n.exclude_not_documented_specified_0_valid_values_are_1(Array.from(invalid).join(", "), Array.from(valid).join(", ")));
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
|
-
defaultValue:
|
|
176
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Module],
|
|
177
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Namespace],
|
|
178
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Enum],
|
|
179
|
-
// Not including enum member here by default
|
|
180
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Variable],
|
|
181
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Function],
|
|
182
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Class],
|
|
183
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Interface],
|
|
184
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Constructor],
|
|
185
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Property],
|
|
186
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Method],
|
|
187
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.CallSignature],
|
|
188
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.IndexSignature],
|
|
189
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.ConstructorSignature],
|
|
190
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Accessor],
|
|
191
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.GetSignature],
|
|
192
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.SetSignature],
|
|
193
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.TypeAlias],
|
|
194
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Reference],
|
|
195
|
-
],
|
|
175
|
+
defaultValue: defaults_1.OptionDefaults.excludeNotDocumentedKinds,
|
|
196
176
|
});
|
|
197
177
|
options.addDeclaration({
|
|
198
178
|
name: "excludeInternal",
|
|
@@ -305,18 +285,7 @@ function addTypeDocOptions(options) {
|
|
|
305
285
|
name: "highlightLanguages",
|
|
306
286
|
help: (i18n) => i18n.help_highlightLanguages(),
|
|
307
287
|
type: declaration_1.ParameterType.Array,
|
|
308
|
-
defaultValue:
|
|
309
|
-
"bash",
|
|
310
|
-
"console",
|
|
311
|
-
"css",
|
|
312
|
-
"html",
|
|
313
|
-
"javascript",
|
|
314
|
-
"json",
|
|
315
|
-
"jsonc",
|
|
316
|
-
"json5",
|
|
317
|
-
"tsx",
|
|
318
|
-
"typescript",
|
|
319
|
-
],
|
|
288
|
+
defaultValue: defaults_1.OptionDefaults.highlightLanguages,
|
|
320
289
|
validate(value, i18n) {
|
|
321
290
|
const invalid = (0, set_1.setDifference)(value, (0, highlighter_1.getSupportedLanguagesWithoutAliases)());
|
|
322
291
|
if (invalid.size) {
|
|
@@ -403,13 +372,7 @@ function addTypeDocOptions(options) {
|
|
|
403
372
|
name: "excludeTags",
|
|
404
373
|
help: (i18n) => i18n.help_excludeTags(),
|
|
405
374
|
type: declaration_1.ParameterType.Array,
|
|
406
|
-
defaultValue:
|
|
407
|
-
"@override",
|
|
408
|
-
"@virtual",
|
|
409
|
-
"@privateRemarks",
|
|
410
|
-
"@satisfies",
|
|
411
|
-
"@overload",
|
|
412
|
-
],
|
|
375
|
+
defaultValue: defaults_1.OptionDefaults.excludeTags,
|
|
413
376
|
validate(value, i18n) {
|
|
414
377
|
if (!Validation.validate([Array, Validation.isTagString], value)) {
|
|
415
378
|
throw new Error(i18n.option_0_values_must_be_array_of_tags("excludeTags"));
|
|
@@ -638,7 +601,7 @@ function addTypeDocOptions(options) {
|
|
|
638
601
|
name: "blockTags",
|
|
639
602
|
help: (i18n) => i18n.help_blockTags(),
|
|
640
603
|
type: declaration_1.ParameterType.Array,
|
|
641
|
-
defaultValue:
|
|
604
|
+
defaultValue: defaults_1.OptionDefaults.blockTags,
|
|
642
605
|
validate(value, i18n) {
|
|
643
606
|
if (!Validation.validate([Array, Validation.isTagString], value)) {
|
|
644
607
|
throw new Error(i18n.option_0_values_must_be_array_of_tags("blockTags"));
|
|
@@ -649,7 +612,7 @@ function addTypeDocOptions(options) {
|
|
|
649
612
|
name: "inlineTags",
|
|
650
613
|
help: (i18n) => i18n.help_inlineTags(),
|
|
651
614
|
type: declaration_1.ParameterType.Array,
|
|
652
|
-
defaultValue:
|
|
615
|
+
defaultValue: defaults_1.OptionDefaults.inlineTags,
|
|
653
616
|
validate(value, i18n) {
|
|
654
617
|
if (!Validation.validate([Array, Validation.isTagString], value)) {
|
|
655
618
|
throw new Error(i18n.option_0_values_must_be_array_of_tags("inlineTags"));
|
|
@@ -660,7 +623,7 @@ function addTypeDocOptions(options) {
|
|
|
660
623
|
name: "modifierTags",
|
|
661
624
|
help: (i18n) => i18n.help_modifierTags(),
|
|
662
625
|
type: declaration_1.ParameterType.Array,
|
|
663
|
-
defaultValue:
|
|
626
|
+
defaultValue: defaults_1.OptionDefaults.modifierTags,
|
|
664
627
|
validate(value, i18n) {
|
|
665
628
|
if (!Validation.validate([Array, Validation.isTagString], value)) {
|
|
666
629
|
throw new Error(i18n.option_0_values_must_be_array_of_tags("modifierTags"));
|
|
@@ -671,7 +634,7 @@ function addTypeDocOptions(options) {
|
|
|
671
634
|
name: "cascadedModifierTags",
|
|
672
635
|
help: (i18n) => i18n.help_modifierTags(),
|
|
673
636
|
type: declaration_1.ParameterType.Array,
|
|
674
|
-
defaultValue:
|
|
637
|
+
defaultValue: defaults_1.OptionDefaults.cascadedModifierTags,
|
|
675
638
|
validate(value, i18n) {
|
|
676
639
|
if (!Validation.validate([Array, Validation.isTagString], value)) {
|
|
677
640
|
throw new Error(i18n.option_0_values_must_be_array_of_tags("cascadedModifierTags"));
|
|
@@ -707,7 +670,7 @@ function addTypeDocOptions(options) {
|
|
|
707
670
|
name: "sort",
|
|
708
671
|
help: (i18n) => i18n.help_sort(),
|
|
709
672
|
type: declaration_1.ParameterType.Array,
|
|
710
|
-
defaultValue:
|
|
673
|
+
defaultValue: defaults_1.OptionDefaults.sort,
|
|
711
674
|
validate(value, i18n) {
|
|
712
675
|
const invalid = new Set(value);
|
|
713
676
|
for (const v of sort_1.SORT_STRATEGIES) {
|
|
@@ -730,13 +693,9 @@ function addTypeDocOptions(options) {
|
|
|
730
693
|
type: declaration_1.ParameterType.Array,
|
|
731
694
|
defaultValue: [],
|
|
732
695
|
validate(value, i18n) {
|
|
733
|
-
const invalid =
|
|
734
|
-
const valid = (0, enum_1.getEnumKeys)(kind_1.ReflectionKind);
|
|
735
|
-
for (const v of valid) {
|
|
736
|
-
invalid.delete(v);
|
|
737
|
-
}
|
|
696
|
+
const invalid = (0, set_1.setDifference)(value, (0, enum_1.getEnumKeys)(kind_1.ReflectionKind));
|
|
738
697
|
if (invalid.size !== 0) {
|
|
739
|
-
throw new Error(i18n.option_0_specified_1_but_only_2_is_valid(`kindSortOrder`, Array.from(invalid).join(", "),
|
|
698
|
+
throw new Error(i18n.option_0_specified_1_but_only_2_is_valid(`kindSortOrder`, Array.from(invalid).join(", "), (0, enum_1.getEnumKeys)(kind_1.ReflectionKind).join(", ")));
|
|
740
699
|
}
|
|
741
700
|
},
|
|
742
701
|
});
|
|
@@ -814,18 +773,7 @@ function addTypeDocOptions(options) {
|
|
|
814
773
|
}
|
|
815
774
|
}
|
|
816
775
|
},
|
|
817
|
-
defaultValue:
|
|
818
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Enum],
|
|
819
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.EnumMember],
|
|
820
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Variable],
|
|
821
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Function],
|
|
822
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Class],
|
|
823
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Interface],
|
|
824
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Property],
|
|
825
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Method],
|
|
826
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.Accessor],
|
|
827
|
-
kind_1.ReflectionKind[kind_1.ReflectionKind.TypeAlias],
|
|
828
|
-
],
|
|
776
|
+
defaultValue: defaults_1.OptionDefaults.requiredToBeDocumented,
|
|
829
777
|
});
|
|
830
778
|
options.addDeclaration({
|
|
831
779
|
name: "validation",
|
package/dist/lib/utils/sort.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.SORT_STRATEGIES = void 0;
|
|
8
8
|
exports.getSortFunction = getSortFunction;
|
|
9
9
|
const kind_1 = require("../models/reflections/kind");
|
|
10
|
+
const defaults_1 = require("./options/defaults");
|
|
10
11
|
exports.SORT_STRATEGIES = [
|
|
11
12
|
"source-order",
|
|
12
13
|
"alphabetical",
|
|
@@ -23,32 +24,6 @@ exports.SORT_STRATEGIES = [
|
|
|
23
24
|
"documents-first",
|
|
24
25
|
"documents-last",
|
|
25
26
|
];
|
|
26
|
-
const defaultKindSortOrder = [
|
|
27
|
-
kind_1.ReflectionKind.Document,
|
|
28
|
-
kind_1.ReflectionKind.Reference,
|
|
29
|
-
kind_1.ReflectionKind.Project,
|
|
30
|
-
kind_1.ReflectionKind.Module,
|
|
31
|
-
kind_1.ReflectionKind.Namespace,
|
|
32
|
-
kind_1.ReflectionKind.Enum,
|
|
33
|
-
kind_1.ReflectionKind.EnumMember,
|
|
34
|
-
kind_1.ReflectionKind.Class,
|
|
35
|
-
kind_1.ReflectionKind.Interface,
|
|
36
|
-
kind_1.ReflectionKind.TypeAlias,
|
|
37
|
-
kind_1.ReflectionKind.Constructor,
|
|
38
|
-
kind_1.ReflectionKind.Property,
|
|
39
|
-
kind_1.ReflectionKind.Variable,
|
|
40
|
-
kind_1.ReflectionKind.Function,
|
|
41
|
-
kind_1.ReflectionKind.Accessor,
|
|
42
|
-
kind_1.ReflectionKind.Method,
|
|
43
|
-
kind_1.ReflectionKind.Parameter,
|
|
44
|
-
kind_1.ReflectionKind.TypeParameter,
|
|
45
|
-
kind_1.ReflectionKind.TypeLiteral,
|
|
46
|
-
kind_1.ReflectionKind.CallSignature,
|
|
47
|
-
kind_1.ReflectionKind.ConstructorSignature,
|
|
48
|
-
kind_1.ReflectionKind.IndexSignature,
|
|
49
|
-
kind_1.ReflectionKind.GetSignature,
|
|
50
|
-
kind_1.ReflectionKind.SetSignature,
|
|
51
|
-
];
|
|
52
27
|
// Return true if a < b
|
|
53
28
|
const sorts = {
|
|
54
29
|
"source-order"(a, b) {
|
|
@@ -152,9 +127,9 @@ function getSortFunction(opts) {
|
|
|
152
127
|
const kindSortOrder = opts
|
|
153
128
|
.getValue("kindSortOrder")
|
|
154
129
|
.map((k) => kind_1.ReflectionKind[k]);
|
|
155
|
-
for (const kind of
|
|
156
|
-
if (!kindSortOrder.includes(kind)) {
|
|
157
|
-
kindSortOrder.push(kind);
|
|
130
|
+
for (const kind of defaults_1.OptionDefaults.kindSortOrder) {
|
|
131
|
+
if (!kindSortOrder.includes(kind_1.ReflectionKind[kind])) {
|
|
132
|
+
kindSortOrder.push(kind_1.ReflectionKind[kind]);
|
|
158
133
|
}
|
|
159
134
|
}
|
|
160
135
|
const strategies = opts.getValue("sort");
|
|
@@ -71,7 +71,11 @@ function validateDocumentation(project, logger, requiredToBeDocumented) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
const symbolId = project.getSymbolIdFromReflection(ref);
|
|
74
|
-
|
|
74
|
+
// #2644, signatures may be documented by their parent reflection.
|
|
75
|
+
const hasComment = ref.hasComment() ||
|
|
76
|
+
(ref.kindOf(models_1.ReflectionKind.SomeSignature) &&
|
|
77
|
+
ref.parent?.hasComment());
|
|
78
|
+
if (!hasComment && symbolId) {
|
|
75
79
|
if (symbolId.fileName.includes("node_modules")) {
|
|
76
80
|
continue;
|
|
77
81
|
}
|
|
@@ -9,7 +9,7 @@ function getBrokenPartLinks(parts) {
|
|
|
9
9
|
if (part.kind === "inline-tag" &&
|
|
10
10
|
linkTags.includes(part.tag) &&
|
|
11
11
|
!part.target) {
|
|
12
|
-
links.push(part.text);
|
|
12
|
+
links.push(part.text.trim());
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
return links;
|
|
@@ -25,42 +25,60 @@ function getBrokenLinks(comment) {
|
|
|
25
25
|
}
|
|
26
26
|
function validateLinks(project, logger) {
|
|
27
27
|
for (const id in project.reflections) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
checkReflection(project.reflections[id], logger);
|
|
29
|
+
}
|
|
30
|
+
if (!(project.id in project.reflections)) {
|
|
31
|
+
checkReflection(project, logger);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function checkReflection(reflection, logger) {
|
|
35
|
+
if (reflection.isProject() || reflection.isDeclaration()) {
|
|
36
|
+
for (const broken of getBrokenPartLinks(reflection.readme || [])) {
|
|
37
|
+
// #2360, "@" is a future reserved character in TSDoc component paths
|
|
38
|
+
// If a link starts with it, and doesn't include a module source indicator "!"
|
|
39
|
+
// then the user probably is trying to link to a package containing "@" with an absolute link.
|
|
40
|
+
if (broken.startsWith("@") && !broken.includes("!")) {
|
|
41
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_readme_for_1_may_have_meant_2(broken, reflection.getFriendlyFullName(), broken.replace(/[.#~]/, "!")));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_readme_for_1(broken, reflection.getFriendlyFullName()));
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
|
-
|
|
47
|
+
}
|
|
48
|
+
if (reflection.isDocument()) {
|
|
49
|
+
for (const broken of getBrokenPartLinks(reflection.content)) {
|
|
43
50
|
// #2360, "@" is a future reserved character in TSDoc component paths
|
|
44
51
|
// If a link starts with it, and doesn't include a module source indicator "!"
|
|
45
52
|
// then the user probably is trying to link to a package containing "@" with an absolute link.
|
|
46
53
|
if (broken.startsWith("@") && !broken.includes("!")) {
|
|
47
|
-
logger.warn(logger.i18n.
|
|
54
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_document_1_may_have_meant_2(broken, reflection.getFriendlyFullName(), broken.replace(/[.#~]/, "!")));
|
|
48
55
|
}
|
|
49
56
|
else {
|
|
50
|
-
logger.warn(logger.i18n.
|
|
57
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_document_1(broken, reflection.getFriendlyFullName()));
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
}
|
|
61
|
+
for (const broken of getBrokenLinks(reflection.comment)) {
|
|
62
|
+
// #2360, "@" is a future reserved character in TSDoc component paths
|
|
63
|
+
// If a link starts with it, and doesn't include a module source indicator "!"
|
|
64
|
+
// then the user probably is trying to link to a package containing "@" with an absolute link.
|
|
65
|
+
if (broken.startsWith("@") && !broken.includes("!")) {
|
|
66
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2(broken, reflection.getFriendlyFullName(), broken.replace(/[.#~]/, "!")));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_comment_for_1(broken, reflection.getFriendlyFullName()));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (reflection.isDeclaration() &&
|
|
73
|
+
reflection.kindOf(models_1.ReflectionKind.TypeAlias) &&
|
|
74
|
+
reflection.type?.type === "union" &&
|
|
75
|
+
reflection.type.elementSummaries) {
|
|
76
|
+
for (const broken of reflection.type.elementSummaries.flatMap(getBrokenPartLinks)) {
|
|
77
|
+
if (broken.startsWith("@") && !broken.includes("!")) {
|
|
78
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2(broken, reflection.getFriendlyFullName(), broken.replace(/[.#~]/, "!")));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
logger.warn(logger.i18n.failed_to_resolve_link_to_0_in_comment_for_1(broken, reflection.getFriendlyFullName()));
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
}
|