typedoc 0.26.6 → 0.26.8
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/lib/converter/comments/discovery.js +7 -0
- package/dist/lib/converter/comments/linkResolver.d.ts +1 -1
- package/dist/lib/converter/comments/linkResolver.js +15 -7
- package/dist/lib/converter/comments/parser.js +4 -0
- package/dist/lib/converter/convert-expression.js +7 -1
- package/dist/lib/converter/factories/signature.js +6 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +14 -3
- package/dist/lib/internationalization/locales/zh.cjs +109 -42
- package/dist/lib/internationalization/translatable.d.ts +3 -0
- package/dist/lib/internationalization/translatable.js +3 -0
- package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -0
- package/dist/lib/models/reflections/ReflectionSymbolId.js +14 -1
- package/dist/lib/models/reflections/declaration.js +2 -0
- package/dist/lib/models/reflections/signature.js +2 -0
- package/dist/lib/models/types.js +0 -14
- package/dist/lib/output/events.d.ts +3 -1
- package/dist/lib/output/events.js +9 -5
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +2 -2
- package/dist/lib/output/plugins/AssetsPlugin.js +19 -3
- package/dist/lib/output/renderer.d.ts +2 -4
- package/dist/lib/output/renderer.js +2 -4
- package/dist/lib/output/themes/MarkedPlugin.d.ts +1 -0
- package/dist/lib/output/themes/MarkedPlugin.js +21 -2
- package/dist/lib/output/themes/default/DefaultTheme.js +3 -0
- package/dist/lib/output/themes/default/layouts/default.js +1 -0
- package/dist/lib/output/themes/default/partials/comment.js +6 -5
- package/dist/lib/output/themes/default/partials/member.declaration.js +12 -1
- package/dist/lib/output/themes/default/templates/reflection.js +1 -1
- package/dist/lib/utils/fs.js +11 -0
- package/dist/lib/utils/options/declaration.d.ts +3 -0
- package/dist/lib/utils/options/sources/typedoc.js +13 -1
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
- package/dist/lib/utils/sort.js +2 -2
- package/dist/lib/validation/links.js +1 -1
- package/package.json +12 -12
- package/tsdoc.json +4 -0
|
@@ -263,6 +263,13 @@ function findJsDocForComment(node, ranges) {
|
|
|
263
263
|
const jsDocs = typescript_1.default
|
|
264
264
|
.getJSDocCommentsAndTags(node)
|
|
265
265
|
.map((doc) => typescript_1.default.findAncestor(doc, typescript_1.default.isJSDoc));
|
|
266
|
+
if (typescript_1.default.isSourceFile(node)) {
|
|
267
|
+
if (node.statements.length) {
|
|
268
|
+
jsDocs.push(...typescript_1.default
|
|
269
|
+
.getJSDocCommentsAndTags(node.statements[0])
|
|
270
|
+
.map((doc) => typescript_1.default.findAncestor(doc, typescript_1.default.isJSDoc)));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
266
273
|
return jsDocs.find((doc) => doc.pos === ranges[0].pos);
|
|
267
274
|
}
|
|
268
275
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Comment, type CommentDisplayPart,
|
|
1
|
+
import { type Comment, type CommentDisplayPart, Reflection, ReflectionSymbolId } from "../../models";
|
|
2
2
|
import { type DeclarationReference } from "./declarationReference";
|
|
3
3
|
export type ExternalResolveResult = {
|
|
4
4
|
target: string;
|
|
@@ -36,6 +36,11 @@ function processPart(reflection, part, externalResolver, options) {
|
|
|
36
36
|
return part;
|
|
37
37
|
}
|
|
38
38
|
function resolveLinkTag(reflection, part, externalResolver, options) {
|
|
39
|
+
// This tag may have already been resolved to if we are running in packages mode
|
|
40
|
+
// or when reading in a JSON file. #2680.
|
|
41
|
+
if (typeof part.target === "string" || part.target instanceof models_1.Reflection) {
|
|
42
|
+
return part;
|
|
43
|
+
}
|
|
39
44
|
let defaultDisplayText = "";
|
|
40
45
|
let pos = 0;
|
|
41
46
|
const end = part.text.length;
|
|
@@ -55,16 +60,19 @@ function resolveLinkTag(reflection, part, externalResolver, options) {
|
|
|
55
60
|
part.tsLinkText ||
|
|
56
61
|
(options.preserveLinkText ? part.text : target.name);
|
|
57
62
|
}
|
|
58
|
-
else
|
|
63
|
+
else {
|
|
59
64
|
// If we didn't find a target, we might be pointing to a symbol in another project that will be merged in
|
|
60
65
|
// or some external symbol, so ask external resolvers to try resolution. Don't use regular declaration ref
|
|
61
66
|
// resolution in case it matches something that would have been merged in later.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
if (declRef) {
|
|
68
|
+
pos = declRef[1];
|
|
69
|
+
}
|
|
70
|
+
const externalResolveResult = externalResolver(declRef?.[0] ?? part.target.toDeclarationReference(), reflection, part, part.target);
|
|
71
|
+
defaultDisplayText =
|
|
72
|
+
part.tsLinkText ||
|
|
73
|
+
(options.preserveLinkText
|
|
74
|
+
? part.text
|
|
75
|
+
: part.text.substring(0, pos));
|
|
68
76
|
switch (typeof externalResolveResult) {
|
|
69
77
|
case "string":
|
|
70
78
|
target = externalResolveResult;
|
|
@@ -514,6 +514,10 @@ function inlineTag(lexer, block, config, i18n, warning) {
|
|
|
514
514
|
};
|
|
515
515
|
if (tagName.tsLinkTarget) {
|
|
516
516
|
inlineTag.target = tagName.tsLinkTarget;
|
|
517
|
+
}
|
|
518
|
+
// Separated from tsLinkTarget to avoid storing a useless empty string
|
|
519
|
+
// if TS doesn't have an opinion on what the link text should be.
|
|
520
|
+
if (tagName.tsLinkText) {
|
|
517
521
|
inlineTag.tsLinkText = tagName.tsLinkText;
|
|
518
522
|
}
|
|
519
523
|
block.push(inlineTag);
|
|
@@ -28,10 +28,16 @@ function convertExpression(expression) {
|
|
|
28
28
|
case typescript_1.default.SyntaxKind.FalseKeyword:
|
|
29
29
|
case typescript_1.default.SyntaxKind.NullKeyword:
|
|
30
30
|
case typescript_1.default.SyntaxKind.NumericLiteral:
|
|
31
|
-
case typescript_1.default.SyntaxKind.
|
|
31
|
+
case typescript_1.default.SyntaxKind.BigIntLiteral:
|
|
32
32
|
case typescript_1.default.SyntaxKind.Identifier:
|
|
33
33
|
return expression.getText();
|
|
34
34
|
}
|
|
35
|
+
if (typescript_1.default.isPrefixUnaryExpression(expression)) {
|
|
36
|
+
const inner = convertExpression(expression.operand);
|
|
37
|
+
if (inner != "...") {
|
|
38
|
+
return expression.getText();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
35
41
|
if (typescript_1.default.isArrayLiteralExpression(expression) &&
|
|
36
42
|
expression.elements.length === 0) {
|
|
37
43
|
return "[]";
|
|
@@ -100,6 +100,10 @@ function createConstructSignatureWithType(context, signature, classType) {
|
|
|
100
100
|
context.converter.trigger(converter_events_1.ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
|
|
101
101
|
}
|
|
102
102
|
function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
103
|
+
// #2698 if `satisfies` is used to imply a this parameter, we might have
|
|
104
|
+
// more parameters than parameter nodes and need to shift the parameterNode
|
|
105
|
+
// access index. Very ugly, but it does the job.
|
|
106
|
+
const parameterNodeOffset = parameterNodes?.length !== parameters.length ? -1 : 0;
|
|
103
107
|
return parameters.map((param, i) => {
|
|
104
108
|
const declaration = param.valueDeclaration;
|
|
105
109
|
(0, assert_1.default)(!declaration ||
|
|
@@ -139,7 +143,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
139
143
|
if (isOptional) {
|
|
140
144
|
paramRefl.type = (0, reflections_1.removeUndefined)(paramRefl.type);
|
|
141
145
|
}
|
|
142
|
-
paramRefl.defaultValue = (0, convert_expression_1.convertDefaultValue)(parameterNodes?.[i]);
|
|
146
|
+
paramRefl.defaultValue = (0, convert_expression_1.convertDefaultValue)(parameterNodes?.[i + parameterNodeOffset]);
|
|
143
147
|
paramRefl.setFlag(models_1.ReflectionFlag.Optional, isOptional);
|
|
144
148
|
// If we have no declaration, then this is an implicitly defined parameter in JS land
|
|
145
149
|
// because the method body uses `arguments`... which is always a rest argument
|
|
@@ -151,7 +155,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
151
155
|
typescript_1.default.isJSDocVariadicType(declaration.typeExpression.type);
|
|
152
156
|
}
|
|
153
157
|
paramRefl.setFlag(models_1.ReflectionFlag.Rest, isRest);
|
|
154
|
-
checkForDestructuredParameterDefaults(paramRefl, parameterNodes?.[i]);
|
|
158
|
+
checkForDestructuredParameterDefaults(paramRefl, parameterNodes?.[i + parameterNodeOffset]);
|
|
155
159
|
return paramRefl;
|
|
156
160
|
});
|
|
157
161
|
}
|
|
@@ -237,6 +237,15 @@ let CommentPlugin = (() => {
|
|
|
237
237
|
if (reflection.kindOf(models_1.ReflectionKind.Interface)) {
|
|
238
238
|
comment.removeModifier("@interface");
|
|
239
239
|
}
|
|
240
|
+
if (comment.hasModifier("@abstract")) {
|
|
241
|
+
if (reflection.kindOf(models_1.ReflectionKind.SomeSignature)) {
|
|
242
|
+
reflection.parent.setFlag(models_1.ReflectionFlag.Abstract);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
reflection.setFlag(models_1.ReflectionFlag.Abstract);
|
|
246
|
+
}
|
|
247
|
+
comment.removeModifier("@abstract");
|
|
248
|
+
}
|
|
240
249
|
if (comment.hasModifier("@private")) {
|
|
241
250
|
reflection.setFlag(models_1.ReflectionFlag.Private);
|
|
242
251
|
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
|
|
@@ -406,12 +415,14 @@ let CommentPlugin = (() => {
|
|
|
406
415
|
reflection.comment.removeModifier("@hideconstructor");
|
|
407
416
|
}
|
|
408
417
|
}
|
|
409
|
-
if (reflection instanceof models_1.DeclarationReflection
|
|
410
|
-
|
|
418
|
+
if ((reflection instanceof models_1.DeclarationReflection ||
|
|
419
|
+
reflection instanceof models_1.ParameterReflection) &&
|
|
420
|
+
reflection.comment) {
|
|
421
|
+
let sigs = [];
|
|
411
422
|
if (reflection.type instanceof models_1.ReflectionType) {
|
|
412
423
|
sigs = reflection.type.declaration.getNonIndexSignatures();
|
|
413
424
|
}
|
|
414
|
-
else {
|
|
425
|
+
else if (reflection instanceof models_1.DeclarationReflection) {
|
|
415
426
|
sigs = reflection.getNonIndexSignatures();
|
|
416
427
|
}
|
|
417
428
|
// For variables and properties, the symbol might own the comment but we might also
|
|
@@ -21,61 +21,64 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
21
21
|
no_entry_points_to_merge: "没有提供合并的入口点",
|
|
22
22
|
entrypoint_did_not_match_files_0: "入口点 glob {0} 与任何文件均不匹配",
|
|
23
23
|
failed_to_parse_json_0: "无法将 {0} 处的文件解析为 json",
|
|
24
|
-
failed_to_read_0_when_processing_document_tag_in_1: "处理 {1} 中注释的 @document
|
|
24
|
+
failed_to_read_0_when_processing_document_tag_in_1: "处理 {1} 中注释的 @document 标签时无法读取文件 {0}",
|
|
25
25
|
failed_to_read_0_when_processing_project_document: "添加项目文档时无法读取文件 {0}",
|
|
26
26
|
failed_to_read_0_when_processing_document_child_in_1: "处理 {1} 中的文档子项时无法读取文件 {0}",
|
|
27
27
|
frontmatter_children_0_should_be_an_array_of_strings_or_object_with_string_values: "{0} 中的 Frontmatter 子项应为字符串数组或具有字符串值的对象",
|
|
28
28
|
converting_union_as_interface: "在联合类型上使用 @interface 将丢弃联合所有分支上不存在的属性。TypeDoc 的输出可能无法准确描述您的源代码",
|
|
29
29
|
converting_0_as_class_requires_value_declaration: "将 {0} 转换为类需要表示非类型值的声明",
|
|
30
30
|
converting_0_as_class_without_construct_signatures: "{0} 正在转换为类,但没有任何构造签名",
|
|
31
|
-
comment_for_0_should_not_contain_block_or_modifier_tags: "{0}
|
|
31
|
+
comment_for_0_should_not_contain_block_or_modifier_tags: "{0} 的注释不应包含任何块级标签或修饰符标签",
|
|
32
32
|
symbol_0_has_multiple_declarations_with_comment: "{0} 有多个带注释的声明。将使用任意注释",
|
|
33
33
|
comments_for_0_are_declared_at_1: "{0} 的注释声明于:\n{1}",
|
|
34
|
-
multiple_type_parameters_on_template_tag_unsupported: "TypeDoc 不支持在带有注释的单个 @template
|
|
34
|
+
multiple_type_parameters_on_template_tag_unsupported: "TypeDoc 不支持在带有注释的单个 @template 标签中定义多个类型参数",
|
|
35
35
|
failed_to_find_jsdoc_tag_for_name_0: "解析注释后无法找到 {0} 的 JSDoc 标签,请提交错误报告",
|
|
36
|
-
|
|
37
|
-
inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0: "内联 @inheritDoc
|
|
36
|
+
relative_path_0_is_not_a_file_and_will_not_be_copied_to_output: "找不到相对路径 {0} 对应的文件,该文件不会被复制至输出目录",
|
|
37
|
+
inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0: "内联 @inheritDoc 标签不应出现在块级标签内,因为它不会在 {0} 处的注释中被处理。",
|
|
38
38
|
at_most_one_remarks_tag_expected_in_comment_at_0: "注释中最多应有一个 @remarks 标签,忽略 {0} 处注释中除第一个标签之外的所有标签",
|
|
39
39
|
at_most_one_returns_tag_expected_in_comment_at_0: "注释中最多应有一个 @returns 标签,忽略 {0} 处注释中除第一个标签之外的所有标签",
|
|
40
40
|
at_most_one_inheritdoc_tag_expected_in_comment_at_0: "注释中最多应有一个 @inheritDoc 标签,忽略 {0} 处注释中除第一个标签之外的所有标签",
|
|
41
|
-
content_in_summary_overwritten_by_inheritdoc_in_comment_at_0: "摘要部分的内容将被 {0} 处注释中的 @inheritDoc
|
|
42
|
-
content_in_remarks_block_overwritten_by_inheritdoc_in_comment_at_0: "@remarks 块中的内容将被 {0} 处注释中的 @inheritDoc
|
|
43
|
-
example_tag_literal_name: "
|
|
41
|
+
content_in_summary_overwritten_by_inheritdoc_in_comment_at_0: "摘要部分的内容将被 {0} 处注释中的 @inheritDoc 标签覆盖",
|
|
42
|
+
content_in_remarks_block_overwritten_by_inheritdoc_in_comment_at_0: "@remarks 块中的内容将被 {0} 处注释中的 @inheritDoc 标签覆盖",
|
|
43
|
+
example_tag_literal_name: "示例标签的第一行将按原样作为示例名称,并且只能包含文本",
|
|
44
44
|
inheritdoc_tag_properly_capitalized: "@inheritDoc 标签应正确大写",
|
|
45
45
|
treating_unrecognized_tag_0_as_modifier: "将无法识别的标签 {0} 视为修饰标签",
|
|
46
46
|
unmatched_closing_brace: "不匹配的右括号",
|
|
47
47
|
unescaped_open_brace_without_inline_tag: "遇到未转义的无内联标签的开括号",
|
|
48
|
-
unknown_block_tag_0: "
|
|
49
|
-
unknown_inline_tag_0: "
|
|
48
|
+
unknown_block_tag_0: "遇到未知的块级标签 {0}",
|
|
49
|
+
unknown_inline_tag_0: "遇到未知的内联标签 {0}",
|
|
50
50
|
open_brace_within_inline_tag: "在内联标签中遇到左括号,这可能是一个错误",
|
|
51
51
|
inline_tag_not_closed: "内联标签未关闭",
|
|
52
|
-
failed_to_resolve_link_to_0_in_comment_for_1: "
|
|
52
|
+
failed_to_resolve_link_to_0_in_comment_for_1: "无法解析 {1} 注释中指向 “{0}” 的链接",
|
|
53
|
+
failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "无法解析 {1} 的注释中指向 “{0}” 的链接。您可能想要 “{2}”",
|
|
54
|
+
failed_to_resolve_link_to_0_in_readme_for_1: "无法解析 {1} 的自述文件中指向 “{0}” 的链接",
|
|
55
|
+
failed_to_resolve_link_to_0_in_readme_for_1_may_have_meant_2: "无法解析 {1} 的自述文件中指向 “{0}” 的链接。您可能想要 “{2}”",
|
|
56
|
+
failed_to_resolve_link_to_0_in_document_1: "无法解析文档 {1} 中指向 “{0}” 的链接",
|
|
57
|
+
failed_to_resolve_link_to_0_in_document_1_may_have_meant_2: "无法解析文档 {1} 中指向 “{0}” 的链接。您可能想要 “{2}”",
|
|
53
58
|
type_0_defined_in_1_is_referenced_by_2_but_not_included_in_docs: "{0} 在 {1} 中定义,被 {2} 引用,但未包含在文档中",
|
|
54
59
|
reflection_0_kind_1_defined_in_2_does_not_have_any_documentation: "{0} ({1}),在 {2} 中定义,没有任何文档",
|
|
55
60
|
invalid_intentionally_not_exported_symbols_0: "以下符号被标记为有意不导出,但未在文档中引用,或已被导出:\n{0}",
|
|
56
61
|
not_all_search_category_boosts_used_0: "文档中并未使用 searchCategoryBoosts 中指定的所有类别。未使用的类别包括:\n{0}",
|
|
57
62
|
not_all_search_group_boosts_used_0: "文档中并未使用 searchGroupBoosts 中指定的所有组。未使用的组为:\n{0}",
|
|
58
|
-
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0}
|
|
59
|
-
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "
|
|
63
|
+
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0} 的注释包含“{1}”的 @categoryDescription,但该类别中没有子项",
|
|
64
|
+
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0} 的注释包含“{1}”的 @groupDescription,但该组中没有子项",
|
|
60
65
|
label_0_for_1_cannot_be_referenced: "无法使用声明引用来引用 {1} 的标签“{0}”。标签只能包含 A-Z、0-9 和 _,并且不能以数字开头",
|
|
61
|
-
modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "
|
|
66
|
+
modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "修饰符标签 {0} 与 {2} 注释中的 {1} 互斥",
|
|
62
67
|
signature_0_has_unused_param_with_name_1: "签名 {0} 有一个名为“{1}”的 @param,但未被使用",
|
|
63
68
|
declaration_reference_in_inheritdoc_for_0_not_fully_parsed: "@inheritDoc 中对 {0} 的声明引用未完全解析,可能会解析不正确",
|
|
64
|
-
failed_to_find_0_to_inherit_comment_from_in_1: "在 {1}
|
|
65
|
-
failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: `无法解析 {1} 的注释中指向"{0}"的链接。您可能想要"{2}"`,
|
|
66
|
-
failed_to_resolve_link_to_0_in_readme_for_1: `无法解析 {1} 的自述文件中指向"{0}"的链接`,
|
|
67
|
-
failed_to_resolve_link_to_0_in_readme_for_1_may_have_meant_2: `无法解析 {1} 的自述文件中指向"{0}"的链接。您可能想要"{2}"`,
|
|
69
|
+
failed_to_find_0_to_inherit_comment_from_in_1: "在 {1} 的注释中找不到要继承的注释“{0}”",
|
|
68
70
|
reflection_0_tried_to_copy_comment_from_1_but_source_had_no_comment: "{0} 尝试使用 @inheritDoc 从 {1} 复制注释,但源没有相关注释",
|
|
69
71
|
inheritdoc_circular_inheritance_chain_0: "@inheritDoc 指定循环继承链:{0}",
|
|
70
72
|
provided_readme_at_0_could_not_be_read: "提供的 README 路径无法读取 {0}",
|
|
71
73
|
defaulting_project_name: "未指定 --name 选项,并且未找到 package.json。将项目名称默认为“Documentation”",
|
|
72
|
-
disable_git_set_but_not_source_link_template: "已设置 disableGit,但未设置 sourceLinkTemplate
|
|
74
|
+
disable_git_set_but_not_source_link_template: "已设置 disableGit,但未设置 sourceLinkTemplate,因此无法生成源代码链接。设置 sourceLinkTemplate 或 disableSources 以停用源代码跟踪",
|
|
73
75
|
disable_git_set_and_git_revision_used: "disableGit 已设置,并且 sourceLinkTemplate 包含 {gitRevision},由于未提供修订,因此将替换为空字符串",
|
|
74
76
|
git_remote_0_not_valid: "提供的 git 远程“{0}”无效。源链接将失效",
|
|
75
77
|
custom_css_file_0_does_not_exist: "{0} 处的自定义 CSS 文件不存在",
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
custom_js_file_0_does_not_exist: "{0} 处的自定义 JavaScript 文件不存在",
|
|
79
|
+
unsupported_highlight_language_0_not_highlighted_in_comment_for_1: "不支持的高亮语言 {0} 将不会在 {1} 的注释中高亮",
|
|
80
|
+
unloaded_language_0_not_highlighted_in_comment_for_1: "语言为 {0} 的代码块将不会在 {1} 的注释中高亮,因为它未包含在 highlightLanguages 选项中",
|
|
81
|
+
yaml_frontmatter_not_an_object: "YAML Frontmatter 应当为对象",
|
|
79
82
|
could_not_write_0: "无法写入 {0}",
|
|
80
83
|
could_not_empty_output_directory_0: "无法清空输出目录 {0}",
|
|
81
84
|
could_not_create_output_directory_0: "无法创建输出目录 {0}",
|
|
@@ -93,12 +96,12 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
93
96
|
entry_point_0_did_not_match_any_packages: "入口点 glob {0} 与任何包含 package.json 的目录不匹配",
|
|
94
97
|
file_0_not_an_object: "文件 {0} 不是对象",
|
|
95
98
|
serialized_project_referenced_0_not_part_of_project: "序列化项目引用了反射 {0},但它不是项目的一部分",
|
|
96
|
-
|
|
99
|
+
saved_relative_path_0_resolved_from_1_is_not_a_file: "序列化项目引用的 {0} 不存在或无法在 {1} 下找到",
|
|
97
100
|
circular_reference_extends_0: "{0} 的“extends”字段出现循环引用",
|
|
98
101
|
failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件",
|
|
99
102
|
option_0_can_only_be_specified_by_config_file: "“{0}”选项只能通过配置文件指定",
|
|
100
103
|
option_0_expected_a_value_but_none_provided: "--{0} 需要一个值,但没有给出任何参数",
|
|
101
|
-
unknown_option_0_may_have_meant_1: "未知选项:{0},你可能指的是:\n{1}",
|
|
104
|
+
unknown_option_0_may_have_meant_1: "未知选项:{0},你可能指的是:\n\t{1}",
|
|
102
105
|
typedoc_key_in_0_ignored: "{0} 中的“typedoc”键已被旧包 entryPointStrategy 使用,将被忽略",
|
|
103
106
|
typedoc_options_must_be_object_in_0: "无法解析 {0} 中的“typedocOptions”字段,请确保它存在且包含对象",
|
|
104
107
|
tsconfig_file_0_does_not_exist: "tsconfig 文件 {0} 不存在",
|
|
@@ -139,8 +142,9 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
139
142
|
help_theme: "指定用于呈现文档的主题名称",
|
|
140
143
|
help_lightHighlightTheme: "指定浅色模式下的代码高亮主题",
|
|
141
144
|
help_darkHighlightTheme: "指定暗黑模式下的代码高亮主题",
|
|
142
|
-
help_highlightLanguages: "
|
|
145
|
+
help_highlightLanguages: "指定渲染时将加载哪些语言来高亮代码",
|
|
143
146
|
help_customCss: "要导入主题的自定义 CSS 文件的路径",
|
|
147
|
+
help_customJs: "要导入的自定义 JS 文件的路径",
|
|
144
148
|
help_markdownItOptions: "指定传递给 markdown-it(TypeDoc 使用的 Markdown 解析器)的选项",
|
|
145
149
|
help_markdownItLoader: "指定加载 markdown-it 实例时要调用的回调。将传递 TypeDoc 将使用的解析器实例",
|
|
146
150
|
help_maxTypeConversionDepth: "设置要转换类型的最大深度",
|
|
@@ -152,10 +156,11 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
152
156
|
help_gitRemote: "使用指定的远程链接到 GitHub/Bitbucket 源文件。如果设置了 disableGit 或 disableSources,则无效",
|
|
153
157
|
help_disableGit: "假设所有内容都可以通过 sourceLinkTemplate 进行链接,如果启用此功能,则必须设置 sourceLinkTemplate。{path} 将以 basePath 为根",
|
|
154
158
|
help_basePath: "指定显示文件路径时使用的基本路径",
|
|
155
|
-
help_excludeTags: "
|
|
159
|
+
help_excludeTags: "从文档注释中删除列出的块级/修饰符标签",
|
|
156
160
|
help_readme: "应显示在索引页上的自述文件路径。传递“none”以禁用索引页并在全局页上启动文档",
|
|
157
161
|
help_cname: "设置 CNAME 文件文本,这对于 GitHub Pages 上的自定义域很有用",
|
|
158
|
-
help_sourceLinkExternal: "
|
|
162
|
+
help_sourceLinkExternal: "指定哪些源代码链接应被视为外部链接,并在新选项卡中打开",
|
|
163
|
+
help_markdownLinkExternal: "指定注释与 Markdown 文件中哪些 http[s]:// 链接应被视为外部链接,并在新选项卡中打开",
|
|
159
164
|
help_githubPages: "生成 .nojekyll 文件以防止 GitHub Pages 中出现 404 错误。默认为“true”",
|
|
160
165
|
help_hostedBaseUrl: "指定用于在我们的输出文件夹和规范链接中生成 sitemap.xml 的基本 URL。如果未指定,则不会生成站点地图",
|
|
161
166
|
help_useHostedBaseUrlForAbsoluteLinks: "如果设置,TypeDoc 将使用 hostingBaseUrl 选项生成到您网站页面的绝对链接",
|
|
@@ -164,7 +169,7 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
164
169
|
help_customFooterHtmlDisableWrapper: "如果设置,则禁用 customFooterHtml 的包装元素",
|
|
165
170
|
help_hideParameterTypesInTitle: "隐藏签名标题中的参数类型,以便于扫描",
|
|
166
171
|
help_cacheBust: "在静态资产链接中包含生成时间",
|
|
167
|
-
help_searchInComments: "
|
|
172
|
+
help_searchInComments: "如果设置,搜索索引还将包括注释。这将大大增加搜索索引的大小",
|
|
168
173
|
help_searchInDocuments: "如果设置,搜索索引还将包含文档。这将大大增加搜索索引的大小",
|
|
169
174
|
help_cleanOutputDir: "如果设置,TypeDoc 将在写入输出之前删除输出目录",
|
|
170
175
|
help_titleLink: "设置页眉中的标题指向的链接。默认为文档主页",
|
|
@@ -179,7 +184,7 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
179
184
|
help_commentStyle: "确定 TypeDoc 如何搜索注释",
|
|
180
185
|
help_useTsLinkResolution: "使用 TypeScript 的链接解析来确定 @link 标签指向的位置。这仅适用于 JSDoc 样式注释",
|
|
181
186
|
help_preserveLinkText: "如果设置,不带链接文本的 @link 标签将使用文本内容作为链接。如果未设置,将使用目标反射名称",
|
|
182
|
-
help_blockTags: "TypeDoc
|
|
187
|
+
help_blockTags: "TypeDoc 在解析注释时应该识别的块级标签",
|
|
183
188
|
help_inlineTags: "TypeDoc 在解析注释时应该识别的内联标签",
|
|
184
189
|
help_modifierTags: "TypeDoc 在解析注释时应该识别的修饰符标签",
|
|
185
190
|
help_categorizeByGroup: "指定是否在组级别进行分类",
|
|
@@ -241,11 +246,11 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
241
246
|
kind_index_signature: "索引签名",
|
|
242
247
|
kind_constructor_signature: "构造函数签名",
|
|
243
248
|
kind_parameter: "范围",
|
|
244
|
-
kind_type_literal: "
|
|
249
|
+
kind_type_literal: "类型字面量",
|
|
245
250
|
kind_type_parameter: "类型参数",
|
|
246
251
|
kind_accessor: "访问器",
|
|
247
|
-
kind_get_signature: "
|
|
248
|
-
kind_set_signature: "
|
|
252
|
+
kind_get_signature: "Getter 签名",
|
|
253
|
+
kind_set_signature: "Setter 签名",
|
|
249
254
|
kind_type_alias: "类型别名",
|
|
250
255
|
kind_reference: "参考",
|
|
251
256
|
kind_document: "文档",
|
|
@@ -255,21 +260,21 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
255
260
|
kind_plural_enum: "枚举",
|
|
256
261
|
kind_plural_enum_member: "枚举成员",
|
|
257
262
|
kind_plural_variable: "变量",
|
|
258
|
-
kind_plural_function: "
|
|
263
|
+
kind_plural_function: "函数",
|
|
259
264
|
kind_plural_class: "类",
|
|
260
265
|
kind_plural_interface: "接口",
|
|
261
266
|
kind_plural_constructor: "构造函数",
|
|
262
|
-
kind_plural_property: "
|
|
267
|
+
kind_plural_property: "属性",
|
|
263
268
|
kind_plural_method: "方法",
|
|
264
|
-
kind_plural_call_signature: "
|
|
269
|
+
kind_plural_call_signature: "调用签名",
|
|
265
270
|
kind_plural_index_signature: "索引签名",
|
|
266
271
|
kind_plural_constructor_signature: "构造函数签名",
|
|
267
272
|
kind_plural_parameter: "参数",
|
|
268
|
-
kind_plural_type_literal: "
|
|
273
|
+
kind_plural_type_literal: "类型字面量",
|
|
269
274
|
kind_plural_type_parameter: "类型参数",
|
|
270
275
|
kind_plural_accessor: "访问器",
|
|
271
|
-
kind_plural_get_signature: "
|
|
272
|
-
kind_plural_set_signature: "
|
|
276
|
+
kind_plural_get_signature: "Getter 签名",
|
|
277
|
+
kind_plural_set_signature: "Setter 签名",
|
|
273
278
|
kind_plural_type_alias: "类型别名",
|
|
274
279
|
kind_plural_reference: "参考",
|
|
275
280
|
kind_plural_document: "文档",
|
|
@@ -294,7 +299,7 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
294
299
|
theme_defined_in: "定义于",
|
|
295
300
|
theme_implementation_of: "实现了",
|
|
296
301
|
theme_inherited_from: "继承自",
|
|
297
|
-
theme_overrides: "
|
|
302
|
+
theme_overrides: "重写了",
|
|
298
303
|
theme_returns: "返回",
|
|
299
304
|
theme_re_exports: "重新导出",
|
|
300
305
|
theme_renames_and_re_exports: "重命名并重新导出",
|
|
@@ -311,12 +316,74 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
|
|
|
311
316
|
theme_search: "搜索",
|
|
312
317
|
theme_menu: "菜单",
|
|
313
318
|
theme_permalink: "永久链接",
|
|
314
|
-
tag_see: "参阅",
|
|
315
|
-
tag_group: "所属分组",
|
|
316
|
-
tag_example: "示例",
|
|
317
319
|
theme_copy: "复制",
|
|
318
320
|
theme_copied: "已复制!",
|
|
319
321
|
theme_normally_hidden: "由于您的过滤器设置,该成员已被隐藏。",
|
|
320
322
|
theme_class_hierarchy_title: "类继承图表",
|
|
321
323
|
theme_loading: "加载中……",
|
|
324
|
+
tag_defaultValue: "默认值",
|
|
325
|
+
tag_deprecated: "已被弃用",
|
|
326
|
+
tag_example: "示例",
|
|
327
|
+
tag_param: "参数",
|
|
328
|
+
tag_privateRemarks: "私有备注",
|
|
329
|
+
tag_remarks: "备注",
|
|
330
|
+
tag_returns: "返回",
|
|
331
|
+
tag_see: "参阅",
|
|
332
|
+
tag_throws: "抛出",
|
|
333
|
+
tag_typeParam: "类型参数",
|
|
334
|
+
tag_author: "作者",
|
|
335
|
+
tag_callback: "回调",
|
|
336
|
+
tag_category: "类别",
|
|
337
|
+
tag_categoryDescription: "类别描述",
|
|
338
|
+
tag_default: "默认值",
|
|
339
|
+
tag_document: "文档",
|
|
340
|
+
tag_extends: "继承自",
|
|
341
|
+
tag_augments: "继承自",
|
|
342
|
+
tag_yields: "生成",
|
|
343
|
+
tag_group: "分组",
|
|
344
|
+
tag_groupDescription: "分组描述",
|
|
345
|
+
tag_import: "导入",
|
|
346
|
+
tag_inheritDoc: "继承文档",
|
|
347
|
+
tag_jsx: "JSX",
|
|
348
|
+
tag_license: "许可协议",
|
|
349
|
+
tag_module: "模块",
|
|
350
|
+
tag_prop: "属性",
|
|
351
|
+
tag_property: "属性",
|
|
352
|
+
tag_return: "返回",
|
|
353
|
+
tag_satisfies: "满足",
|
|
354
|
+
tag_since: "添加于",
|
|
355
|
+
tag_template: "类型参数",
|
|
356
|
+
tag_type: "类型",
|
|
357
|
+
tag_typedef: "类型定义",
|
|
358
|
+
tag_link: "链接",
|
|
359
|
+
tag_label: "标记",
|
|
360
|
+
tag_linkcode: "链接",
|
|
361
|
+
tag_linkplain: "链接",
|
|
362
|
+
tag_alpha: "alpha",
|
|
363
|
+
tag_beta: "beta",
|
|
364
|
+
tag_eventProperty: "事件属性",
|
|
365
|
+
tag_experimental: "实验性",
|
|
366
|
+
tag_internal: "内部成员",
|
|
367
|
+
tag_override: "重写",
|
|
368
|
+
tag_packageDocumentation: "包文档",
|
|
369
|
+
tag_public: "公共成员",
|
|
370
|
+
tag_readonly: "只读",
|
|
371
|
+
tag_sealed: "无法继承",
|
|
372
|
+
tag_virtual: "虚函数",
|
|
373
|
+
tag_abstract: "抽象类",
|
|
374
|
+
tag_class: "类",
|
|
375
|
+
tag_enum: "枚举",
|
|
376
|
+
tag_event: "事件",
|
|
377
|
+
tag_hidden: "隐藏",
|
|
378
|
+
tag_hideCategories: "在类别中隐藏",
|
|
379
|
+
tag_hideconstructor: "隐藏构造器",
|
|
380
|
+
tag_hideGroups: "在分组中隐藏",
|
|
381
|
+
tag_ignore: "隐藏",
|
|
382
|
+
tag_interface: "接口",
|
|
383
|
+
tag_namespace: "命名空间",
|
|
384
|
+
tag_overload: "重载",
|
|
385
|
+
tag_private: "私有成员",
|
|
386
|
+
tag_protected: "受保护成员",
|
|
387
|
+
tag_showCategories: "在类别中显示",
|
|
388
|
+
tag_showGroups: "在分组中显示",
|
|
322
389
|
});
|
|
@@ -76,6 +76,7 @@ export declare const translatable: {
|
|
|
76
76
|
readonly disable_git_set_and_git_revision_used: "disableGit is set and sourceLinkTemplate contains {gitRevision}, which will be replaced with an empty string as no revision was provided";
|
|
77
77
|
readonly git_remote_0_not_valid: "The provided git remote \"{0}\" was not valid. Source links will be broken";
|
|
78
78
|
readonly custom_css_file_0_does_not_exist: "Custom CSS file at {0} does not exist";
|
|
79
|
+
readonly custom_js_file_0_does_not_exist: "Custom JavaScript file at {0} does not exist";
|
|
79
80
|
readonly unsupported_highlight_language_0_not_highlighted_in_comment_for_1: "Unsupported highlight language {0} will not be highlighted in comment for {1}";
|
|
80
81
|
readonly unloaded_language_0_not_highlighted_in_comment_for_1: "Code block with language {0} will not be highlighted in comment for {1} as it was not included in the highlightLanguages option";
|
|
81
82
|
readonly yaml_frontmatter_not_an_object: "Expected YAML frontmatter to be an object";
|
|
@@ -144,6 +145,7 @@ export declare const translatable: {
|
|
|
144
145
|
readonly help_darkHighlightTheme: "Specify the code highlighting theme in dark mode";
|
|
145
146
|
readonly help_highlightLanguages: "Specify the languages which will be loaded to highlight code when rendering";
|
|
146
147
|
readonly help_customCss: "Path to a custom CSS file to for the theme to import";
|
|
148
|
+
readonly help_customJs: "Path to a custom JS file to import";
|
|
147
149
|
readonly help_markdownItOptions: "Specify the options passed to markdown-it, the Markdown parser used by TypeDoc";
|
|
148
150
|
readonly help_markdownItLoader: "Specify a callback to be called when loading the markdown-it instance. Will be passed the instance of the parser which TypeDoc will use";
|
|
149
151
|
readonly help_maxTypeConversionDepth: "Set the maximum depth of types to be converted";
|
|
@@ -159,6 +161,7 @@ export declare const translatable: {
|
|
|
159
161
|
readonly help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page";
|
|
160
162
|
readonly help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages";
|
|
161
163
|
readonly help_sourceLinkExternal: "Specifies that source links should be treated as external links to be opened in a new tab";
|
|
164
|
+
readonly help_markdownLinkExternal: "Specifies that http[s]:// links in comments and markdown files should be treated as external links to be opened in a new tab";
|
|
162
165
|
readonly help_githubPages: "Generate a .nojekyll file to prevent 404 errors in GitHub Pages. Defaults to `true`";
|
|
163
166
|
readonly help_hostedBaseUrl: "Specify a base URL to be used in generating a sitemap.xml in our output folder and canonical links. If not specified, no sitemap will be generated";
|
|
164
167
|
readonly help_useHostedBaseUrlForAbsoluteLinks: "If set, TypeDoc will produce absolute links to pages on your site using the hostedBaseUrl option";
|
|
@@ -88,6 +88,7 @@ exports.translatable = {
|
|
|
88
88
|
git_remote_0_not_valid: `The provided git remote "{0}" was not valid. Source links will be broken`,
|
|
89
89
|
// output plugins
|
|
90
90
|
custom_css_file_0_does_not_exist: `Custom CSS file at {0} does not exist`,
|
|
91
|
+
custom_js_file_0_does_not_exist: `Custom JavaScript file at {0} does not exist`,
|
|
91
92
|
unsupported_highlight_language_0_not_highlighted_in_comment_for_1: `Unsupported highlight language {0} will not be highlighted in comment for {1}`,
|
|
92
93
|
unloaded_language_0_not_highlighted_in_comment_for_1: `Code block with language {0} will not be highlighted in comment for {1} as it was not included in the highlightLanguages option`,
|
|
93
94
|
yaml_frontmatter_not_an_object: `Expected YAML frontmatter to be an object`,
|
|
@@ -162,6 +163,7 @@ exports.translatable = {
|
|
|
162
163
|
help_darkHighlightTheme: "Specify the code highlighting theme in dark mode",
|
|
163
164
|
help_highlightLanguages: "Specify the languages which will be loaded to highlight code when rendering",
|
|
164
165
|
help_customCss: "Path to a custom CSS file to for the theme to import",
|
|
166
|
+
help_customJs: "Path to a custom JS file to import",
|
|
165
167
|
help_markdownItOptions: "Specify the options passed to markdown-it, the Markdown parser used by TypeDoc",
|
|
166
168
|
help_markdownItLoader: "Specify a callback to be called when loading the markdown-it instance. Will be passed the instance of the parser which TypeDoc will use",
|
|
167
169
|
help_maxTypeConversionDepth: "Set the maximum depth of types to be converted",
|
|
@@ -177,6 +179,7 @@ exports.translatable = {
|
|
|
177
179
|
help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page",
|
|
178
180
|
help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages",
|
|
179
181
|
help_sourceLinkExternal: "Specifies that source links should be treated as external links to be opened in a new tab",
|
|
182
|
+
help_markdownLinkExternal: "Specifies that http[s]:// links in comments and markdown files should be treated as external links to be opened in a new tab",
|
|
180
183
|
help_githubPages: "Generate a .nojekyll file to prevent 404 errors in GitHub Pages. Defaults to `true`",
|
|
181
184
|
help_hostedBaseUrl: "Specify a base URL to be used in generating a sitemap.xml in our output folder and canonical links. If not specified, no sitemap will be generated",
|
|
182
185
|
help_useHostedBaseUrlForAbsoluteLinks: "If set, TypeDoc will produce absolute links to pages on your site using the hostedBaseUrl option",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import type { JSONOutput, Serializer } from "../../serialization/index";
|
|
3
|
+
import type { DeclarationReference } from "../../converter/comments/declarationReference";
|
|
3
4
|
/**
|
|
4
5
|
* See {@link ReflectionSymbolId}
|
|
5
6
|
*/
|
|
@@ -30,6 +31,7 @@ export declare class ReflectionSymbolId {
|
|
|
30
31
|
constructor(symbol: ts.Symbol, declaration?: ts.Declaration);
|
|
31
32
|
constructor(json: JSONOutput.ReflectionSymbolId);
|
|
32
33
|
getStableKey(): ReflectionSymbolIdString;
|
|
34
|
+
toDeclarationReference(): DeclarationReference;
|
|
33
35
|
toObject(serializer: Serializer): {
|
|
34
36
|
sourceFileName: string;
|
|
35
37
|
qualifiedName: string;
|
|
@@ -12,6 +12,7 @@ const fs_2 = require("../../utils/fs");
|
|
|
12
12
|
const paths_1 = require("../../utils/paths");
|
|
13
13
|
const tsutils_1 = require("../../utils/tsutils");
|
|
14
14
|
const validation_1 = require("../../utils/validation");
|
|
15
|
+
const utils_1 = require("./utils");
|
|
15
16
|
let transientCount = 0;
|
|
16
17
|
const transientIds = new WeakMap();
|
|
17
18
|
/**
|
|
@@ -30,7 +31,7 @@ class ReflectionSymbolId {
|
|
|
30
31
|
else {
|
|
31
32
|
this.qualifiedName = (0, tsutils_1.getQualifiedName)(symbol, symbol.name);
|
|
32
33
|
}
|
|
33
|
-
this.pos = declaration?.
|
|
34
|
+
this.pos = declaration?.getStart() ?? Infinity;
|
|
34
35
|
if (symbol.flags & typescript_1.default.SymbolFlags.Transient) {
|
|
35
36
|
this.transientId = transientIds.get(symbol) ?? ++transientCount;
|
|
36
37
|
transientIds.set(symbol, this.transientId);
|
|
@@ -54,6 +55,18 @@ class ReflectionSymbolId {
|
|
|
54
55
|
return `${this.fileName}\0${this.qualifiedName}`;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
toDeclarationReference() {
|
|
59
|
+
return {
|
|
60
|
+
resolutionStart: "global",
|
|
61
|
+
moduleSource: (0, fs_2.findPackageForPath)(this.fileName),
|
|
62
|
+
symbolReference: {
|
|
63
|
+
path: (0, utils_1.splitUnquotedString)(this.qualifiedName, ".").map((path) => ({
|
|
64
|
+
navigation: ".",
|
|
65
|
+
path,
|
|
66
|
+
})),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
57
70
|
toObject(serializer) {
|
|
58
71
|
const sourceFileName = (0, path_1.isAbsolute)(this.fileName)
|
|
59
72
|
? (0, paths_1.normalizePath)((0, path_1.relative)(serializer.projectRoot, resolveDeclarationMaps(this.fileName)))
|
|
@@ -150,8 +150,10 @@ class DeclarationReflection extends container_1.ContainerReflection {
|
|
|
150
150
|
this.type = de.revive(obj.type, (t) => de.constructType(t));
|
|
151
151
|
this.signatures = de.reviveMany(obj.signatures, (r) => de.constructReflection(r));
|
|
152
152
|
// TypeDoc 0.25, remove check with 0.28.
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
153
154
|
if (obj.indexSignature) {
|
|
154
155
|
this.indexSignatures = [
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
155
157
|
de.revive(obj.indexSignature, (r) => de.constructReflection(r)),
|
|
156
158
|
];
|
|
157
159
|
}
|
|
@@ -61,7 +61,9 @@ class SignatureReflection extends abstract_1.Reflection {
|
|
|
61
61
|
fromObject(de, obj) {
|
|
62
62
|
super.fromObject(de, obj);
|
|
63
63
|
this.sources = de.reviveMany(obj.sources, (t) => new file_1.SourceReference(t.fileName, t.line, t.character));
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
64
65
|
if (obj.typeParameter) {
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
65
67
|
this.typeParameters = de.reviveMany(obj.typeParameter, (t) => de.constructReflection(t));
|
|
66
68
|
}
|
|
67
69
|
else {
|
package/dist/lib/models/types.js
CHANGED
|
@@ -754,20 +754,6 @@ class ReferenceType extends Type {
|
|
|
754
754
|
.fileName.replace(/\\/g, "/");
|
|
755
755
|
if (!symbolPath)
|
|
756
756
|
return ref;
|
|
757
|
-
// Attempt to decide package name from path if it contains "node_modules"
|
|
758
|
-
let startIndex = symbolPath.lastIndexOf("node_modules/");
|
|
759
|
-
if (startIndex !== -1) {
|
|
760
|
-
startIndex += "node_modules/".length;
|
|
761
|
-
let stopIndex = symbolPath.indexOf("/", startIndex);
|
|
762
|
-
// Scoped package, e.g. `@types/node`
|
|
763
|
-
if (symbolPath[startIndex] === "@") {
|
|
764
|
-
stopIndex = symbolPath.indexOf("/", stopIndex + 1);
|
|
765
|
-
}
|
|
766
|
-
const packageName = symbolPath.substring(startIndex, stopIndex);
|
|
767
|
-
ref.package = packageName;
|
|
768
|
-
return ref;
|
|
769
|
-
}
|
|
770
|
-
// Otherwise, look for a "package.json" file in a parent path
|
|
771
757
|
ref.package = (0, fs_1.findPackageForPath)(symbolPath);
|
|
772
758
|
return ref;
|
|
773
759
|
}
|
|
@@ -57,7 +57,7 @@ export interface PageHeading {
|
|
|
57
57
|
* @see {@link Renderer.EVENT_BEGIN_PAGE}
|
|
58
58
|
* @see {@link Renderer.EVENT_END_PAGE}
|
|
59
59
|
*/
|
|
60
|
-
export declare class PageEvent<out Model = unknown>
|
|
60
|
+
export declare class PageEvent<out Model = unknown> {
|
|
61
61
|
/**
|
|
62
62
|
* The project the renderer is currently processing.
|
|
63
63
|
*/
|
|
@@ -107,6 +107,8 @@ export declare class PageEvent<out Model = unknown> extends Event {
|
|
|
107
107
|
* @event
|
|
108
108
|
*/
|
|
109
109
|
static readonly END = "endPage";
|
|
110
|
+
constructor(model: Model);
|
|
111
|
+
/** @deprecated use the single constructor arg instead, will be removed in 0.27 */
|
|
110
112
|
constructor(name: string, model: Model);
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
@@ -45,7 +45,7 @@ class RendererEvent {
|
|
|
45
45
|
* @returns A newly created {@link PageEvent} instance.
|
|
46
46
|
*/
|
|
47
47
|
createPageEvent(mapping) {
|
|
48
|
-
const event = new PageEvent(
|
|
48
|
+
const event = new PageEvent(mapping.model);
|
|
49
49
|
event.project = this.project;
|
|
50
50
|
event.url = mapping.url;
|
|
51
51
|
event.filename = Path.join(this.outputDirectory, mapping.url);
|
|
@@ -70,7 +70,7 @@ RendererEvent.END = "endRender";
|
|
|
70
70
|
* @see {@link Renderer.EVENT_BEGIN_PAGE}
|
|
71
71
|
* @see {@link Renderer.EVENT_END_PAGE}
|
|
72
72
|
*/
|
|
73
|
-
class PageEvent
|
|
73
|
+
class PageEvent {
|
|
74
74
|
/**
|
|
75
75
|
* Start a new section of the page. Sections are collapsible within
|
|
76
76
|
* the "On This Page" sidebar.
|
|
@@ -82,8 +82,7 @@ class PageEvent extends Event {
|
|
|
82
82
|
headings: this.pageHeadings,
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
constructor(
|
|
86
|
-
super(name);
|
|
85
|
+
constructor(nameOrModel, model) {
|
|
87
86
|
/**
|
|
88
87
|
* Links to content within this page that should be rendered in the page navigation.
|
|
89
88
|
* This is built when rendering the document content.
|
|
@@ -98,7 +97,12 @@ class PageEvent extends Event {
|
|
|
98
97
|
headings: this.pageHeadings,
|
|
99
98
|
},
|
|
100
99
|
];
|
|
101
|
-
|
|
100
|
+
if (typeof nameOrModel === "string") {
|
|
101
|
+
this.model = model;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.model = nameOrModel;
|
|
105
|
+
}
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
exports.PageEvent = PageEvent;
|
|
@@ -4,8 +4,8 @@ import { RendererComponent } from "../components";
|
|
|
4
4
|
* source folder to the output directory.
|
|
5
5
|
*/
|
|
6
6
|
export declare class AssetsPlugin extends RendererComponent {
|
|
7
|
-
|
|
8
|
-
accessor
|
|
7
|
+
private accessor customCss;
|
|
8
|
+
private accessor customJs;
|
|
9
9
|
getTranslatedStrings(): {
|
|
10
10
|
copy: import("../../internationalization").TranslatedString;
|
|
11
11
|
copied: import("../../internationalization").TranslatedString;
|
|
@@ -63,7 +63,7 @@ const path_1 = require("path");
|
|
|
63
63
|
* source folder to the output directory.
|
|
64
64
|
*/
|
|
65
65
|
let AssetsPlugin = (() => {
|
|
66
|
-
var _AssetsPlugin_customCss_accessor_storage;
|
|
66
|
+
var _AssetsPlugin_customCss_accessor_storage, _AssetsPlugin_customJs_accessor_storage;
|
|
67
67
|
let _classDecorators = [(0, components_1.Component)({ name: "assets" })];
|
|
68
68
|
let _classDescriptor;
|
|
69
69
|
let _classExtraInitializers = [];
|
|
@@ -72,10 +72,14 @@ let AssetsPlugin = (() => {
|
|
|
72
72
|
let _customCss_decorators;
|
|
73
73
|
let _customCss_initializers = [];
|
|
74
74
|
let _customCss_extraInitializers = [];
|
|
75
|
+
let _customJs_decorators;
|
|
76
|
+
let _customJs_initializers = [];
|
|
77
|
+
let _customJs_extraInitializers = [];
|
|
75
78
|
var AssetsPlugin = _classThis = class extends _classSuper {
|
|
76
|
-
/** @internal */
|
|
77
79
|
get customCss() { return __classPrivateFieldGet(this, _AssetsPlugin_customCss_accessor_storage, "f"); }
|
|
78
80
|
set customCss(value) { __classPrivateFieldSet(this, _AssetsPlugin_customCss_accessor_storage, value, "f"); }
|
|
81
|
+
get customJs() { return __classPrivateFieldGet(this, _AssetsPlugin_customJs_accessor_storage, "f"); }
|
|
82
|
+
set customJs(value) { __classPrivateFieldSet(this, _AssetsPlugin_customJs_accessor_storage, value, "f"); }
|
|
79
83
|
getTranslatedStrings() {
|
|
80
84
|
return {
|
|
81
85
|
copy: this.application.i18n.theme_copy(),
|
|
@@ -100,6 +104,14 @@ let AssetsPlugin = (() => {
|
|
|
100
104
|
this.application.logger.error(this.application.i18n.custom_css_file_0_does_not_exist(this.customCss));
|
|
101
105
|
}
|
|
102
106
|
}
|
|
107
|
+
if (this.customJs) {
|
|
108
|
+
if ((0, fs_2.existsSync)(this.customJs)) {
|
|
109
|
+
(0, fs_1.copySync)(this.customJs, (0, path_1.join)(dest, "custom.js"));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.application.logger.error(this.application.i18n.custom_js_file_0_does_not_exist(this.customJs));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
103
115
|
}
|
|
104
116
|
/**
|
|
105
117
|
* Triggered before the renderer starts rendering a project.
|
|
@@ -128,15 +140,19 @@ let AssetsPlugin = (() => {
|
|
|
128
140
|
constructor() {
|
|
129
141
|
super(...arguments);
|
|
130
142
|
_AssetsPlugin_customCss_accessor_storage.set(this, __runInitializers(this, _customCss_initializers, void 0));
|
|
131
|
-
__runInitializers(this, _customCss_extraInitializers);
|
|
143
|
+
_AssetsPlugin_customJs_accessor_storage.set(this, (__runInitializers(this, _customCss_extraInitializers), __runInitializers(this, _customJs_initializers, void 0)));
|
|
144
|
+
__runInitializers(this, _customJs_extraInitializers);
|
|
132
145
|
}
|
|
133
146
|
};
|
|
134
147
|
_AssetsPlugin_customCss_accessor_storage = new WeakMap();
|
|
148
|
+
_AssetsPlugin_customJs_accessor_storage = new WeakMap();
|
|
135
149
|
__setFunctionName(_classThis, "AssetsPlugin");
|
|
136
150
|
(() => {
|
|
137
151
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
138
152
|
_customCss_decorators = [(0, utils_1.Option)("customCss")];
|
|
153
|
+
_customJs_decorators = [(0, utils_1.Option)("customJs")];
|
|
139
154
|
__esDecorate(_classThis, null, _customCss_decorators, { kind: "accessor", name: "customCss", static: false, private: false, access: { has: obj => "customCss" in obj, get: obj => obj.customCss, set: (obj, value) => { obj.customCss = value; } }, metadata: _metadata }, _customCss_initializers, _customCss_extraInitializers);
|
|
155
|
+
__esDecorate(_classThis, null, _customJs_decorators, { kind: "accessor", name: "customJs", static: false, private: false, access: { has: obj => "customJs" in obj, get: obj => obj.customJs, set: (obj, value) => { obj.customJs = value; } }, metadata: _metadata }, _customJs_initializers, _customJs_extraInitializers);
|
|
140
156
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
141
157
|
AssetsPlugin = _classThis = _classDescriptor.value;
|
|
142
158
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -100,13 +100,11 @@ export interface RendererEvents {
|
|
|
100
100
|
*
|
|
101
101
|
* * {@link Renderer.EVENT_BEGIN_PAGE}<br>
|
|
102
102
|
* Triggered before a document will be rendered. The listener receives an instance of
|
|
103
|
-
* {@link PageEvent}.
|
|
104
|
-
* document can be canceled.
|
|
103
|
+
* {@link PageEvent}.
|
|
105
104
|
*
|
|
106
105
|
* * {@link Renderer.EVENT_END_PAGE}<br>
|
|
107
106
|
* Triggered after a document has been rendered, just before it is written to disc. The
|
|
108
|
-
* listener receives an instance of {@link PageEvent}.
|
|
109
|
-
* {@link PageEvent.preventDefault} the the document will not be saved to disc.
|
|
107
|
+
* listener receives an instance of {@link PageEvent}.
|
|
110
108
|
*
|
|
111
109
|
* * {@link Renderer.EVENT_END}<br>
|
|
112
110
|
* Triggered after the renderer has written all documents. The listener receives
|
|
@@ -108,13 +108,11 @@ const jsx_1 = require("../utils/jsx");
|
|
|
108
108
|
*
|
|
109
109
|
* * {@link Renderer.EVENT_BEGIN_PAGE}<br>
|
|
110
110
|
* Triggered before a document will be rendered. The listener receives an instance of
|
|
111
|
-
* {@link PageEvent}.
|
|
112
|
-
* document can be canceled.
|
|
111
|
+
* {@link PageEvent}.
|
|
113
112
|
*
|
|
114
113
|
* * {@link Renderer.EVENT_END_PAGE}<br>
|
|
115
114
|
* Triggered after a document has been rendered, just before it is written to disc. The
|
|
116
|
-
* listener receives an instance of {@link PageEvent}.
|
|
117
|
-
* {@link PageEvent.preventDefault} the the document will not be saved to disc.
|
|
115
|
+
* listener receives an instance of {@link PageEvent}.
|
|
118
116
|
*
|
|
119
117
|
* * {@link Renderer.EVENT_END}<br>
|
|
120
118
|
* Triggered after the renderer has written all documents. The listener receives
|
|
@@ -11,6 +11,7 @@ export declare class MarkedPlugin extends ContextAwareRendererComponent {
|
|
|
11
11
|
accessor lightTheme: BundledTheme;
|
|
12
12
|
accessor darkTheme: BundledTheme;
|
|
13
13
|
accessor markdownItOptions: Record<string, unknown>;
|
|
14
|
+
accessor markdownLinkExternal: boolean;
|
|
14
15
|
private parser?;
|
|
15
16
|
/**
|
|
16
17
|
* This needing to be here really feels hacky... probably some nicer way to do this.
|
|
@@ -75,7 +75,7 @@ function getDefaultSlugger(logger) {
|
|
|
75
75
|
* @internal
|
|
76
76
|
*/
|
|
77
77
|
let MarkedPlugin = (() => {
|
|
78
|
-
var _MarkedPlugin_lightTheme_accessor_storage, _MarkedPlugin_darkTheme_accessor_storage, _MarkedPlugin_markdownItOptions_accessor_storage;
|
|
78
|
+
var _MarkedPlugin_lightTheme_accessor_storage, _MarkedPlugin_darkTheme_accessor_storage, _MarkedPlugin_markdownItOptions_accessor_storage, _MarkedPlugin_markdownLinkExternal_accessor_storage;
|
|
79
79
|
let _classDecorators = [(0, components_1.Component)({ name: "marked" })];
|
|
80
80
|
let _classDescriptor;
|
|
81
81
|
let _classExtraInitializers = [];
|
|
@@ -90,13 +90,17 @@ let MarkedPlugin = (() => {
|
|
|
90
90
|
let _markdownItOptions_decorators;
|
|
91
91
|
let _markdownItOptions_initializers = [];
|
|
92
92
|
let _markdownItOptions_extraInitializers = [];
|
|
93
|
+
let _markdownLinkExternal_decorators;
|
|
94
|
+
let _markdownLinkExternal_initializers = [];
|
|
95
|
+
let _markdownLinkExternal_extraInitializers = [];
|
|
93
96
|
var MarkedPlugin = _classThis = class extends _classSuper {
|
|
94
97
|
constructor() {
|
|
95
98
|
super(...arguments);
|
|
96
99
|
_MarkedPlugin_lightTheme_accessor_storage.set(this, __runInitializers(this, _lightTheme_initializers, void 0));
|
|
97
100
|
_MarkedPlugin_darkTheme_accessor_storage.set(this, (__runInitializers(this, _lightTheme_extraInitializers), __runInitializers(this, _darkTheme_initializers, void 0)));
|
|
98
101
|
_MarkedPlugin_markdownItOptions_accessor_storage.set(this, (__runInitializers(this, _darkTheme_extraInitializers), __runInitializers(this, _markdownItOptions_initializers, void 0)));
|
|
99
|
-
this
|
|
102
|
+
_MarkedPlugin_markdownLinkExternal_accessor_storage.set(this, (__runInitializers(this, _markdownItOptions_extraInitializers), __runInitializers(this, _markdownLinkExternal_initializers, void 0)));
|
|
103
|
+
this.parser = __runInitializers(this, _markdownLinkExternal_extraInitializers);
|
|
100
104
|
/**
|
|
101
105
|
* This needing to be here really feels hacky... probably some nicer way to do this.
|
|
102
106
|
* Revisit when adding support for arbitrary pages in 0.26.
|
|
@@ -110,6 +114,8 @@ let MarkedPlugin = (() => {
|
|
|
110
114
|
set darkTheme(value) { __classPrivateFieldSet(this, _MarkedPlugin_darkTheme_accessor_storage, value, "f"); }
|
|
111
115
|
get markdownItOptions() { return __classPrivateFieldGet(this, _MarkedPlugin_markdownItOptions_accessor_storage, "f"); }
|
|
112
116
|
set markdownItOptions(value) { __classPrivateFieldSet(this, _MarkedPlugin_markdownItOptions_accessor_storage, value, "f"); }
|
|
117
|
+
get markdownLinkExternal() { return __classPrivateFieldGet(this, _MarkedPlugin_markdownLinkExternal_accessor_storage, "f"); }
|
|
118
|
+
set markdownLinkExternal(value) { __classPrivateFieldSet(this, _MarkedPlugin_markdownLinkExternal_accessor_storage, value, "f"); }
|
|
113
119
|
/**
|
|
114
120
|
* Create a new MarkedPlugin instance.
|
|
115
121
|
*/
|
|
@@ -290,6 +296,16 @@ let MarkedPlugin = (() => {
|
|
|
290
296
|
const token = tokens[idx];
|
|
291
297
|
const href = token.attrGet("href")?.replace(/^#(?:md:)?(.+)/, "#md:$1");
|
|
292
298
|
if (href) {
|
|
299
|
+
// Note: This doesn't catch @link tags to reflections as those
|
|
300
|
+
// will be relative links. This will likely have to change with
|
|
301
|
+
// the introduction of support for customized routers whenever
|
|
302
|
+
// that becomes a real thing.
|
|
303
|
+
if (this.markdownLinkExternal && /https?:\/\//i.test(href)) {
|
|
304
|
+
token.attrSet("target", "_blank");
|
|
305
|
+
const classes = token.attrGet("class")?.split(" ") || [];
|
|
306
|
+
classes.push("external");
|
|
307
|
+
token.attrSet("class", classes.join(" "));
|
|
308
|
+
}
|
|
293
309
|
token.attrSet("href", href);
|
|
294
310
|
}
|
|
295
311
|
return self.renderToken(tokens, idx, options);
|
|
@@ -307,15 +323,18 @@ let MarkedPlugin = (() => {
|
|
|
307
323
|
_MarkedPlugin_lightTheme_accessor_storage = new WeakMap();
|
|
308
324
|
_MarkedPlugin_darkTheme_accessor_storage = new WeakMap();
|
|
309
325
|
_MarkedPlugin_markdownItOptions_accessor_storage = new WeakMap();
|
|
326
|
+
_MarkedPlugin_markdownLinkExternal_accessor_storage = new WeakMap();
|
|
310
327
|
__setFunctionName(_classThis, "MarkedPlugin");
|
|
311
328
|
(() => {
|
|
312
329
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
313
330
|
_lightTheme_decorators = [(0, utils_1.Option)("lightHighlightTheme")];
|
|
314
331
|
_darkTheme_decorators = [(0, utils_1.Option)("darkHighlightTheme")];
|
|
315
332
|
_markdownItOptions_decorators = [(0, utils_1.Option)("markdownItOptions")];
|
|
333
|
+
_markdownLinkExternal_decorators = [(0, utils_1.Option)("markdownLinkExternal")];
|
|
316
334
|
__esDecorate(_classThis, null, _lightTheme_decorators, { kind: "accessor", name: "lightTheme", static: false, private: false, access: { has: obj => "lightTheme" in obj, get: obj => obj.lightTheme, set: (obj, value) => { obj.lightTheme = value; } }, metadata: _metadata }, _lightTheme_initializers, _lightTheme_extraInitializers);
|
|
317
335
|
__esDecorate(_classThis, null, _darkTheme_decorators, { kind: "accessor", name: "darkTheme", static: false, private: false, access: { has: obj => "darkTheme" in obj, get: obj => obj.darkTheme, set: (obj, value) => { obj.darkTheme = value; } }, metadata: _metadata }, _darkTheme_initializers, _darkTheme_extraInitializers);
|
|
318
336
|
__esDecorate(_classThis, null, _markdownItOptions_decorators, { kind: "accessor", name: "markdownItOptions", static: false, private: false, access: { has: obj => "markdownItOptions" in obj, get: obj => obj.markdownItOptions, set: (obj, value) => { obj.markdownItOptions = value; } }, metadata: _metadata }, _markdownItOptions_initializers, _markdownItOptions_extraInitializers);
|
|
337
|
+
__esDecorate(_classThis, null, _markdownLinkExternal_decorators, { kind: "accessor", name: "markdownLinkExternal", static: false, private: false, access: { has: obj => "markdownLinkExternal" in obj, get: obj => obj.markdownLinkExternal, set: (obj, value) => { obj.markdownLinkExternal = value; } }, metadata: _metadata }, _markdownLinkExternal_initializers, _markdownLinkExternal_extraInitializers);
|
|
319
338
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
320
339
|
MarkedPlugin = _classThis = _classDescriptor.value;
|
|
321
340
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -258,6 +258,9 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
258
258
|
children,
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
+
if (opts.excludeReferences && element instanceof models_1.ReferenceReflection) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
261
264
|
return {
|
|
262
265
|
text: (0, lib_1.getDisplayName)(element),
|
|
263
266
|
path: element.url,
|
|
@@ -17,6 +17,7 @@ const defaultLayout = (context, template, props) => (utils_1.JSX.createElement("
|
|
|
17
17
|
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/highlight.css", true) }),
|
|
18
18
|
context.options.getValue("customCss") && (utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/custom.css", true) })),
|
|
19
19
|
utils_1.JSX.createElement("script", { defer: true, src: context.relativeURL("assets/main.js", true) }),
|
|
20
|
+
context.options.getValue("customJs") && (utils_1.JSX.createElement("script", { defer: true, src: context.relativeURL("assets/custom.js", true) })),
|
|
20
21
|
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/icons.js", true), id: "tsd-icons-script" }),
|
|
21
22
|
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/search.js", true), id: "tsd-search-script" }),
|
|
22
23
|
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/navigation.js", true), id: "tsd-nav-script" }),
|
|
@@ -30,11 +30,12 @@ function commentTags(context, props) {
|
|
|
30
30
|
: context.internationalization.translateTagName(item.tag);
|
|
31
31
|
const anchor = props.getUniqueAliasInPage(name);
|
|
32
32
|
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
33
|
-
utils_1.JSX.createElement("
|
|
34
|
-
utils_1.JSX.createElement("
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
utils_1.JSX.createElement("div", { class: `tsd-tag-${name}` },
|
|
34
|
+
utils_1.JSX.createElement("h4", { class: "tsd-anchor-link" },
|
|
35
|
+
utils_1.JSX.createElement("a", { id: anchor, class: "tsd-anchor" }),
|
|
36
|
+
name,
|
|
37
|
+
(0, anchor_icon_1.anchorIcon)(context, anchor)),
|
|
38
|
+
utils_1.JSX.createElement(utils_1.Raw, { html: context.markdown(item.content) }))));
|
|
38
39
|
})),
|
|
39
40
|
afterTags));
|
|
40
41
|
}
|
|
@@ -24,11 +24,22 @@ function memberDeclaration(context, props) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
const visitor = { reflection: renderTypeDeclaration };
|
|
27
|
+
/** Fix for #2717. If type is the same as value the type is omitted */
|
|
28
|
+
function shouldRenderType() {
|
|
29
|
+
if (props.type && props.type.type === "literal") {
|
|
30
|
+
const reflectionTypeString = props.type.toString();
|
|
31
|
+
const defaultValue = props.defaultValue;
|
|
32
|
+
if (defaultValue === undefined || reflectionTypeString === defaultValue.toString()) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
27
38
|
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
28
39
|
utils_1.JSX.createElement("div", { class: "tsd-signature" },
|
|
29
40
|
utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(props) }, (0, lib_1.wbr)(props.name)),
|
|
30
41
|
(0, lib_1.renderTypeParametersSignature)(context, props.typeParameters),
|
|
31
|
-
|
|
42
|
+
shouldRenderType() && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
32
43
|
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" },
|
|
33
44
|
!!props.flags.isOptional && "?",
|
|
34
45
|
":"),
|
|
@@ -35,7 +35,7 @@ function reflectionTemplate(context, props) {
|
|
|
35
35
|
utils_1.JSX.createElement("h4", { class: "tsd-before-signature" }, context.i18n.theme_indexable()),
|
|
36
36
|
utils_1.JSX.createElement("ul", { class: "tsd-signatures" }, props.model.indexSignatures.map((index) => renderIndexSignature(context, index))))),
|
|
37
37
|
!props.model.signatures && context.memberSources(props.model))),
|
|
38
|
-
!!props.model.
|
|
38
|
+
!!props.model.childrenIncludingDocuments?.length && context.index(props.model),
|
|
39
39
|
context.members(props.model)));
|
|
40
40
|
}
|
|
41
41
|
function renderIndexSignature(context, index) {
|
package/dist/lib/utils/fs.js
CHANGED
|
@@ -330,6 +330,17 @@ function discoverPackageJson(dir) {
|
|
|
330
330
|
// dir -> package name according to package.json in this or some parent dir
|
|
331
331
|
const packageCache = new Map();
|
|
332
332
|
function findPackageForPath(sourcePath) {
|
|
333
|
+
// Attempt to decide package name from path if it contains "node_modules"
|
|
334
|
+
let startIndex = sourcePath.lastIndexOf("node_modules/");
|
|
335
|
+
if (startIndex !== -1) {
|
|
336
|
+
startIndex += "node_modules/".length;
|
|
337
|
+
let stopIndex = sourcePath.indexOf("/", startIndex);
|
|
338
|
+
// Scoped package, e.g. `@types/node`
|
|
339
|
+
if (sourcePath[startIndex] === "@") {
|
|
340
|
+
stopIndex = sourcePath.indexOf("/", stopIndex + 1);
|
|
341
|
+
}
|
|
342
|
+
return sourcePath.substring(startIndex, stopIndex);
|
|
343
|
+
}
|
|
333
344
|
const dir = (0, path_1.dirname)(sourcePath);
|
|
334
345
|
const cache = packageCache.get(dir);
|
|
335
346
|
if (cache) {
|
|
@@ -85,6 +85,7 @@ export interface TypeDocOptionMap {
|
|
|
85
85
|
disableSources: boolean;
|
|
86
86
|
sourceLinkTemplate: string;
|
|
87
87
|
sourceLinkExternal: boolean;
|
|
88
|
+
markdownLinkExternal: boolean;
|
|
88
89
|
disableGit: boolean;
|
|
89
90
|
gitRevision: string;
|
|
90
91
|
gitRemote: string;
|
|
@@ -98,6 +99,7 @@ export interface TypeDocOptionMap {
|
|
|
98
99
|
darkHighlightTheme: ShikiTheme;
|
|
99
100
|
highlightLanguages: string[];
|
|
100
101
|
customCss: string;
|
|
102
|
+
customJs: string;
|
|
101
103
|
markdownItOptions: ManuallyValidatedOption<Record<string, unknown>>;
|
|
102
104
|
/**
|
|
103
105
|
* Will be called when TypeDoc is setting up the markdown parser to use to render markdown.
|
|
@@ -142,6 +144,7 @@ export interface TypeDocOptionMap {
|
|
|
142
144
|
includeGroups: boolean;
|
|
143
145
|
includeFolders: boolean;
|
|
144
146
|
compactFolders: boolean;
|
|
147
|
+
excludeReferences: boolean;
|
|
145
148
|
};
|
|
146
149
|
visibilityFilters: ManuallyValidatedOption<{
|
|
147
150
|
protected?: boolean;
|
|
@@ -298,6 +298,11 @@ function addTypeDocOptions(options) {
|
|
|
298
298
|
help: (i18n) => i18n.help_customCss(),
|
|
299
299
|
type: declaration_1.ParameterType.Path,
|
|
300
300
|
});
|
|
301
|
+
options.addDeclaration({
|
|
302
|
+
name: "customJs",
|
|
303
|
+
help: (i18n) => i18n.help_customJs(),
|
|
304
|
+
type: declaration_1.ParameterType.Path,
|
|
305
|
+
});
|
|
301
306
|
options.addDeclaration({
|
|
302
307
|
name: "markdownItOptions",
|
|
303
308
|
help: (i18n) => i18n.help_markdownItOptions(),
|
|
@@ -393,6 +398,12 @@ function addTypeDocOptions(options) {
|
|
|
393
398
|
help: (i18n) => i18n.help_sourceLinkExternal(),
|
|
394
399
|
type: declaration_1.ParameterType.Boolean,
|
|
395
400
|
});
|
|
401
|
+
options.addDeclaration({
|
|
402
|
+
name: "markdownLinkExternal",
|
|
403
|
+
help: (i18n) => i18n.help_markdownLinkExternal(),
|
|
404
|
+
type: declaration_1.ParameterType.Boolean,
|
|
405
|
+
defaultValue: true,
|
|
406
|
+
});
|
|
396
407
|
options.addDeclaration({
|
|
397
408
|
name: "githubPages",
|
|
398
409
|
help: (i18n) => i18n.help_githubPages(),
|
|
@@ -403,7 +414,7 @@ function addTypeDocOptions(options) {
|
|
|
403
414
|
name: "hostedBaseUrl",
|
|
404
415
|
help: (i18n) => i18n.help_hostedBaseUrl(),
|
|
405
416
|
validate(value, i18n) {
|
|
406
|
-
if (!/https
|
|
417
|
+
if (!/https?:\/\//i.test(value)) {
|
|
407
418
|
throw new Error(i18n.hostedBaseUrl_must_start_with_http());
|
|
408
419
|
}
|
|
409
420
|
},
|
|
@@ -502,6 +513,7 @@ function addTypeDocOptions(options) {
|
|
|
502
513
|
includeGroups: false,
|
|
503
514
|
includeFolders: true,
|
|
504
515
|
compactFolders: true,
|
|
516
|
+
excludeReferences: false,
|
|
505
517
|
},
|
|
506
518
|
});
|
|
507
519
|
options.addDeclaration({
|
|
@@ -3,4 +3,4 @@ export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@exam
|
|
|
3
3
|
export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
|
|
4
4
|
export declare const inlineTags: readonly ["@link", "@inheritDoc", "@label", "@linkcode", "@linkplain"];
|
|
5
5
|
export declare const tsdocModifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual"];
|
|
6
|
-
export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual", "@class", "@enum", "@event", "@hidden", "@hideCategories", "@hideconstructor", "@hideGroups", "@ignore", "@interface", "@namespace", "@overload", "@private", "@protected", "@showCategories", "@showGroups"];
|
|
6
|
+
export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual", "@abstract", "@class", "@enum", "@event", "@hidden", "@hideCategories", "@hideconstructor", "@hideGroups", "@ignore", "@interface", "@namespace", "@overload", "@private", "@protected", "@showCategories", "@showGroups"];
|
package/dist/lib/utils/sort.js
CHANGED
|
@@ -46,14 +46,14 @@ const sorts = {
|
|
|
46
46
|
return false;
|
|
47
47
|
},
|
|
48
48
|
alphabetical(a, b) {
|
|
49
|
-
return a.name <
|
|
49
|
+
return a.name.localeCompare(b.name) < 0;
|
|
50
50
|
},
|
|
51
51
|
"alphabetical-ignoring-documents"(a, b) {
|
|
52
52
|
if (a.kindOf(kind_1.ReflectionKind.Document) ||
|
|
53
53
|
b.kindOf(kind_1.ReflectionKind.Document)) {
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
|
-
return a.name <
|
|
56
|
+
return a.name.localeCompare(b.name) < 0;
|
|
57
57
|
},
|
|
58
58
|
"enum-value-ascending"(a, b) {
|
|
59
59
|
if (a.kind == kind_1.ReflectionKind.EnumMember &&
|
|
@@ -8,7 +8,7 @@ function getBrokenPartLinks(parts) {
|
|
|
8
8
|
for (const part of parts) {
|
|
9
9
|
if (part.kind === "inline-tag" &&
|
|
10
10
|
linkTags.includes(part.tag) &&
|
|
11
|
-
!part.target) {
|
|
11
|
+
(!part.target || part.target instanceof models_1.ReflectionSymbolId)) {
|
|
12
12
|
links.push(part.text.trim());
|
|
13
13
|
}
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typedoc",
|
|
3
3
|
"description": "Create api documentation for TypeScript projects.",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.8",
|
|
5
5
|
"homepage": "https://typedoc.org",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js",
|
|
@@ -27,27 +27,27 @@
|
|
|
27
27
|
"lunr": "^2.3.9",
|
|
28
28
|
"markdown-it": "^14.1.0",
|
|
29
29
|
"minimatch": "^9.0.5",
|
|
30
|
-
"shiki": "^1.
|
|
31
|
-
"yaml": "^2.
|
|
30
|
+
"shiki": "^1.16.2",
|
|
31
|
+
"yaml": "^2.5.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x"
|
|
34
|
+
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/lunr": "^2.3.7",
|
|
38
|
-
"@types/markdown-it": "^14.1.
|
|
38
|
+
"@types/markdown-it": "^14.1.2",
|
|
39
39
|
"@types/mocha": "^10.0.7",
|
|
40
40
|
"@types/node": "18",
|
|
41
41
|
"@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#34113409e3a171e68ce5e2b55461ef5c35591cfe",
|
|
42
42
|
"c8": "^10.1.2",
|
|
43
|
-
"esbuild": "^0.
|
|
44
|
-
"eslint": "^9.
|
|
45
|
-
"mocha": "^10.
|
|
46
|
-
"prettier": "3.3.
|
|
47
|
-
"puppeteer": "^
|
|
43
|
+
"esbuild": "^0.23.1",
|
|
44
|
+
"eslint": "^9.9.1",
|
|
45
|
+
"mocha": "^10.7.3",
|
|
46
|
+
"prettier": "3.3.3",
|
|
47
|
+
"puppeteer": "^23.3.0",
|
|
48
48
|
"ts-node": "^10.9.2",
|
|
49
|
-
"typescript": "5.
|
|
50
|
-
"typescript-eslint": "^8.0
|
|
49
|
+
"typescript": "5.6.1-rc",
|
|
50
|
+
"typescript-eslint": "^8.4.0"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
53
53
|
"/bin",
|