typedoc 0.28.8 → 0.28.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/application.js +0 -2
- package/dist/lib/converter/factories/symbol-id.d.ts +0 -1
- package/dist/lib/converter/factories/symbol-id.js +3 -50
- package/dist/lib/converter/plugins/ImplementsPlugin.js +7 -4
- package/dist/lib/converter/plugins/PackagePlugin.js +2 -2
- package/dist/lib/internationalization/locales/zh.cjs +9 -2
- package/dist/lib/internationalization/locales/zh.d.cts +9 -2
- package/dist/lib/utils/declaration-maps.d.ts +3 -0
- package/dist/lib/utils/declaration-maps.js +51 -0
- package/dist/lib/utils/entry-point.js +6 -2
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +1 -0
- package/package.json +9 -9
package/dist/lib/application.js
CHANGED
|
@@ -59,7 +59,6 @@ import { Outputs } from "./output/output.js";
|
|
|
59
59
|
import { validateMergeModuleWith } from "./validation/unusedMergeModuleWith.js";
|
|
60
60
|
import { diagnostic, diagnostics } from "./utils/loggers.js";
|
|
61
61
|
import { ValidatingFileRegistry } from "./utils/ValidatingFileRegistry.js";
|
|
62
|
-
import { addInferredDeclarationMapPaths } from "./converter/factories/symbol-id.js";
|
|
63
62
|
import { Internationalization } from "./internationalization/internationalization.js";
|
|
64
63
|
const packageInfo = JSON.parse(readFileSync(Path.join(fileURLToPath(import.meta.url), "../../../package.json"), "utf8"));
|
|
65
64
|
const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
|
|
@@ -626,7 +625,6 @@ let Application = (() => {
|
|
|
626
625
|
this.logger.error(i18n.nested_packages_unsupported_0(nicePath(dir)));
|
|
627
626
|
continue;
|
|
628
627
|
}
|
|
629
|
-
addInferredDeclarationMapPaths(opts.getCompilerOptions(), opts.getFileNames());
|
|
630
628
|
projectsToConvert.push({ dir, options: opts });
|
|
631
629
|
}
|
|
632
630
|
for (const { dir, options } of projectsToConvert) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ReflectionSymbolId } from "#models";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
export declare function createSymbolIdImpl(symbol: ts.Symbol, declaration?: ts.Declaration): ReflectionSymbolId;
|
|
4
|
-
export declare function addInferredDeclarationMapPaths(opts: ts.CompilerOptions, files: readonly string[]): void;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ReflectionSymbolId } from "#models";
|
|
2
|
-
import { findPackageForPath,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { join, relative, resolve } from "node:path";
|
|
2
|
+
import { findPackageForPath, getQualifiedName, normalizePath, resolveDeclarationMaps } from "#node-utils";
|
|
3
|
+
import {} from "#utils";
|
|
4
|
+
import { relative } from "node:path";
|
|
6
5
|
import ts from "typescript";
|
|
7
|
-
const declarationMapCache = new Map();
|
|
8
6
|
let transientCount = 0;
|
|
9
7
|
const transientIds = new WeakMap();
|
|
10
8
|
// Don't use this directly, use Context.createSymbolId instead.
|
|
@@ -47,48 +45,3 @@ export function createSymbolIdImpl(symbol, declaration) {
|
|
|
47
45
|
id.fileName = normalizePath(sourceFileName);
|
|
48
46
|
return id;
|
|
49
47
|
}
|
|
50
|
-
function resolveDeclarationMaps(file) {
|
|
51
|
-
if (!/\.d\.[cm]?ts$/.test(file))
|
|
52
|
-
return file;
|
|
53
|
-
if (declarationMapCache.has(file))
|
|
54
|
-
return declarationMapCache.get(file);
|
|
55
|
-
const mapFile = file + ".map";
|
|
56
|
-
if (!existsSync(mapFile))
|
|
57
|
-
return file;
|
|
58
|
-
let sourceMap;
|
|
59
|
-
try {
|
|
60
|
-
sourceMap = JSON.parse(readFile(mapFile));
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
return file;
|
|
64
|
-
}
|
|
65
|
-
if (Validation.validate({
|
|
66
|
-
file: String,
|
|
67
|
-
sourceRoot: Validation.optional(String),
|
|
68
|
-
sources: [Array, String],
|
|
69
|
-
}, sourceMap)) {
|
|
70
|
-
// There's a pretty large assumption in here that we only have
|
|
71
|
-
// 1 source file per js file. This is a pretty standard typescript approach,
|
|
72
|
-
// but people might do interesting things with transpilation that could break this.
|
|
73
|
-
let source = sourceMap.sources[0];
|
|
74
|
-
// If we have a sourceRoot, trim any leading slash from the source, and join them
|
|
75
|
-
// Similar to how it's done at https://github.com/mozilla/source-map/blob/58819f09018d56ef84dc41ba9c93f554e0645169/lib/util.js#L412
|
|
76
|
-
if (sourceMap.sourceRoot !== undefined) {
|
|
77
|
-
source = source.replace(/^\//, "");
|
|
78
|
-
source = join(sourceMap.sourceRoot, source);
|
|
79
|
-
}
|
|
80
|
-
const result = resolve(mapFile, "..", source);
|
|
81
|
-
declarationMapCache.set(file, result);
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
return file;
|
|
85
|
-
}
|
|
86
|
-
// See also: inferEntryPoints in entry-point.ts
|
|
87
|
-
export function addInferredDeclarationMapPaths(opts, files) {
|
|
88
|
-
const rootDir = opts.rootDir || getCommonDirectory(files);
|
|
89
|
-
const declDir = opts.declarationDir || opts.outDir || rootDir;
|
|
90
|
-
for (const file of files) {
|
|
91
|
-
const mapFile = normalizePath(resolve(declDir, relative(rootDir, file)).replace(/\.([cm]?[tj]s)x?$/, ".d.$1"));
|
|
92
|
-
declarationMapCache.set(mapFile, file);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -95,18 +95,21 @@ export class ImplementsPlugin extends ConverterComponent {
|
|
|
95
95
|
// serialization/deserialization, might point to an unexpected location. (See the mixin
|
|
96
96
|
// converter tests, I suspect this might actually be an indication of something else slightly
|
|
97
97
|
// broken there, but don't want to spend more time with this right now.)
|
|
98
|
+
// #2982, even more unfortunately, we only want to keep the link if it is pointing to a reflection
|
|
99
|
+
// which will receive a link during rendering.
|
|
100
|
+
const isValidRef = (ref) => ref.reflection && !ref.reflection.parent?.kindOf(ReflectionKind.TypeLiteral);
|
|
98
101
|
for (const child of reflection.children || []) {
|
|
99
|
-
if (child.inheritedFrom && !child.inheritedFrom
|
|
102
|
+
if (child.inheritedFrom && !isValidRef(child.inheritedFrom)) {
|
|
100
103
|
child.inheritedFrom = ReferenceType.createBrokenReference(child.inheritedFrom.name, project);
|
|
101
104
|
}
|
|
102
|
-
if (child.overwrites && !child.overwrites
|
|
105
|
+
if (child.overwrites && !isValidRef(child.overwrites)) {
|
|
103
106
|
child.overwrites = ReferenceType.createBrokenReference(child.overwrites.name, project);
|
|
104
107
|
}
|
|
105
108
|
for (const childSig of child.getAllSignatures()) {
|
|
106
|
-
if (childSig.inheritedFrom && !childSig.inheritedFrom
|
|
109
|
+
if (childSig.inheritedFrom && !isValidRef(childSig.inheritedFrom)) {
|
|
107
110
|
childSig.inheritedFrom = ReferenceType.createBrokenReference(childSig.inheritedFrom.name, project);
|
|
108
111
|
}
|
|
109
|
-
if (childSig.overwrites && !childSig.overwrites
|
|
112
|
+
if (childSig.overwrites && !isValidRef(childSig.overwrites)) {
|
|
110
113
|
childSig.overwrites = ReferenceType.createBrokenReference(childSig.overwrites.name, project);
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -37,7 +37,7 @@ import { ConverterComponent } from "../components.js";
|
|
|
37
37
|
import { ApplicationEvents } from "../../application-events.js";
|
|
38
38
|
import { ConverterEvents } from "../converter-events.js";
|
|
39
39
|
import { i18n, MinimalSourceFile, NormalizedPathUtils } from "#utils";
|
|
40
|
-
import {
|
|
40
|
+
import { deriveRootDir, discoverPackageJson, nicePath, normalizePath, Option, readFile, } from "#node-utils";
|
|
41
41
|
import { existsSync } from "fs";
|
|
42
42
|
/**
|
|
43
43
|
* A handler that tries to find the package.json and readme.md files of the
|
|
@@ -117,7 +117,7 @@ let PackagePlugin = (() => {
|
|
|
117
117
|
this.readmeContents = undefined;
|
|
118
118
|
this.packageJson = undefined;
|
|
119
119
|
const dirName = this.application.options.packageDir ??
|
|
120
|
-
Path.resolve(
|
|
120
|
+
Path.resolve(deriveRootDir(this.entryPoints));
|
|
121
121
|
this.application.logger.verbose(`Begin package.json search at ${nicePath(dirName)}`);
|
|
122
122
|
const packageJson = discoverPackageJson(dirName);
|
|
123
123
|
this.packageJson = packageJson?.content;
|
|
@@ -56,6 +56,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
56
56
|
open_brace_within_inline_tag: "在内联标签中遇到左括号,这可能是一个错误",
|
|
57
57
|
inline_tag_not_closed: "内联标签未关闭",
|
|
58
58
|
// validation
|
|
59
|
+
comment_for_0_links_to_1_not_included_in_docs_use_external_link_2: `{0} 注释中指向 “{1}” 的已解析的链接不会被包含在文档中。请将 {2} 导出或添加至 externalSymbolLinkMappings 选项以修复该警告`,
|
|
59
60
|
failed_to_resolve_link_to_0_in_comment_for_1: "无法解析 {1} 注释中指向 “{0}” 的链接",
|
|
60
61
|
failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "无法解析 {1} 的注释中指向 “{0}” 的链接。您可能想要 “{2}”",
|
|
61
62
|
failed_to_resolve_link_to_0_in_readme_for_1: "无法解析 {1} 的自述文件中指向 “{0}” 的链接",
|
|
@@ -71,8 +72,9 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
71
72
|
// conversion plugins
|
|
72
73
|
not_all_search_category_boosts_used_0: "文档中并未使用 searchCategoryBoosts 中指定的所有类别。未使用的类别包括:\n{0}",
|
|
73
74
|
not_all_search_group_boosts_used_0: "文档中并未使用 searchGroupBoosts 中指定的所有组。未使用的组为:\n{0}",
|
|
74
|
-
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0}
|
|
75
|
-
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0}
|
|
75
|
+
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @categoryDescription,但该类别中没有子项",
|
|
76
|
+
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @groupDescription,但该分组中没有子项",
|
|
77
|
+
comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid: `{0} 的注释中指定的 “{1}” 的 @sortStrategy 无效,以下是有效的选项:\n\t{2}`,
|
|
76
78
|
label_0_for_1_cannot_be_referenced: "无法使用声明引用来引用 {1} 的标签“{0}”。标签只能包含 A-Z、0-9 和 _,并且不能以数字开头",
|
|
77
79
|
modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "修饰符标签 {0} 与 {2} 注释中的 {1} 互斥",
|
|
78
80
|
signature_0_has_unused_param_with_name_1: "签名 {0} 有一个名为“{1}”的 @param,但未被使用",
|
|
@@ -130,6 +132,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
130
132
|
// options
|
|
131
133
|
circular_reference_extends_0: "{0} 的“extends”字段出现循环引用",
|
|
132
134
|
failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件",
|
|
135
|
+
glob_0_should_use_posix_slash: `该 glob “{0}” 中转义了不是特殊字符的字符。输入 TypeDoc 的 glob 可能不会使用 Windows 路径分隔符(\\),请尝试将其替换为 POSIX 路径分隔符(/)`,
|
|
133
136
|
option_0_can_only_be_specified_by_config_file: "“{0}”选项只能通过配置文件指定",
|
|
134
137
|
option_0_expected_a_value_but_none_provided: "--{0} 需要一个值,但没有给出任何参数",
|
|
135
138
|
unknown_option_0_may_have_meant_1: "未知选项:{0},你可能指的是:\n\t{1}",
|
|
@@ -274,6 +277,8 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
274
277
|
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: "useHostedBaseUrlForAbsoluteLinks 选项要求设置 hostingBaseUrl",
|
|
275
278
|
favicon_must_have_one_of_the_following_extensions_0: "favicon 的后缀名必须是下列之一:{0}",
|
|
276
279
|
option_0_must_be_an_object: "“{0}”选项必须是非数组对象",
|
|
280
|
+
option_0_must_be_an_array_of_string: "“{0}”选项必须是字符串数组",
|
|
281
|
+
option_0_must_be_an_array_of_string_or_functions: "“{0}”选项必须是由字符串或函数构成的数组",
|
|
277
282
|
option_0_must_be_a_function: "‘{0}’ 选项必须是一个函数",
|
|
278
283
|
option_0_must_be_object_with_urls: "{0} 必须是具有字符串标签作为键和 URL 值的对象",
|
|
279
284
|
visibility_filters_only_include_0: "visibilityFilters 只能包含以下非@键:{0}",
|
|
@@ -431,6 +436,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
431
436
|
tag_return: "返回",
|
|
432
437
|
tag_satisfies: "满足",
|
|
433
438
|
tag_since: "添加于",
|
|
439
|
+
tag_sortStrategy: "排序策略",
|
|
434
440
|
tag_template: "类型参数",
|
|
435
441
|
tag_type: "类型",
|
|
436
442
|
tag_typedef: "类型定义",
|
|
@@ -460,6 +466,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
460
466
|
tag_virtual: "虚函数",
|
|
461
467
|
tag_abstract: "抽象类",
|
|
462
468
|
tag_class: "类",
|
|
469
|
+
tag_disableGroups: "禁用分组",
|
|
463
470
|
tag_enum: "枚举",
|
|
464
471
|
tag_event: "事件",
|
|
465
472
|
tag_expand: "展开",
|
|
@@ -49,6 +49,7 @@ declare const _default: {
|
|
|
49
49
|
unknown_inline_tag_0: "遇到未知的内联标签 {0}";
|
|
50
50
|
open_brace_within_inline_tag: string;
|
|
51
51
|
inline_tag_not_closed: string;
|
|
52
|
+
comment_for_0_links_to_1_not_included_in_docs_use_external_link_2: "{0} 注释中指向 “{1}” 的已解析的链接不会被包含在文档中。请将 {2} 导出或添加至 externalSymbolLinkMappings 选项以修复该警告";
|
|
52
53
|
failed_to_resolve_link_to_0_in_comment_for_1: "无法解析 {1} 注释中指向 “{0}” 的链接";
|
|
53
54
|
failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "无法解析 {1} 的注释中指向 “{0}” 的链接。您可能想要 “{2}”";
|
|
54
55
|
failed_to_resolve_link_to_0_in_readme_for_1: "无法解析 {1} 的自述文件中指向 “{0}” 的链接";
|
|
@@ -63,8 +64,9 @@ declare const _default: {
|
|
|
63
64
|
reflection_0_links_to_1_with_text_2_but_resolved_to_3: "“{0}”中的链接“{2}”指向“{1}”,目标虽然存在但并没有直接的链接,因此将改为链接至“{3}”。";
|
|
64
65
|
not_all_search_category_boosts_used_0: "文档中并未使用 searchCategoryBoosts 中指定的所有类别。未使用的类别包括:\n{0}";
|
|
65
66
|
not_all_search_group_boosts_used_0: "文档中并未使用 searchGroupBoosts 中指定的所有组。未使用的组为:\n{0}";
|
|
66
|
-
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0}
|
|
67
|
-
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0}
|
|
67
|
+
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @categoryDescription,但该类别中没有子项";
|
|
68
|
+
comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "{0} 的注释中包含了 “{1}” 的 @groupDescription,但该分组中没有子项";
|
|
69
|
+
comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid: "{0} 的注释中指定的 “{1}” 的 @sortStrategy 无效,以下是有效的选项:\n\t{2}";
|
|
68
70
|
label_0_for_1_cannot_be_referenced: "无法使用声明引用来引用 {1} 的标签“{0}”。标签只能包含 A-Z、0-9 和 _,并且不能以数字开头";
|
|
69
71
|
modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "修饰符标签 {0} 与 {2} 注释中的 {1} 互斥";
|
|
70
72
|
signature_0_has_unused_param_with_name_1: "签名 {0} 有一个名为“{1}”的 @param,但未被使用";
|
|
@@ -117,6 +119,7 @@ declare const _default: {
|
|
|
117
119
|
saved_relative_path_0_resolved_from_1_does_not_exist: "序列化项目引用的 {0} 不存在或无法在 {1} 下找到";
|
|
118
120
|
circular_reference_extends_0: "{0} 的“extends”字段出现循环引用";
|
|
119
121
|
failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件";
|
|
122
|
+
glob_0_should_use_posix_slash: "该 glob “{0}” 中转义了不是特殊字符的字符。输入 TypeDoc 的 glob 可能不会使用 Windows 路径分隔符(\\),请尝试将其替换为 POSIX 路径分隔符(/)";
|
|
120
123
|
option_0_can_only_be_specified_by_config_file: "“{0}”选项只能通过配置文件指定";
|
|
121
124
|
option_0_expected_a_value_but_none_provided: "--{0} 需要一个值,但没有给出任何参数";
|
|
122
125
|
unknown_option_0_may_have_meant_1: "未知选项:{0},你可能指的是:\n\t{1}";
|
|
@@ -256,6 +259,8 @@ declare const _default: {
|
|
|
256
259
|
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: string;
|
|
257
260
|
favicon_must_have_one_of_the_following_extensions_0: "favicon 的后缀名必须是下列之一:{0}";
|
|
258
261
|
option_0_must_be_an_object: "“{0}”选项必须是非数组对象";
|
|
262
|
+
option_0_must_be_an_array_of_string: "“{0}”选项必须是字符串数组";
|
|
263
|
+
option_0_must_be_an_array_of_string_or_functions: "“{0}”选项必须是由字符串或函数构成的数组";
|
|
259
264
|
option_0_must_be_a_function: "‘{0}’ 选项必须是一个函数";
|
|
260
265
|
option_0_must_be_object_with_urls: "{0} 必须是具有字符串标签作为键和 URL 值的对象";
|
|
261
266
|
visibility_filters_only_include_0: "visibilityFilters 只能包含以下非@键:{0}";
|
|
@@ -396,6 +401,7 @@ declare const _default: {
|
|
|
396
401
|
tag_return: string;
|
|
397
402
|
tag_satisfies: string;
|
|
398
403
|
tag_since: string;
|
|
404
|
+
tag_sortStrategy: string;
|
|
399
405
|
tag_template: string;
|
|
400
406
|
tag_type: string;
|
|
401
407
|
tag_typedef: string;
|
|
@@ -423,6 +429,7 @@ declare const _default: {
|
|
|
423
429
|
tag_virtual: string;
|
|
424
430
|
tag_abstract: string;
|
|
425
431
|
tag_class: string;
|
|
432
|
+
tag_disableGroups: string;
|
|
426
433
|
tag_enum: string;
|
|
427
434
|
tag_event: string;
|
|
428
435
|
tag_expand: string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { readFile } from "./fs.js";
|
|
3
|
+
import { Validation } from "#utils";
|
|
4
|
+
import { join, relative, resolve } from "path";
|
|
5
|
+
import { getCommonDirectory, normalizePath } from "./paths.js";
|
|
6
|
+
const declarationMapCache = new Map();
|
|
7
|
+
export function resolveDeclarationMaps(file) {
|
|
8
|
+
if (!/\.d\.[cm]?ts$/.test(file))
|
|
9
|
+
return file;
|
|
10
|
+
if (declarationMapCache.has(file))
|
|
11
|
+
return declarationMapCache.get(file);
|
|
12
|
+
const mapFile = file + ".map";
|
|
13
|
+
if (!existsSync(mapFile))
|
|
14
|
+
return file;
|
|
15
|
+
let sourceMap;
|
|
16
|
+
try {
|
|
17
|
+
sourceMap = JSON.parse(readFile(mapFile));
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return file;
|
|
21
|
+
}
|
|
22
|
+
if (Validation.validate({
|
|
23
|
+
file: String,
|
|
24
|
+
sourceRoot: Validation.optional(String),
|
|
25
|
+
sources: [Array, String],
|
|
26
|
+
}, sourceMap)) {
|
|
27
|
+
// There's a pretty large assumption in here that we only have
|
|
28
|
+
// 1 source file per js file. This is a pretty standard typescript approach,
|
|
29
|
+
// but people might do interesting things with transpilation that could break this.
|
|
30
|
+
let source = sourceMap.sources[0];
|
|
31
|
+
// If we have a sourceRoot, trim any leading slash from the source, and join them
|
|
32
|
+
// Similar to how it's done at https://github.com/mozilla/source-map/blob/58819f09018d56ef84dc41ba9c93f554e0645169/lib/util.js#L412
|
|
33
|
+
if (sourceMap.sourceRoot !== undefined) {
|
|
34
|
+
source = source.replace(/^\//, "");
|
|
35
|
+
source = join(sourceMap.sourceRoot, source);
|
|
36
|
+
}
|
|
37
|
+
const result = resolve(mapFile, "..", source);
|
|
38
|
+
declarationMapCache.set(file, result);
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
return file;
|
|
42
|
+
}
|
|
43
|
+
// See also: inferEntryPoints in entry-point.ts
|
|
44
|
+
export function addInferredDeclarationMapPaths(opts, files) {
|
|
45
|
+
const rootDir = opts.rootDir || getCommonDirectory(files);
|
|
46
|
+
const declDir = opts.declarationDir || opts.outDir || rootDir;
|
|
47
|
+
for (const file of files) {
|
|
48
|
+
const mapFile = normalizePath(resolve(declDir, relative(rootDir, file)).replace(/\.([cm]?[tj]s)x?$/, ".d.$1"));
|
|
49
|
+
declarationMapCache.set(mapFile, file);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -5,6 +5,7 @@ import { expandPackages } from "./package-manifest.js";
|
|
|
5
5
|
import { deriveRootDir, getCommonDirectory, MinimatchSet, nicePath, normalizePath } from "./paths.js";
|
|
6
6
|
import { discoverPackageJson, glob, inferPackageEntryPointPaths, isDir } from "./fs.js";
|
|
7
7
|
import { assertNever, i18n } from "#utils";
|
|
8
|
+
import { addInferredDeclarationMapPaths, resolveDeclarationMaps } from "./declaration-maps.js";
|
|
8
9
|
/**
|
|
9
10
|
* Defines how entry points are interpreted.
|
|
10
11
|
* @enum
|
|
@@ -39,7 +40,7 @@ export function inferEntryPoints(logger, options, programs) {
|
|
|
39
40
|
const pathEntries = inferPackageEntryPointPaths(packageJson.file);
|
|
40
41
|
const entryPoints = [];
|
|
41
42
|
programs ||= getEntryPrograms(pathEntries.map((p) => p[1]), logger, options);
|
|
42
|
-
// See also: addInferredDeclarationMapPaths in
|
|
43
|
+
// See also: addInferredDeclarationMapPaths in symbol-id factory
|
|
43
44
|
const jsToTsSource = new Map();
|
|
44
45
|
for (const program of programs) {
|
|
45
46
|
const opts = program.getCompilerOptions();
|
|
@@ -53,7 +54,7 @@ export function inferEntryPoints(logger, options, programs) {
|
|
|
53
54
|
for (const [name, path] of pathEntries) {
|
|
54
55
|
// Strip leading ./ from the display name
|
|
55
56
|
const displayName = name.replace(/^\.\/?/, "");
|
|
56
|
-
const targetPath = jsToTsSource.get(path) || path;
|
|
57
|
+
const targetPath = jsToTsSource.get(path) || resolveDeclarationMaps(path) || path;
|
|
57
58
|
const program = programs.find((p) => p.getSourceFile(targetPath));
|
|
58
59
|
if (program) {
|
|
59
60
|
entryPoints.push({
|
|
@@ -70,6 +71,7 @@ export function inferEntryPoints(logger, options, programs) {
|
|
|
70
71
|
logger.warn(i18n.no_entry_points_provided());
|
|
71
72
|
return [];
|
|
72
73
|
}
|
|
74
|
+
logger.verbose(`Inferred entry points to be:\n\t${entryPoints.map(e => nicePath(e.sourceFile.fileName)).join("\n\t")}`);
|
|
73
75
|
return entryPoints;
|
|
74
76
|
}
|
|
75
77
|
export function getEntryPoints(logger, options) {
|
|
@@ -257,6 +259,7 @@ function getEntryPrograms(inputFiles, logger, options) {
|
|
|
257
259
|
options: options.getCompilerOptions(),
|
|
258
260
|
projectReferences: options.getProjectReferences(),
|
|
259
261
|
});
|
|
262
|
+
addInferredDeclarationMapPaths(options.getCompilerOptions(), options.getFileNames());
|
|
260
263
|
const programs = [rootProgram];
|
|
261
264
|
// This might be a solution style tsconfig, in which case we need to add a program for each
|
|
262
265
|
// reference so that the converter can look through each of these.
|
|
@@ -271,6 +274,7 @@ function getEntryPrograms(inputFiles, logger, options) {
|
|
|
271
274
|
rootNames: ref.commandLine.fileNames,
|
|
272
275
|
projectReferences: ref.commandLine.projectReferences,
|
|
273
276
|
}));
|
|
277
|
+
addInferredDeclarationMapPaths(ref.commandLine.options, ref.commandLine.fileNames);
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
280
|
return programs;
|
|
@@ -9,6 +9,7 @@ export { loadPlugins } from "./plugins.js";
|
|
|
9
9
|
export { getSortFunction } from "./sort.js";
|
|
10
10
|
export type { SortStrategy } from "./sort.js";
|
|
11
11
|
export * from "./entry-point.js";
|
|
12
|
+
export * from "./declaration-maps.js";
|
|
12
13
|
export * from "./highlighter.js";
|
|
13
14
|
export * from "./html.js";
|
|
14
15
|
export * from "./tsconfig.js";
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./paths.js";
|
|
|
7
7
|
export { loadPlugins } from "./plugins.js";
|
|
8
8
|
export { getSortFunction } from "./sort.js";
|
|
9
9
|
export * from "./entry-point.js";
|
|
10
|
+
export * from "./declaration-maps.js";
|
|
10
11
|
export * from "./highlighter.js";
|
|
11
12
|
export * from "./html.js";
|
|
12
13
|
export * from "./tsconfig.js";
|
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.28.
|
|
4
|
+
"version": "0.28.9",
|
|
5
5
|
"homepage": "https://typedoc.org",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -31,32 +31,32 @@
|
|
|
31
31
|
"pnpm": ">= 10"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@gerrit0/mini-shiki": "^3.
|
|
34
|
+
"@gerrit0/mini-shiki": "^3.9.0",
|
|
35
35
|
"lunr": "^2.3.9",
|
|
36
36
|
"markdown-it": "^14.1.0",
|
|
37
37
|
"minimatch": "^9.0.5",
|
|
38
38
|
"yaml": "^2.8.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x"
|
|
41
|
+
"typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x || 5.9.x"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@eslint/js": "^9.
|
|
44
|
+
"@eslint/js": "^9.32.0",
|
|
45
45
|
"@types/lunr": "^2.3.7",
|
|
46
46
|
"@types/markdown-it": "^14.1.2",
|
|
47
47
|
"@types/mocha": "^10.0.10",
|
|
48
48
|
"@types/node": "18",
|
|
49
49
|
"@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#34113409e3a171e68ce5e2b55461ef5c35591cfe",
|
|
50
50
|
"c8": "^10.1.3",
|
|
51
|
-
"dprint": "^0.50.
|
|
52
|
-
"esbuild": "^0.25.
|
|
53
|
-
"eslint": "^9.
|
|
51
|
+
"dprint": "^0.50.1",
|
|
52
|
+
"esbuild": "^0.25.8",
|
|
53
|
+
"eslint": "^9.32.0",
|
|
54
54
|
"mocha": "^11.7.1",
|
|
55
55
|
"puppeteer": "^24.11.1",
|
|
56
56
|
"semver": "^7.7.2",
|
|
57
57
|
"tsx": "^4.20.3",
|
|
58
|
-
"typescript": "5.
|
|
59
|
-
"typescript-eslint": "^8.
|
|
58
|
+
"typescript": "5.9.2",
|
|
59
|
+
"typescript-eslint": "^8.38.0"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"/bin",
|