typedoc 0.26.7 → 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.
@@ -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
  }
@@ -60,16 +60,19 @@ function resolveLinkTag(reflection, part, externalResolver, options) {
60
60
  part.tsLinkText ||
61
61
  (options.preserveLinkText ? part.text : target.name);
62
62
  }
63
- else if (declRef) {
63
+ else {
64
64
  // If we didn't find a target, we might be pointing to a symbol in another project that will be merged in
65
65
  // or some external symbol, so ask external resolvers to try resolution. Don't use regular declaration ref
66
66
  // resolution in case it matches something that would have been merged in later.
67
- const externalResolveResult = externalResolver(declRef[0], reflection, part, part.target instanceof models_1.ReflectionSymbolId
68
- ? part.target
69
- : undefined);
70
- defaultDisplayText = options.preserveLinkText
71
- ? part.text
72
- : part.text.substring(0, pos);
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));
73
76
  switch (typeof externalResolveResult) {
74
77
  case "string":
75
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.PrefixUnaryExpression:
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 "[]";
@@ -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 标记时无法读取文件 {0}",
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
- // relative_path_0_is_not_a_file_and_will_not_be_copied_to_output
37
- inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0: "内联 @inheritDoc 标记不应出现在块标记内,因为它不会在 {0} 处的注释中被处理。",
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: "遇到未知的区块标记 {0}",
49
- unknown_inline_tag_0: "遇到未知的内联标记 {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: "无法解析“{1}”评论中的“{0}”链接",
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} 的评论包含“{1}”的 @categoryDe​​scription,但该类别中没有子项",
59
- comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0} 的评论包含“{1}”的 @groupDescription,但该组中没有子项",
63
+ comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0} 的注释包含“{1}”的 @categoryDe​​scription,但该类别中没有子项",
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: "修饰符标记 {0} 与 {2} 注释中的 {1} 互斥",
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} 的评论中找不到要继承的评论“{0}”",
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,因此无法生成源链接。设置 sourceLinkTemplate 或 disableSources 以阻止源跟踪",
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
- unsupported_highlight_language_0_not_highlighted_in_comment_for_1: "不支持的突出显示语言 {0} 将不会在 {1} 的评论中突出显示",
77
- unloaded_language_0_not_highlighted_in_comment_for_1: "语言为 {0} 的代码块将不会在 {1} 的注释中突出显示,因为它未包含在 highlightLanguages 选项中",
78
- yaml_frontmatter_not_an_object: "预期 YAML 前置内容为对象",
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
- // saved_relative_path_0_resolved_from_1_is_not_a_file
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
  });
@@ -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?.pos ?? Infinity;
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)))
@@ -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
  }
@@ -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("h4", { class: "tsd-anchor-link" },
34
- utils_1.JSX.createElement("a", { id: anchor, class: "tsd-anchor" }),
35
- name,
36
- (0, anchor_icon_1.anchorIcon)(context, anchor)),
37
- utils_1.JSX.createElement(utils_1.Raw, { html: context.markdown(item.content) })));
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
- props.type && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
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.children?.length && context.index(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) {
@@ -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) {
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.7",
4
+ "version": "0.26.8",
5
5
  "homepage": "https://typedoc.org",
6
6
  "exports": {
7
7
  ".": "./dist/index.js",