typedoc 0.28.7 → 0.28.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/lib/application.js +0 -2
- package/dist/lib/converter/comments/blockLexer.d.ts +2 -1
- package/dist/lib/converter/comments/blockLexer.js +6 -5
- package/dist/lib/converter/comments/index.d.ts +20 -5
- package/dist/lib/converter/comments/index.js +26 -23
- package/dist/lib/converter/comments/lineLexer.js +1 -1
- package/dist/lib/converter/comments/parser.d.ts +2 -2
- package/dist/lib/converter/comments/parser.js +6 -6
- package/dist/lib/converter/comments/rawLexer.js +1 -1
- package/dist/lib/converter/comments/textParser.js +93 -19
- package/dist/lib/converter/context.d.ts +10 -0
- package/dist/lib/converter/context.js +30 -10
- package/dist/lib/converter/factories/signature.js +1 -2
- package/dist/lib/converter/factories/symbol-id.d.ts +1 -2
- package/dist/lib/converter/factories/symbol-id.js +5 -51
- package/dist/lib/converter/jsdoc.js +1 -2
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/ImplementsPlugin.js +52 -11
- package/dist/lib/converter/plugins/PackagePlugin.js +2 -2
- package/dist/lib/converter/types.js +2 -3
- package/dist/lib/internationalization/locales/en.cjs +1 -0
- package/dist/lib/internationalization/locales/en.d.cts +1 -0
- package/dist/lib/internationalization/locales/zh.cjs +9 -2
- package/dist/lib/internationalization/locales/zh.d.cts +9 -2
- package/dist/lib/serialization/schema.d.ts +1 -1
- package/dist/lib/utils/declaration-maps.d.ts +3 -0
- package/dist/lib/utils/declaration-maps.js +51 -0
- package/dist/lib/utils/entry-point.js +6 -2
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +1 -0
- package/dist/lib/utils/options/declaration.d.ts +17 -9
- package/dist/lib/utils/options/declaration.js +38 -9
- package/dist/lib/utils/options/readers/arguments.js +2 -0
- package/dist/lib/utils/options/sources/typedoc.js +1 -1
- package/dist/lib/utils/plugins.d.ts +2 -1
- package/dist/lib/utils/plugins.js +26 -17
- package/dist/lib/utils-common/path.d.ts +6 -0
- package/dist/lib/utils-common/validation.js +1 -1
- package/package.json +9 -9
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ReflectionSymbolId } from "#models";
|
|
2
|
-
import { findPackageForPath,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { join, relative, resolve } from "node:path";
|
|
2
|
+
import { findPackageForPath, getQualifiedName, normalizePath, resolveDeclarationMaps } from "#node-utils";
|
|
3
|
+
import {} from "#utils";
|
|
4
|
+
import { relative } from "node:path";
|
|
6
5
|
import ts from "typescript";
|
|
7
|
-
const declarationMapCache = new Map();
|
|
8
6
|
let transientCount = 0;
|
|
9
7
|
const transientIds = new WeakMap();
|
|
10
|
-
|
|
8
|
+
// Don't use this directly, use Context.createSymbolId instead.
|
|
9
|
+
export function createSymbolIdImpl(symbol, declaration) {
|
|
11
10
|
declaration ??= symbol.declarations?.[0];
|
|
12
11
|
const tsSource = declaration?.getSourceFile().fileName ?? "";
|
|
13
12
|
const sourceFileName = resolveDeclarationMaps(tsSource);
|
|
@@ -46,48 +45,3 @@ export function createSymbolId(symbol, declaration) {
|
|
|
46
45
|
id.fileName = normalizePath(sourceFileName);
|
|
47
46
|
return id;
|
|
48
47
|
}
|
|
49
|
-
function resolveDeclarationMaps(file) {
|
|
50
|
-
if (!/\.d\.[cm]?ts$/.test(file))
|
|
51
|
-
return file;
|
|
52
|
-
if (declarationMapCache.has(file))
|
|
53
|
-
return declarationMapCache.get(file);
|
|
54
|
-
const mapFile = file + ".map";
|
|
55
|
-
if (!existsSync(mapFile))
|
|
56
|
-
return file;
|
|
57
|
-
let sourceMap;
|
|
58
|
-
try {
|
|
59
|
-
sourceMap = JSON.parse(readFile(mapFile));
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
return file;
|
|
63
|
-
}
|
|
64
|
-
if (Validation.validate({
|
|
65
|
-
file: String,
|
|
66
|
-
sourceRoot: Validation.optional(String),
|
|
67
|
-
sources: [Array, String],
|
|
68
|
-
}, sourceMap)) {
|
|
69
|
-
// There's a pretty large assumption in here that we only have
|
|
70
|
-
// 1 source file per js file. This is a pretty standard typescript approach,
|
|
71
|
-
// but people might do interesting things with transpilation that could break this.
|
|
72
|
-
let source = sourceMap.sources[0];
|
|
73
|
-
// If we have a sourceRoot, trim any leading slash from the source, and join them
|
|
74
|
-
// Similar to how it's done at https://github.com/mozilla/source-map/blob/58819f09018d56ef84dc41ba9c93f554e0645169/lib/util.js#L412
|
|
75
|
-
if (sourceMap.sourceRoot !== undefined) {
|
|
76
|
-
source = source.replace(/^\//, "");
|
|
77
|
-
source = join(sourceMap.sourceRoot, source);
|
|
78
|
-
}
|
|
79
|
-
const result = resolve(mapFile, "..", source);
|
|
80
|
-
declarationMapCache.set(file, result);
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
return file;
|
|
84
|
-
}
|
|
85
|
-
// See also: inferEntryPoints in entry-point.ts
|
|
86
|
-
export function addInferredDeclarationMapPaths(opts, files) {
|
|
87
|
-
const rootDir = opts.rootDir || getCommonDirectory(files);
|
|
88
|
-
const declDir = opts.declarationDir || opts.outDir || rootDir;
|
|
89
|
-
for (const file of files) {
|
|
90
|
-
const mapFile = normalizePath(resolve(declDir, relative(rootDir, file)).replace(/\.([cm]?[tj]s)x?$/, ".d.$1"));
|
|
91
|
-
declarationMapCache.set(mapFile, file);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -6,7 +6,6 @@ import ts from "typescript";
|
|
|
6
6
|
import { DeclarationReflection, IntrinsicType, ReflectionKind, ReflectionType, SignatureReflection, } from "../models/index.js";
|
|
7
7
|
import { ConverterEvents } from "./converter-events.js";
|
|
8
8
|
import { convertParameterNodes, convertTemplateParameterNodes } from "./factories/signature.js";
|
|
9
|
-
import { createSymbolId } from "./factories/symbol-id.js";
|
|
10
9
|
export function convertJsDocAlias(context, symbol, declaration, exportSymbol) {
|
|
11
10
|
if (declaration.typeExpression &&
|
|
12
11
|
ts.isJSDocTypeLiteral(declaration.typeExpression)) {
|
|
@@ -57,7 +56,7 @@ function convertJsDocSignature(context, node) {
|
|
|
57
56
|
context.registerReflection(reflection, symbol);
|
|
58
57
|
context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
|
|
59
58
|
const signature = new SignatureReflection("__type", ReflectionKind.CallSignature, reflection);
|
|
60
|
-
context.project.registerSymbolId(signature, createSymbolId(symbol, node));
|
|
59
|
+
context.project.registerSymbolId(signature, context.createSymbolId(symbol, node));
|
|
61
60
|
context.registerReflection(signature, void 0);
|
|
62
61
|
const signatureCtx = rc.withScope(signature);
|
|
63
62
|
reflection.signatures = [signature];
|
|
@@ -40,7 +40,7 @@ export declare class GroupPlugin extends ConverterComponent {
|
|
|
40
40
|
* @returns An array containing all children of the given reflection grouped by their kind.
|
|
41
41
|
*/
|
|
42
42
|
getReflectionGroups(parent: ContainerReflection, reflections: Array<DeclarationReflection | DocumentReflection>): ReflectionGroup[];
|
|
43
|
-
getSortFunction(reflection: ContainerReflection): (reflections:
|
|
43
|
+
getSortFunction(reflection: ContainerReflection): (reflections: Array<DeclarationReflection | DocumentReflection>) => void;
|
|
44
44
|
/**
|
|
45
45
|
* Callback used to sort groups by name.
|
|
46
46
|
*/
|
|
@@ -58,7 +58,9 @@ export class ImplementsPlugin extends ConverterComponent {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
analyzeInheritance(project, reflection) {
|
|
61
|
-
|
|
61
|
+
if (!reflection.extendedTypes)
|
|
62
|
+
return;
|
|
63
|
+
const extendedTypes = filterMap(reflection.extendedTypes, (type) => {
|
|
62
64
|
return type instanceof ReferenceType &&
|
|
63
65
|
type.reflection instanceof DeclarationReflection
|
|
64
66
|
? type
|
|
@@ -73,13 +75,45 @@ export class ImplementsPlugin extends ConverterComponent {
|
|
|
73
75
|
? "overwrites"
|
|
74
76
|
: "inheritedFrom";
|
|
75
77
|
for (const [childSig, parentSig] of zip(child.signatures ?? [], parentMember.signatures ?? [])) {
|
|
76
|
-
|
|
78
|
+
// If we're already pointing at something because TS said we should reference
|
|
79
|
+
// it, then don't overwrite the reference.
|
|
80
|
+
if (!childSig[key]?.reflection) {
|
|
81
|
+
childSig[key] = ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentSig, project);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!child[key]?.reflection) {
|
|
85
|
+
child[key] = ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
|
|
77
86
|
}
|
|
78
|
-
child[key] = ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
|
|
79
87
|
this.handleInheritedComments(child, parentMember);
|
|
80
88
|
}
|
|
81
89
|
}
|
|
82
90
|
}
|
|
91
|
+
// #2978, this is very unfortunate. If a child's parent links are broken at this point,
|
|
92
|
+
// we replace them with an intentionally broken link so that they won't ever be resolved.
|
|
93
|
+
// This is done because if we don't do it then we run into issues where we have a link which
|
|
94
|
+
// points to some ReflectionSymbolId which might not exist now, but once we've gone through
|
|
95
|
+
// serialization/deserialization, might point to an unexpected location. (See the mixin
|
|
96
|
+
// converter tests, I suspect this might actually be an indication of something else slightly
|
|
97
|
+
// broken there, but don't want to spend more time with this right now.)
|
|
98
|
+
// #2982, even more unfortunately, we only want to keep the link if it is pointing to a reflection
|
|
99
|
+
// which will receive a link during rendering.
|
|
100
|
+
const isValidRef = (ref) => ref.reflection && !ref.reflection.parent?.kindOf(ReflectionKind.TypeLiteral);
|
|
101
|
+
for (const child of reflection.children || []) {
|
|
102
|
+
if (child.inheritedFrom && !isValidRef(child.inheritedFrom)) {
|
|
103
|
+
child.inheritedFrom = ReferenceType.createBrokenReference(child.inheritedFrom.name, project);
|
|
104
|
+
}
|
|
105
|
+
if (child.overwrites && !isValidRef(child.overwrites)) {
|
|
106
|
+
child.overwrites = ReferenceType.createBrokenReference(child.overwrites.name, project);
|
|
107
|
+
}
|
|
108
|
+
for (const childSig of child.getAllSignatures()) {
|
|
109
|
+
if (childSig.inheritedFrom && !isValidRef(childSig.inheritedFrom)) {
|
|
110
|
+
childSig.inheritedFrom = ReferenceType.createBrokenReference(childSig.inheritedFrom.name, project);
|
|
111
|
+
}
|
|
112
|
+
if (childSig.overwrites && !isValidRef(childSig.overwrites)) {
|
|
113
|
+
childSig.overwrites = ReferenceType.createBrokenReference(childSig.overwrites.name, project);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
83
117
|
}
|
|
84
118
|
onResolveEnd(context) {
|
|
85
119
|
this.resolve(context.project);
|
|
@@ -310,8 +344,19 @@ function findProperty(reflection, parent) {
|
|
|
310
344
|
});
|
|
311
345
|
}
|
|
312
346
|
function createLink(context, reflection, clause, expr, symbol, isInherit) {
|
|
313
|
-
const project = context.project;
|
|
314
347
|
const name = `${expr.expression.getText()}.${getHumanName(symbol.name)}`;
|
|
348
|
+
// We should always have rootSymbols, but check just in case. We use the first
|
|
349
|
+
// symbol here as TypeDoc's models don't have multiple symbols for the parent
|
|
350
|
+
// reference. This is technically wrong because symbols might be declared in
|
|
351
|
+
// multiple locations (interface declaration merging), but that's an uncommon
|
|
352
|
+
// enough use case that it doesn't seem worthwhile to complicate the rest of the
|
|
353
|
+
// world to deal with it.
|
|
354
|
+
// Note that we also need to check that the root symbol isn't this symbol.
|
|
355
|
+
// This seems to happen sometimes when dealing with interface inheritance.
|
|
356
|
+
const rootSymbols = context.checker.getRootSymbols(symbol);
|
|
357
|
+
const ref = rootSymbols.length && rootSymbols[0] != symbol
|
|
358
|
+
? context.createSymbolReference(rootSymbols[0], context, name)
|
|
359
|
+
: ReferenceType.createBrokenReference(name, context.project);
|
|
315
360
|
link(reflection);
|
|
316
361
|
link(reflection.getSignature);
|
|
317
362
|
link(reflection.setSignature);
|
|
@@ -321,23 +366,19 @@ function createLink(context, reflection, clause, expr, symbol, isInherit) {
|
|
|
321
366
|
for (const sig of reflection.signatures ?? []) {
|
|
322
367
|
link(sig);
|
|
323
368
|
}
|
|
324
|
-
// Intentionally create broken links here. These will be replaced with real links during
|
|
325
|
-
// resolution if we can do so. We create broken links rather than real links because in the
|
|
326
|
-
// case of an inherited symbol, we'll end up referencing a single symbol ID rather than one
|
|
327
|
-
// for each class.
|
|
328
369
|
function link(target) {
|
|
329
370
|
if (!target)
|
|
330
371
|
return;
|
|
331
372
|
if (clause.token === ts.SyntaxKind.ImplementsKeyword) {
|
|
332
|
-
target.implementationOf ??=
|
|
373
|
+
target.implementationOf ??= ref;
|
|
333
374
|
return;
|
|
334
375
|
}
|
|
335
376
|
if (isInherit) {
|
|
336
377
|
target.setFlag(ReflectionFlag.Inherited);
|
|
337
|
-
target.inheritedFrom ??=
|
|
378
|
+
target.inheritedFrom ??= ref;
|
|
338
379
|
}
|
|
339
380
|
else {
|
|
340
|
-
target.overwrites ??=
|
|
381
|
+
target.overwrites ??= ref;
|
|
341
382
|
}
|
|
342
383
|
}
|
|
343
384
|
}
|
|
@@ -37,7 +37,7 @@ import { ConverterComponent } from "../components.js";
|
|
|
37
37
|
import { ApplicationEvents } from "../../application-events.js";
|
|
38
38
|
import { ConverterEvents } from "../converter-events.js";
|
|
39
39
|
import { i18n, MinimalSourceFile, NormalizedPathUtils } from "#utils";
|
|
40
|
-
import {
|
|
40
|
+
import { deriveRootDir, discoverPackageJson, nicePath, normalizePath, Option, readFile, } from "#node-utils";
|
|
41
41
|
import { existsSync } from "fs";
|
|
42
42
|
/**
|
|
43
43
|
* A handler that tries to find the package.json and readme.md files of the
|
|
@@ -117,7 +117,7 @@ let PackagePlugin = (() => {
|
|
|
117
117
|
this.readmeContents = undefined;
|
|
118
118
|
this.packageJson = undefined;
|
|
119
119
|
const dirName = this.application.options.packageDir ??
|
|
120
|
-
Path.resolve(
|
|
120
|
+
Path.resolve(deriveRootDir(this.entryPoints));
|
|
121
121
|
this.application.logger.verbose(`Begin package.json search at ${nicePath(dirName)}`);
|
|
122
122
|
const packageJson = discoverPackageJson(dirName);
|
|
123
123
|
this.packageJson = packageJson?.content;
|
|
@@ -8,7 +8,6 @@ import { convertParameterNodes, convertTypeParameterNodes, createSignature } fro
|
|
|
8
8
|
import { convertSymbol } from "./symbols.js";
|
|
9
9
|
import { isObjectType, isTypeReference } from "./utils/nodes.js";
|
|
10
10
|
import { removeUndefined } from "./utils/reflections.js";
|
|
11
|
-
import { createSymbolId } from "./factories/symbol-id.js";
|
|
12
11
|
const converters = new Map();
|
|
13
12
|
export function loadConverters() {
|
|
14
13
|
if (converters.size)
|
|
@@ -159,7 +158,7 @@ const constructorConverter = {
|
|
|
159
158
|
if (node.modifiers?.some((m) => m.kind === ts.SyntaxKind.AbstractKeyword)) {
|
|
160
159
|
signature.setFlag(ReflectionFlag.Abstract);
|
|
161
160
|
}
|
|
162
|
-
context.project.registerSymbolId(signature, createSymbolId(symbol, node));
|
|
161
|
+
context.project.registerSymbolId(signature, context.createSymbolId(symbol, node));
|
|
163
162
|
context.registerReflection(signature, void 0);
|
|
164
163
|
const signatureCtx = rc.withScope(signature);
|
|
165
164
|
reflection.signatures = [signature];
|
|
@@ -208,7 +207,7 @@ const functionTypeConverter = {
|
|
|
208
207
|
context.registerReflection(reflection, symbol);
|
|
209
208
|
context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
|
|
210
209
|
const signature = new SignatureReflection("__type", ReflectionKind.CallSignature, reflection);
|
|
211
|
-
context.project.registerSymbolId(signature, createSymbolId(symbol, node));
|
|
210
|
+
context.project.registerSymbolId(signature, context.createSymbolId(symbol, node));
|
|
212
211
|
context.registerReflection(signature, undefined);
|
|
213
212
|
const signatureCtx = rc.withScope(signature);
|
|
214
213
|
reflection.signatures = [signature];
|
|
@@ -276,6 +276,7 @@ module.exports = {
|
|
|
276
276
|
favicon_must_have_one_of_the_following_extensions_0: "Favicon must have one of the following extensions: {0}",
|
|
277
277
|
option_0_must_be_an_object: "The '{0}' option must be a non-array object",
|
|
278
278
|
option_0_must_be_an_array_of_string: "The '{0}' option must be set to an array of strings",
|
|
279
|
+
option_0_must_be_an_array_of_string_or_functions: "The '{0}' option must be set to an array of strings/functions",
|
|
279
280
|
option_0_must_be_a_function: "The '{0}' option must be a function",
|
|
280
281
|
option_0_must_be_object_with_urls: `{0} must be an object with string labels as keys and URL values`,
|
|
281
282
|
visibility_filters_only_include_0: `visibilityFilters can only include the following non-@ keys: {0}`,
|
|
@@ -260,6 +260,7 @@ declare const _default: {
|
|
|
260
260
|
readonly favicon_must_have_one_of_the_following_extensions_0: "Favicon must have one of the following extensions: {0}";
|
|
261
261
|
readonly option_0_must_be_an_object: "The '{0}' option must be a non-array object";
|
|
262
262
|
readonly option_0_must_be_an_array_of_string: "The '{0}' option must be set to an array of strings";
|
|
263
|
+
readonly option_0_must_be_an_array_of_string_or_functions: "The '{0}' option must be set to an array of strings/functions";
|
|
263
264
|
readonly option_0_must_be_a_function: "The '{0}' option must be a function";
|
|
264
265
|
readonly option_0_must_be_object_with_urls: "{0} must be an object with string labels as keys and URL values";
|
|
265
266
|
readonly visibility_filters_only_include_0: "visibilityFilters can only include the following non-@ keys: {0}";
|
|
@@ -56,6 +56,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
56
56
|
open_brace_within_inline_tag: "在内联标签中遇到左括号,这可能是一个错误",
|
|
57
57
|
inline_tag_not_closed: "内联标签未关闭",
|
|
58
58
|
// validation
|
|
59
|
+
comment_for_0_links_to_1_not_included_in_docs_use_external_link_2: `{0} 注释中指向 “{1}” 的已解析的链接不会被包含在文档中。请将 {2} 导出或添加至 externalSymbolLinkMappings 选项以修复该警告`,
|
|
59
60
|
failed_to_resolve_link_to_0_in_comment_for_1: "无法解析 {1} 注释中指向 “{0}” 的链接",
|
|
60
61
|
failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "无法解析 {1} 的注释中指向 “{0}” 的链接。您可能想要 “{2}”",
|
|
61
62
|
failed_to_resolve_link_to_0_in_readme_for_1: "无法解析 {1} 的自述文件中指向 “{0}” 的链接",
|
|
@@ -71,8 +72,9 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
71
72
|
// conversion plugins
|
|
72
73
|
not_all_search_category_boosts_used_0: "文档中并未使用 searchCategoryBoosts 中指定的所有类别。未使用的类别包括:\n{0}",
|
|
73
74
|
not_all_search_group_boosts_used_0: "文档中并未使用 searchGroupBoosts 中指定的所有组。未使用的组为:\n{0}",
|
|
74
|
-
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0}
|
|
75
|
-
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0}
|
|
75
|
+
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @categoryDescription,但该类别中没有子项",
|
|
76
|
+
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @groupDescription,但该分组中没有子项",
|
|
77
|
+
comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid: `{0} 的注释中指定的 “{1}” 的 @sortStrategy 无效,以下是有效的选项:\n\t{2}`,
|
|
76
78
|
label_0_for_1_cannot_be_referenced: "无法使用声明引用来引用 {1} 的标签“{0}”。标签只能包含 A-Z、0-9 和 _,并且不能以数字开头",
|
|
77
79
|
modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "修饰符标签 {0} 与 {2} 注释中的 {1} 互斥",
|
|
78
80
|
signature_0_has_unused_param_with_name_1: "签名 {0} 有一个名为“{1}”的 @param,但未被使用",
|
|
@@ -130,6 +132,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
130
132
|
// options
|
|
131
133
|
circular_reference_extends_0: "{0} 的“extends”字段出现循环引用",
|
|
132
134
|
failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件",
|
|
135
|
+
glob_0_should_use_posix_slash: `该 glob “{0}” 中转义了不是特殊字符的字符。输入 TypeDoc 的 glob 可能不会使用 Windows 路径分隔符(\\),请尝试将其替换为 POSIX 路径分隔符(/)`,
|
|
133
136
|
option_0_can_only_be_specified_by_config_file: "“{0}”选项只能通过配置文件指定",
|
|
134
137
|
option_0_expected_a_value_but_none_provided: "--{0} 需要一个值,但没有给出任何参数",
|
|
135
138
|
unknown_option_0_may_have_meant_1: "未知选项:{0},你可能指的是:\n\t{1}",
|
|
@@ -274,6 +277,8 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
274
277
|
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: "useHostedBaseUrlForAbsoluteLinks 选项要求设置 hostingBaseUrl",
|
|
275
278
|
favicon_must_have_one_of_the_following_extensions_0: "favicon 的后缀名必须是下列之一:{0}",
|
|
276
279
|
option_0_must_be_an_object: "“{0}”选项必须是非数组对象",
|
|
280
|
+
option_0_must_be_an_array_of_string: "“{0}”选项必须是字符串数组",
|
|
281
|
+
option_0_must_be_an_array_of_string_or_functions: "“{0}”选项必须是由字符串或函数构成的数组",
|
|
277
282
|
option_0_must_be_a_function: "‘{0}’ 选项必须是一个函数",
|
|
278
283
|
option_0_must_be_object_with_urls: "{0} 必须是具有字符串标签作为键和 URL 值的对象",
|
|
279
284
|
visibility_filters_only_include_0: "visibilityFilters 只能包含以下非@键:{0}",
|
|
@@ -431,6 +436,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
431
436
|
tag_return: "返回",
|
|
432
437
|
tag_satisfies: "满足",
|
|
433
438
|
tag_since: "添加于",
|
|
439
|
+
tag_sortStrategy: "排序策略",
|
|
434
440
|
tag_template: "类型参数",
|
|
435
441
|
tag_type: "类型",
|
|
436
442
|
tag_typedef: "类型定义",
|
|
@@ -460,6 +466,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
460
466
|
tag_virtual: "虚函数",
|
|
461
467
|
tag_abstract: "抽象类",
|
|
462
468
|
tag_class: "类",
|
|
469
|
+
tag_disableGroups: "禁用分组",
|
|
463
470
|
tag_enum: "枚举",
|
|
464
471
|
tag_event: "事件",
|
|
465
472
|
tag_expand: "展开",
|
|
@@ -49,6 +49,7 @@ declare const _default: {
|
|
|
49
49
|
unknown_inline_tag_0: "遇到未知的内联标签 {0}";
|
|
50
50
|
open_brace_within_inline_tag: string;
|
|
51
51
|
inline_tag_not_closed: string;
|
|
52
|
+
comment_for_0_links_to_1_not_included_in_docs_use_external_link_2: "{0} 注释中指向 “{1}” 的已解析的链接不会被包含在文档中。请将 {2} 导出或添加至 externalSymbolLinkMappings 选项以修复该警告";
|
|
52
53
|
failed_to_resolve_link_to_0_in_comment_for_1: "无法解析 {1} 注释中指向 “{0}” 的链接";
|
|
53
54
|
failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "无法解析 {1} 的注释中指向 “{0}” 的链接。您可能想要 “{2}”";
|
|
54
55
|
failed_to_resolve_link_to_0_in_readme_for_1: "无法解析 {1} 的自述文件中指向 “{0}” 的链接";
|
|
@@ -63,8 +64,9 @@ declare const _default: {
|
|
|
63
64
|
reflection_0_links_to_1_with_text_2_but_resolved_to_3: "“{0}”中的链接“{2}”指向“{1}”,目标虽然存在但并没有直接的链接,因此将改为链接至“{3}”。";
|
|
64
65
|
not_all_search_category_boosts_used_0: "文档中并未使用 searchCategoryBoosts 中指定的所有类别。未使用的类别包括:\n{0}";
|
|
65
66
|
not_all_search_group_boosts_used_0: "文档中并未使用 searchGroupBoosts 中指定的所有组。未使用的组为:\n{0}";
|
|
66
|
-
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0}
|
|
67
|
-
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0}
|
|
67
|
+
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @categoryDescription,但该类别中没有子项";
|
|
68
|
+
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @groupDescription,但该分组中没有子项";
|
|
69
|
+
comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid: "{0} 的注释中指定的 “{1}” 的 @sortStrategy 无效,以下是有效的选项:\n\t{2}";
|
|
68
70
|
label_0_for_1_cannot_be_referenced: "无法使用声明引用来引用 {1} 的标签“{0}”。标签只能包含 A-Z、0-9 和 _,并且不能以数字开头";
|
|
69
71
|
modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "修饰符标签 {0} 与 {2} 注释中的 {1} 互斥";
|
|
70
72
|
signature_0_has_unused_param_with_name_1: "签名 {0} 有一个名为“{1}”的 @param,但未被使用";
|
|
@@ -117,6 +119,7 @@ declare const _default: {
|
|
|
117
119
|
saved_relative_path_0_resolved_from_1_does_not_exist: "序列化项目引用的 {0} 不存在或无法在 {1} 下找到";
|
|
118
120
|
circular_reference_extends_0: "{0} 的“extends”字段出现循环引用";
|
|
119
121
|
failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件";
|
|
122
|
+
glob_0_should_use_posix_slash: "该 glob “{0}” 中转义了不是特殊字符的字符。输入 TypeDoc 的 glob 可能不会使用 Windows 路径分隔符(\\),请尝试将其替换为 POSIX 路径分隔符(/)";
|
|
120
123
|
option_0_can_only_be_specified_by_config_file: "“{0}”选项只能通过配置文件指定";
|
|
121
124
|
option_0_expected_a_value_but_none_provided: "--{0} 需要一个值,但没有给出任何参数";
|
|
122
125
|
unknown_option_0_may_have_meant_1: "未知选项:{0},你可能指的是:\n\t{1}";
|
|
@@ -256,6 +259,8 @@ declare const _default: {
|
|
|
256
259
|
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: string;
|
|
257
260
|
favicon_must_have_one_of_the_following_extensions_0: "favicon 的后缀名必须是下列之一:{0}";
|
|
258
261
|
option_0_must_be_an_object: "“{0}”选项必须是非数组对象";
|
|
262
|
+
option_0_must_be_an_array_of_string: "“{0}”选项必须是字符串数组";
|
|
263
|
+
option_0_must_be_an_array_of_string_or_functions: "“{0}”选项必须是由字符串或函数构成的数组";
|
|
259
264
|
option_0_must_be_a_function: "‘{0}’ 选项必须是一个函数";
|
|
260
265
|
option_0_must_be_object_with_urls: "{0} 必须是具有字符串标签作为键和 URL 值的对象";
|
|
261
266
|
visibility_filters_only_include_0: "visibilityFilters 只能包含以下非@键:{0}";
|
|
@@ -396,6 +401,7 @@ declare const _default: {
|
|
|
396
401
|
tag_return: string;
|
|
397
402
|
tag_satisfies: string;
|
|
398
403
|
tag_since: string;
|
|
404
|
+
tag_sortStrategy: string;
|
|
399
405
|
tag_template: string;
|
|
400
406
|
tag_type: string;
|
|
401
407
|
tag_typedef: string;
|
|
@@ -423,6 +429,7 @@ declare const _default: {
|
|
|
423
429
|
tag_virtual: string;
|
|
424
430
|
tag_abstract: string;
|
|
425
431
|
tag_class: string;
|
|
432
|
+
tag_disableGroups: string;
|
|
426
433
|
tag_enum: string;
|
|
427
434
|
tag_event: string;
|
|
428
435
|
tag_expand: string;
|
|
@@ -37,7 +37,7 @@ export declare const SCHEMA_VERSION = "2.0";
|
|
|
37
37
|
export type ModelToObject<T> = [T] extends [Array<infer U>] ? ModelToObject<U>[] : [
|
|
38
38
|
M.SomeType
|
|
39
39
|
] extends [T] ? SomeType : _ModelToObject<T>;
|
|
40
|
-
type _ModelToObject<T> = T extends Primitive ? T : Required<T> extends Required<M.ReflectionGroup> ? ReflectionGroup : Required<T> extends Required<M.ReflectionCategory> ? ReflectionCategory : T extends M.ReflectionVariant[keyof M.ReflectionVariant] ? ReflectionVariantMap[T["variant"]] : T extends M.SomeType ? TypeKindMap[T["type"]] : T extends M.Type ? SomeType : T extends M.Comment ? Comment : T extends M.CommentTag ? CommentTag : T extends M.CommentDisplayPart ? CommentDisplayPart : T extends M.SourceReference ? SourceReference : T extends M.FileRegistry ? FileRegistry : never;
|
|
40
|
+
type _ModelToObject<T> = T extends Primitive ? T : Required<T> extends Required<M.ReflectionGroup> ? ReflectionGroup : Required<T> extends Required<M.ReflectionCategory> ? ReflectionCategory : T extends M.ReflectionVariant[keyof M.ReflectionVariant] ? ReflectionVariantMap[T["variant"]] : T extends M.SomeType ? TypeKindMap[T["type"]] : T extends M.Type ? SomeType : T extends M.Comment ? Comment : T extends M.CommentTag ? CommentTag : T extends M.CommentDisplayPart ? CommentDisplayPart : T extends M.SourceReference ? SourceReference : T extends M.FileRegistry ? FileRegistry : T extends M.ReflectionSymbolId ? ReflectionSymbolId : never;
|
|
41
41
|
type Primitive = string | number | undefined | null | boolean;
|
|
42
42
|
type ToSerialized<T> = T extends Primitive ? T : T extends bigint ? {
|
|
43
43
|
value: string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { readFile } from "./fs.js";
|
|
3
|
+
import { Validation } from "#utils";
|
|
4
|
+
import { join, relative, resolve } from "path";
|
|
5
|
+
import { getCommonDirectory, normalizePath } from "./paths.js";
|
|
6
|
+
const declarationMapCache = new Map();
|
|
7
|
+
export function resolveDeclarationMaps(file) {
|
|
8
|
+
if (!/\.d\.[cm]?ts$/.test(file))
|
|
9
|
+
return file;
|
|
10
|
+
if (declarationMapCache.has(file))
|
|
11
|
+
return declarationMapCache.get(file);
|
|
12
|
+
const mapFile = file + ".map";
|
|
13
|
+
if (!existsSync(mapFile))
|
|
14
|
+
return file;
|
|
15
|
+
let sourceMap;
|
|
16
|
+
try {
|
|
17
|
+
sourceMap = JSON.parse(readFile(mapFile));
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return file;
|
|
21
|
+
}
|
|
22
|
+
if (Validation.validate({
|
|
23
|
+
file: String,
|
|
24
|
+
sourceRoot: Validation.optional(String),
|
|
25
|
+
sources: [Array, String],
|
|
26
|
+
}, sourceMap)) {
|
|
27
|
+
// There's a pretty large assumption in here that we only have
|
|
28
|
+
// 1 source file per js file. This is a pretty standard typescript approach,
|
|
29
|
+
// but people might do interesting things with transpilation that could break this.
|
|
30
|
+
let source = sourceMap.sources[0];
|
|
31
|
+
// If we have a sourceRoot, trim any leading slash from the source, and join them
|
|
32
|
+
// Similar to how it's done at https://github.com/mozilla/source-map/blob/58819f09018d56ef84dc41ba9c93f554e0645169/lib/util.js#L412
|
|
33
|
+
if (sourceMap.sourceRoot !== undefined) {
|
|
34
|
+
source = source.replace(/^\//, "");
|
|
35
|
+
source = join(sourceMap.sourceRoot, source);
|
|
36
|
+
}
|
|
37
|
+
const result = resolve(mapFile, "..", source);
|
|
38
|
+
declarationMapCache.set(file, result);
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
return file;
|
|
42
|
+
}
|
|
43
|
+
// See also: inferEntryPoints in entry-point.ts
|
|
44
|
+
export function addInferredDeclarationMapPaths(opts, files) {
|
|
45
|
+
const rootDir = opts.rootDir || getCommonDirectory(files);
|
|
46
|
+
const declDir = opts.declarationDir || opts.outDir || rootDir;
|
|
47
|
+
for (const file of files) {
|
|
48
|
+
const mapFile = normalizePath(resolve(declDir, relative(rootDir, file)).replace(/\.([cm]?[tj]s)x?$/, ".d.$1"));
|
|
49
|
+
declarationMapCache.set(mapFile, file);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -5,6 +5,7 @@ import { expandPackages } from "./package-manifest.js";
|
|
|
5
5
|
import { deriveRootDir, getCommonDirectory, MinimatchSet, nicePath, normalizePath } from "./paths.js";
|
|
6
6
|
import { discoverPackageJson, glob, inferPackageEntryPointPaths, isDir } from "./fs.js";
|
|
7
7
|
import { assertNever, i18n } from "#utils";
|
|
8
|
+
import { addInferredDeclarationMapPaths, resolveDeclarationMaps } from "./declaration-maps.js";
|
|
8
9
|
/**
|
|
9
10
|
* Defines how entry points are interpreted.
|
|
10
11
|
* @enum
|
|
@@ -39,7 +40,7 @@ export function inferEntryPoints(logger, options, programs) {
|
|
|
39
40
|
const pathEntries = inferPackageEntryPointPaths(packageJson.file);
|
|
40
41
|
const entryPoints = [];
|
|
41
42
|
programs ||= getEntryPrograms(pathEntries.map((p) => p[1]), logger, options);
|
|
42
|
-
// See also: addInferredDeclarationMapPaths in
|
|
43
|
+
// See also: addInferredDeclarationMapPaths in symbol-id factory
|
|
43
44
|
const jsToTsSource = new Map();
|
|
44
45
|
for (const program of programs) {
|
|
45
46
|
const opts = program.getCompilerOptions();
|
|
@@ -53,7 +54,7 @@ export function inferEntryPoints(logger, options, programs) {
|
|
|
53
54
|
for (const [name, path] of pathEntries) {
|
|
54
55
|
// Strip leading ./ from the display name
|
|
55
56
|
const displayName = name.replace(/^\.\/?/, "");
|
|
56
|
-
const targetPath = jsToTsSource.get(path) || path;
|
|
57
|
+
const targetPath = jsToTsSource.get(path) || resolveDeclarationMaps(path) || path;
|
|
57
58
|
const program = programs.find((p) => p.getSourceFile(targetPath));
|
|
58
59
|
if (program) {
|
|
59
60
|
entryPoints.push({
|
|
@@ -70,6 +71,7 @@ export function inferEntryPoints(logger, options, programs) {
|
|
|
70
71
|
logger.warn(i18n.no_entry_points_provided());
|
|
71
72
|
return [];
|
|
72
73
|
}
|
|
74
|
+
logger.verbose(`Inferred entry points to be:\n\t${entryPoints.map(e => nicePath(e.sourceFile.fileName)).join("\n\t")}`);
|
|
73
75
|
return entryPoints;
|
|
74
76
|
}
|
|
75
77
|
export function getEntryPoints(logger, options) {
|
|
@@ -257,6 +259,7 @@ function getEntryPrograms(inputFiles, logger, options) {
|
|
|
257
259
|
options: options.getCompilerOptions(),
|
|
258
260
|
projectReferences: options.getProjectReferences(),
|
|
259
261
|
});
|
|
262
|
+
addInferredDeclarationMapPaths(options.getCompilerOptions(), options.getFileNames());
|
|
260
263
|
const programs = [rootProgram];
|
|
261
264
|
// This might be a solution style tsconfig, in which case we need to add a program for each
|
|
262
265
|
// reference so that the converter can look through each of these.
|
|
@@ -271,6 +274,7 @@ function getEntryPrograms(inputFiles, logger, options) {
|
|
|
271
274
|
rootNames: ref.commandLine.fileNames,
|
|
272
275
|
projectReferences: ref.commandLine.projectReferences,
|
|
273
276
|
}));
|
|
277
|
+
addInferredDeclarationMapPaths(ref.commandLine.options, ref.commandLine.fileNames);
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
280
|
return programs;
|
|
@@ -9,6 +9,7 @@ export { loadPlugins } from "./plugins.js";
|
|
|
9
9
|
export { getSortFunction } from "./sort.js";
|
|
10
10
|
export type { SortStrategy } from "./sort.js";
|
|
11
11
|
export * from "./entry-point.js";
|
|
12
|
+
export * from "./declaration-maps.js";
|
|
12
13
|
export * from "./highlighter.js";
|
|
13
14
|
export * from "./html.js";
|
|
14
15
|
export * from "./tsconfig.js";
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./paths.js";
|
|
|
7
7
|
export { loadPlugins } from "./plugins.js";
|
|
8
8
|
export { getSortFunction } from "./sort.js";
|
|
9
9
|
export * from "./entry-point.js";
|
|
10
|
+
export * from "./declaration-maps.js";
|
|
10
11
|
export * from "./highlighter.js";
|
|
11
12
|
export * from "./html.js";
|
|
12
13
|
export * from "./tsconfig.js";
|
|
@@ -2,8 +2,9 @@ import type { BundledTheme as ShikiTheme } from "@gerrit0/mini-shiki";
|
|
|
2
2
|
import type { SortStrategy } from "../sort.js";
|
|
3
3
|
import type { EntryPointStrategy } from "../entry-point.js";
|
|
4
4
|
import type { ReflectionKind } from "../../models/kind.js";
|
|
5
|
-
import { type GlobString, type LogLevel, type NeverIfInternal, type NormalizedPath, type NormalizedPathOrModule } from "#utils";
|
|
5
|
+
import { type GlobString, type LogLevel, type NeverIfInternal, type NormalizedPath, type NormalizedPathOrModule, type NormalizedPathOrModuleOrFunction } from "#utils";
|
|
6
6
|
import type { TranslationProxy } from "../../internationalization/internationalization.js";
|
|
7
|
+
import type { Application } from "../../application.js";
|
|
7
8
|
/** @enum */
|
|
8
9
|
export declare const EmitStrategy: {
|
|
9
10
|
readonly both: "both";
|
|
@@ -40,7 +41,7 @@ export declare const rootPackageOptions: readonly ["plugin", "packageOptions", "
|
|
|
40
41
|
* @interface
|
|
41
42
|
*/
|
|
42
43
|
export type TypeDocOptions = {
|
|
43
|
-
[K in keyof TypeDocOptionMap]?: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends NormalizedPath[] | NormalizedPathOrModule[] | GlobString[] ? string[] : TypeDocOptionMap[K] extends NormalizedPath ? string : TypeDocOptionMap[K] extends string | string[] | number | boolean ? TypeDocOptionMap[K] : TypeDocOptionMap[K] extends Record<string, boolean> ? Partial<TypeDocOptionMap[K]> | boolean : keyof TypeDocOptionMap[K] | TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
44
|
+
[K in keyof TypeDocOptionMap]?: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends NormalizedPath[] | NormalizedPathOrModule[] | NormalizedPathOrModuleOrFunction[] | GlobString[] ? string[] : TypeDocOptionMap[K] extends NormalizedPath ? string : TypeDocOptionMap[K] extends string | string[] | number | boolean ? TypeDocOptionMap[K] : TypeDocOptionMap[K] extends Record<string, boolean> ? Partial<TypeDocOptionMap[K]> | boolean : keyof TypeDocOptionMap[K] | TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
44
45
|
};
|
|
45
46
|
/**
|
|
46
47
|
* Describes all TypeDoc specific options as returned by {@link Options.getValue}, this is
|
|
@@ -50,7 +51,7 @@ export type TypeDocOptions = {
|
|
|
50
51
|
* @interface
|
|
51
52
|
*/
|
|
52
53
|
export type TypeDocOptionValues = {
|
|
53
|
-
[K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends string | string[] | GlobString[] | number | boolean | Record<string, boolean> ? TypeDocOptionMap[K] : TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
54
|
+
[K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends string | string[] | GlobString[] | NormalizedPathOrModule[] | NormalizedPathOrModuleOrFunction[] | number | boolean | Record<string, boolean> ? TypeDocOptionMap[K] : TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
54
55
|
};
|
|
55
56
|
/**
|
|
56
57
|
* Describes TypeDoc options suitable for setting within the `packageOptions` setting.
|
|
@@ -78,7 +79,7 @@ export interface TypeDocOptionMap {
|
|
|
78
79
|
options: NormalizedPath;
|
|
79
80
|
tsconfig: NormalizedPath;
|
|
80
81
|
compilerOptions: unknown;
|
|
81
|
-
plugin:
|
|
82
|
+
plugin: NormalizedPathOrModuleOrFunction[];
|
|
82
83
|
lang: string;
|
|
83
84
|
locales: ManuallyValidatedOption<Record<string, Record<string, string>>>;
|
|
84
85
|
packageOptions: ManuallyValidatedOption<TypeDocPackageOptions>;
|
|
@@ -276,7 +277,7 @@ export type JsDocCompatibility = {
|
|
|
276
277
|
/**
|
|
277
278
|
* Converts a given TypeDoc option key to the type of the declaration expected.
|
|
278
279
|
*/
|
|
279
|
-
export type KeyToDeclaration<K extends keyof TypeDocOptionMap> = TypeDocOptionMap[K] extends boolean ? BooleanDeclarationOption : TypeDocOptionMap[K] extends string | NormalizedPath ? StringDeclarationOption : TypeDocOptionMap[K] extends number ? NumberDeclarationOption : TypeDocOptionMap[K] extends GlobString[] ? GlobArrayDeclarationOption : TypeDocOptionMap[K] extends string[] | NormalizedPath[] | NormalizedPathOrModule[] ? ArrayDeclarationOption : unknown extends TypeDocOptionMap[K] ? MixedDeclarationOption | ObjectDeclarationOption : TypeDocOptionMap[K] extends ManuallyValidatedOption<unknown> ? (MixedDeclarationOption & {
|
|
280
|
+
export type KeyToDeclaration<K extends keyof TypeDocOptionMap> = TypeDocOptionMap[K] extends boolean ? BooleanDeclarationOption : TypeDocOptionMap[K] extends string | NormalizedPath ? StringDeclarationOption : TypeDocOptionMap[K] extends number ? NumberDeclarationOption : TypeDocOptionMap[K] extends GlobString[] ? GlobArrayDeclarationOption : TypeDocOptionMap[K] extends string[] | NormalizedPath[] | NormalizedPathOrModule[] | NormalizedPathOrModuleOrFunction[] ? ArrayDeclarationOption : unknown extends TypeDocOptionMap[K] ? MixedDeclarationOption | ObjectDeclarationOption : TypeDocOptionMap[K] extends ManuallyValidatedOption<unknown> ? (MixedDeclarationOption & {
|
|
280
281
|
validate(value: unknown, i18n: TranslationProxy): void;
|
|
281
282
|
}) | (ObjectDeclarationOption & {
|
|
282
283
|
validate(value: unknown, i18n: TranslationProxy): void;
|
|
@@ -306,20 +307,26 @@ export declare enum ParameterType {
|
|
|
306
307
|
PathArray = 8,
|
|
307
308
|
/**
|
|
308
309
|
* Resolved according to the config directory if it starts with `.`
|
|
310
|
+
* @deprecated since 0.28.8, will be removed in 0.29
|
|
309
311
|
*/
|
|
310
312
|
ModuleArray = 9,
|
|
313
|
+
/**
|
|
314
|
+
* Resolved according to the config directory if it starts with `.`
|
|
315
|
+
* @internal - only intended for use with the plugin option
|
|
316
|
+
*/
|
|
317
|
+
PluginArray = 10,
|
|
311
318
|
/**
|
|
312
319
|
* Relative to the config directory.
|
|
313
320
|
*/
|
|
314
|
-
GlobArray =
|
|
321
|
+
GlobArray = 11,
|
|
315
322
|
/**
|
|
316
323
|
* An object which partially merges user-set values into the defaults.
|
|
317
324
|
*/
|
|
318
|
-
Object =
|
|
325
|
+
Object = 12,
|
|
319
326
|
/**
|
|
320
327
|
* An object with true/false flags
|
|
321
328
|
*/
|
|
322
|
-
Flags =
|
|
329
|
+
Flags = 13
|
|
323
330
|
}
|
|
324
331
|
export interface DeclarationOptionBase {
|
|
325
332
|
/**
|
|
@@ -401,7 +408,7 @@ export interface BooleanDeclarationOption extends DeclarationOptionBase {
|
|
|
401
408
|
defaultValue?: boolean;
|
|
402
409
|
}
|
|
403
410
|
export interface ArrayDeclarationOption extends DeclarationOptionBase {
|
|
404
|
-
type: ParameterType.Array | ParameterType.PathArray | ParameterType.ModuleArray;
|
|
411
|
+
type: ParameterType.Array | ParameterType.PathArray | ParameterType.ModuleArray | ParameterType.PluginArray;
|
|
405
412
|
/**
|
|
406
413
|
* If not specified defaults to an empty array.
|
|
407
414
|
*/
|
|
@@ -482,6 +489,7 @@ export interface ParameterTypeToOptionTypeMap {
|
|
|
482
489
|
[ParameterType.Array]: string[];
|
|
483
490
|
[ParameterType.PathArray]: NormalizedPath[];
|
|
484
491
|
[ParameterType.ModuleArray]: NormalizedPathOrModule[];
|
|
492
|
+
[ParameterType.PluginArray]: Array<NormalizedPathOrModule | ((app: Application) => void | Promise<void>)>;
|
|
485
493
|
[ParameterType.GlobArray]: GlobString[];
|
|
486
494
|
[ParameterType.Flags]: Record<string, boolean>;
|
|
487
495
|
[ParameterType.Map]: unknown;
|