Skip to content

Commit 9f0fb04

Browse files
committed
Do not copy relative paths to directories
Resolves #2617
1 parent 918d8aa commit 9f0fb04

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- `mailto:` links are no longer incorrectly recognized as relative paths, #2613.
66
- Added `@since` to the default list of recognized tags, #2614.
7+
- Relative paths to directories will no longer cause the directory to be copied into the media directory, #2617.
78

89
## v0.26.2 (2024-06-24)
910

Diff for: src/lib/converter/comments/textParser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function textContent(
101101
data.pos = ref.end;
102102
if (!ref.target) {
103103
warning(
104-
i18n.relative_path_0_does_not_exist(
104+
i18n.relative_path_0_is_not_a_file_and_will_not_be_copied_to_output(
105105
token.text.slice(ref.pos, ref.end),
106106
),
107107
{

Diff for: src/lib/internationalization/locales/jp.cts

+2-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export = buildIncompleteTranslation({
5959
"TypeDoc は、コメント付きの単一の @template タグで定義された複数の型パラメータをサポートしていません。",
6060
failed_to_find_jsdoc_tag_for_name_0:
6161
"コメントを解析した後、{0} の JSDoc タグが見つかりませんでした。バグレポートを提出してください。",
62-
relative_path_0_does_not_exist: "相対パス {0} は存在しません",
62+
// relative_path_0_is_not_a_file_and_will_not_be_copied_to_output
6363
inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0:
6464
"インライン @inheritDoc タグはブロック タグ内に出現しないでください。{0} のコメントでは処理されません。",
6565
at_most_one_remarks_tag_expected_in_comment_at_0:
@@ -169,8 +169,7 @@ export = buildIncompleteTranslation({
169169
file_0_not_an_object: "ファイル {0} はオブジェクトではありません",
170170
serialized_project_referenced_0_not_part_of_project:
171171
"シリアル化されたプロジェクトは、プロジェクトの一部ではないリフレクション {0} を参照しました",
172-
saved_relative_path_0_resolved_from_1_does_not_exist:
173-
"シリアル化されたプロジェクトは {0} を参照していますが、{1} に関連して存在しません",
172+
// saved_relative_path_0_resolved_from_1_is_not_a_file
174173
circular_reference_extends_0:
175174
'{0} の "extends" フィールドで循環参照が検出されました',
176175
failed_resolve_0_to_file_in_1:

Diff for: src/lib/internationalization/locales/zh.cts

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export = buildIncompleteTranslation({
5252
"TypeDoc 不支持在带有注释的单个 @template 标记中定义多个类型参数",
5353
failed_to_find_jsdoc_tag_for_name_0:
5454
"解析注释后无法找到 {0} 的 JSDoc 标签,请提交错误报告",
55-
relative_path_0_does_not_exist: "相对路径 {0} 不存在",
55+
// relative_path_0_is_not_a_file_and_will_not_be_copied_to_output
5656
inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0:
5757
"内联 @inheritDoc 标记不应出现在块标记内,因为它不会在 {0} 处的注释中被处理。",
5858
at_most_one_remarks_tag_expected_in_comment_at_0:
@@ -145,8 +145,7 @@ export = buildIncompleteTranslation({
145145
file_0_not_an_object: "文件 {0} 不是对象",
146146
serialized_project_referenced_0_not_part_of_project:
147147
"序列化项目引用了反射 {0},但它不是项目的一部分",
148-
saved_relative_path_0_resolved_from_1_does_not_exist:
149-
"序列化项目引用了 {0},相对于 {1} 而言,它并不存在",
148+
// saved_relative_path_0_resolved_from_1_is_not_a_file
150149
circular_reference_extends_0: "{0} 的“extends”字段出现循环引用",
151150
failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件",
152151
option_0_can_only_be_specified_by_config_file:

Diff for: src/lib/internationalization/translatable.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import type {
44
modifierTags,
55
} from "../utils/options/tsdoc-defaults";
66

7-
export function buildTranslation<
8-
T extends BuiltinTranslatableStringConstraints,
9-
>(translations: T) {
7+
export function buildTranslation(
8+
translations: BuiltinTranslatableStringConstraints,
9+
) {
1010
return translations;
1111
}
1212

13-
export function buildIncompleteTranslation<
14-
T extends Partial<BuiltinTranslatableStringConstraints>,
15-
>(translations: T) {
13+
export function buildIncompleteTranslation(
14+
translations: Partial<BuiltinTranslatableStringConstraints>,
15+
) {
1616
return translations;
1717
}
1818

@@ -72,7 +72,7 @@ export const translatable = {
7272
// comments/parser.ts
7373
multiple_type_parameters_on_template_tag_unsupported: `TypeDoc does not support multiple type parameters defined in a single @template tag with a comment`,
7474
failed_to_find_jsdoc_tag_for_name_0: `Failed to find JSDoc tag for {0} after parsing comment, please file a bug report`,
75-
relative_path_0_does_not_exist: `The relative path {0} does not exist`,
75+
relative_path_0_is_not_a_file_and_will_not_be_copied_to_output: `The relative path {0} is not a file and will not be copied to the output directory`,
7676

7777
inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0:
7878
"An inline @inheritDoc tag should not appear within a block tag as it will not be processed in comment at {0}",
@@ -159,7 +159,7 @@ export const translatable = {
159159

160160
// deserialization
161161
serialized_project_referenced_0_not_part_of_project: `Serialized project referenced reflection {0}, which was not a part of the project`,
162-
saved_relative_path_0_resolved_from_1_does_not_exist: `Serialized project referenced {0}, which does not exist relative to {1}`,
162+
saved_relative_path_0_resolved_from_1_is_not_a_file: `Serialized project referenced {0}, which does not exist or is not a file relative to {1}`,
163163

164164
// options
165165
circular_reference_extends_0: `Circular reference encountered for "extends" field of {0}`,

Diff for: src/lib/models/FileRegistry.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { basename, dirname, parse, relative, resolve } from "path";
22
import type { Deserializer, Serializer } from "../serialization";
33
import type { FileRegistry as JSONFileRegistry } from "../serialization/schema";
4-
import { normalizePath } from "../utils";
5-
import { existsSync } from "fs";
4+
import { isFile, normalizePath } from "../utils";
65
import type { Reflection } from "./reflections";
76

87
export class FileRegistry {
@@ -137,7 +136,7 @@ export class ValidatingFileRegistry extends FileRegistry {
137136
relativePath: string,
138137
): number | undefined {
139138
const absolute = resolve(dirname(sourcePath), relativePath);
140-
if (!existsSync(absolute)) {
139+
if (!isFile(absolute)) {
141140
return;
142141
}
143142
return this.registerAbsolute(absolute);
@@ -146,9 +145,9 @@ export class ValidatingFileRegistry extends FileRegistry {
146145
override fromObject(de: Deserializer, obj: JSONFileRegistry) {
147146
for (const [key, val] of Object.entries(obj.entries)) {
148147
const absolute = normalizePath(resolve(de.projectRoot, val));
149-
if (!existsSync(absolute)) {
148+
if (!isFile(absolute)) {
150149
de.logger.warn(
151-
de.logger.i18n.saved_relative_path_0_resolved_from_1_does_not_exist(
150+
de.logger.i18n.saved_relative_path_0_resolved_from_1_is_not_a_file(
152151
val,
153152
de.projectRoot,
154153
),

0 commit comments

Comments
 (0)