typedoc 0.28.5 → 0.28.7

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.
Files changed (61) hide show
  1. package/dist/lib/converter/comments/discovery.js +7 -1
  2. package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
  3. package/dist/lib/converter/comments/linkResolver.js +53 -10
  4. package/dist/lib/converter/comments/textParser.d.ts +1 -0
  5. package/dist/lib/converter/comments/textParser.js +76 -34
  6. package/dist/lib/converter/context.js +14 -3
  7. package/dist/lib/converter/converter.d.ts +3 -1
  8. package/dist/lib/converter/converter.js +9 -3
  9. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +3 -2
  10. package/dist/lib/converter/plugins/CategoryPlugin.js +15 -3
  11. package/dist/lib/converter/plugins/GroupPlugin.d.ts +2 -1
  12. package/dist/lib/converter/plugins/GroupPlugin.js +23 -9
  13. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -2
  14. package/dist/lib/converter/plugins/LinkResolverPlugin.js +1 -55
  15. package/dist/lib/converter/plugins/PackagePlugin.js +5 -1
  16. package/dist/lib/converter/symbols.js +37 -2
  17. package/dist/lib/converter/utils/repository.js +1 -1
  18. package/dist/lib/internationalization/internationalization.js +1 -1
  19. package/dist/lib/internationalization/locales/de.cjs +1 -1
  20. package/dist/lib/internationalization/locales/de.d.cts +1 -1
  21. package/dist/lib/internationalization/locales/en.cjs +5 -2
  22. package/dist/lib/internationalization/locales/en.d.cts +5 -2
  23. package/dist/lib/internationalization/locales/ja.cjs +1 -1
  24. package/dist/lib/internationalization/locales/zh.cjs +1 -1
  25. package/dist/lib/internationalization/locales/zh.d.cts +1 -1
  26. package/dist/lib/models/Comment.d.ts +2 -1
  27. package/dist/lib/models/Comment.js +1 -1
  28. package/dist/lib/models/ContainerReflection.d.ts +1 -0
  29. package/dist/lib/models/ContainerReflection.js +3 -0
  30. package/dist/lib/models/DocumentReflection.js +1 -1
  31. package/dist/lib/models/FileRegistry.d.ts +20 -8
  32. package/dist/lib/models/FileRegistry.js +19 -6
  33. package/dist/lib/models/ProjectReflection.js +1 -1
  34. package/dist/lib/models/Reflection.d.ts +6 -0
  35. package/dist/lib/models/Reflection.js +3 -0
  36. package/dist/lib/models/types.d.ts +2 -2
  37. package/dist/lib/models/types.js +16 -14
  38. package/dist/lib/output/plugins/AssetsPlugin.js +7 -2
  39. package/dist/lib/output/themes/MarkedPlugin.js +2 -2
  40. package/dist/lib/output/themes/default/partials/moduleReflection.js +1 -1
  41. package/dist/lib/output/themes/default/partials/navigation.js +1 -1
  42. package/dist/lib/output/themes/default/templates/hierarchy.js +1 -1
  43. package/dist/lib/serialization/deserializer.d.ts +3 -3
  44. package/dist/lib/serialization/schema.d.ts +10 -8
  45. package/dist/lib/utils/ValidatingFileRegistry.d.ts +2 -2
  46. package/dist/lib/utils/ValidatingFileRegistry.js +7 -4
  47. package/dist/lib/utils/options/declaration.js +14 -22
  48. package/dist/lib/utils/options/sources/typedoc.js +1 -4
  49. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  50. package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
  51. package/dist/lib/utils/sort.d.ts +2 -1
  52. package/dist/lib/utils/sort.js +4 -2
  53. package/dist/lib/utils-common/array.d.ts +1 -2
  54. package/dist/lib/utils-common/array.js +0 -7
  55. package/dist/lib/utils-common/jsx.elements.d.ts +1 -1
  56. package/dist/lib/utils-common/jsx.js +7 -6
  57. package/dist/lib/utils-common/map.d.ts +1 -1
  58. package/dist/lib/validation/links.js +23 -28
  59. package/package.json +12 -12
  60. package/static/style.css +2 -9
  61. package/tsdoc.json +4 -0
@@ -35,7 +35,6 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { ConverterComponent } from "../components.js";
36
36
  import { ConverterEvents } from "../converter-events.js";
37
37
  import { Option } from "../../utils/index.js";
38
- import { ContainerReflection, makeRecursiveVisitor, } from "../../models/index.js";
39
38
  import { discoverAllReferenceTypes } from "../../utils/reflections.js";
40
39
  import { ApplicationEvents } from "../../application-events.js";
41
40
  /**
@@ -68,55 +67,7 @@ let LinkResolverPlugin = (() => {
68
67
  resolveLinks(project) {
69
68
  for (const id in project.reflections) {
70
69
  const reflection = project.reflections[id];
71
- if (reflection.comment) {
72
- this.owner.resolveLinks(reflection.comment, reflection);
73
- }
74
- if (reflection.isDeclaration()) {
75
- reflection.type?.visit(makeRecursiveVisitor({
76
- union: (type) => {
77
- type.elementSummaries = type.elementSummaries?.map((parts) => this.owner.resolveLinks(parts, reflection));
78
- },
79
- }));
80
- if (reflection.readme) {
81
- reflection.readme = this.owner.resolveLinks(reflection.readme, reflection);
82
- }
83
- }
84
- if (reflection.isDocument()) {
85
- reflection.content = this.owner.resolveLinks(reflection.content, reflection);
86
- }
87
- if (reflection.isParameter() &&
88
- reflection.type?.type === "reference" &&
89
- reflection.type.highlightedProperties) {
90
- const resolved = new Map(Array.from(reflection.type.highlightedProperties, ([name, parts]) => {
91
- return [
92
- name,
93
- this.owner.resolveLinks(parts, reflection),
94
- ];
95
- }));
96
- reflection.type.highlightedProperties = resolved;
97
- }
98
- if (reflection instanceof ContainerReflection) {
99
- if (reflection.groups) {
100
- for (const group of reflection.groups) {
101
- if (group.description) {
102
- group.description = this.owner.resolveLinks(group.description, reflection);
103
- }
104
- if (group.categories) {
105
- for (const cat of group.categories) {
106
- this.resolveCategoryLinks(cat, reflection);
107
- }
108
- }
109
- }
110
- }
111
- if (reflection.categories) {
112
- for (const cat of reflection.categories) {
113
- this.resolveCategoryLinks(cat, reflection);
114
- }
115
- }
116
- }
117
- }
118
- if (project.readme) {
119
- project.readme = this.owner.resolveLinks(project.readme, project);
70
+ this.owner.resolveLinks(reflection);
120
71
  }
121
72
  for (const { type, owner } of discoverAllReferenceTypes(project, false)) {
122
73
  if (!type.reflection) {
@@ -132,11 +83,6 @@ let LinkResolverPlugin = (() => {
132
83
  }
133
84
  }
134
85
  }
135
- resolveCategoryLinks(category, owner) {
136
- if (category.description) {
137
- category.description = this.owner.resolveLinks(category.description, owner);
138
- }
139
- }
140
86
  };
141
87
  })();
142
88
  export { LinkResolverPlugin };
@@ -36,7 +36,7 @@ import * as Path from "path";
36
36
  import { ConverterComponent } from "../components.js";
37
37
  import { ApplicationEvents } from "../../application-events.js";
38
38
  import { ConverterEvents } from "../converter-events.js";
39
- import { i18n, MinimalSourceFile } from "#utils";
39
+ import { i18n, MinimalSourceFile, NormalizedPathUtils } from "#utils";
40
40
  import { discoverPackageJson, getCommonDirectory, nicePath, normalizePath, Option, readFile, } from "#node-utils";
41
41
  import { existsSync } from "fs";
42
42
  /**
@@ -161,6 +161,10 @@ let PackagePlugin = (() => {
161
161
  if (this.readmeFile && this.readmeContents) {
162
162
  const { content } = this.application.converter.parseRawComment(new MinimalSourceFile(this.readmeContents, this.readmeFile), project.files);
163
163
  project.readme = content;
164
+ project.files.registerReflectionPath(this.readmeFile, project);
165
+ // In packages mode, this probably won't do anything unless someone uses the readme
166
+ // option to select a different file.
167
+ project.files.registerReflectionPath(NormalizedPathUtils.dirname(this.readmeFile), project);
164
168
  // This isn't ideal, but seems better than figuring out the readme
165
169
  // path over in the include plugin...
166
170
  this.owner.includePlugin.checkIncludeTagsParts(project, Path.dirname(this.readmeFile), content);
@@ -238,6 +238,25 @@ function convertTypeAlias(context, symbol, exportSymbol) {
238
238
  convertJsDocCallback(context, symbol, declaration, exportSymbol);
239
239
  }
240
240
  }
241
+ function convertTypeAliasFromValueDeclaration(context, symbol, exportSymbol, valueKind) {
242
+ const comment = context.getComment(symbol, valueKind);
243
+ const reflection = new DeclarationReflection(exportSymbol?.name || symbol.name, ReflectionKind.TypeAlias, context.scope);
244
+ reflection.comment = comment;
245
+ context.postReflectionCreation(reflection, symbol, exportSymbol);
246
+ context.finalizeDeclarationReflection(reflection);
247
+ reflection.type = context.converter.convertType(context.withScope(reflection), context.checker.getTypeOfSymbol(symbol));
248
+ if (reflection.type.type === "reflection" && reflection.type.declaration.children) {
249
+ // #2817 lift properties of object literal types up to the reflection level.
250
+ const typeDecl = reflection.type.declaration;
251
+ reflection.project.mergeReflections(typeDecl, reflection);
252
+ delete reflection.type;
253
+ // When created any signatures will be created with __type as their
254
+ // name, rename them so that they have the alias's name as their name
255
+ for (const sig of reflection.signatures || []) {
256
+ sig.name = reflection.name;
257
+ }
258
+ }
259
+ }
241
260
  function attachUnionComments(context, declaration, union) {
242
261
  const list = declaration.type.getChildAt(0);
243
262
  if (list.kind !== ts.SyntaxKind.SyntaxList)
@@ -285,6 +304,9 @@ function convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration)
285
304
  convertIndexSignatures(rc, type);
286
305
  }
287
306
  function convertFunctionOrMethod(context, symbol, exportSymbol) {
307
+ if (isTypeOnlyExport(exportSymbol)) {
308
+ return convertTypeAliasFromValueDeclaration(context, symbol, exportSymbol, ReflectionKind.Function);
309
+ }
288
310
  // Can't just check method flag because this might be called for properties as well
289
311
  // This will *NOT* be called for variables that look like functions, they need a special case.
290
312
  const isMethod = !!(symbol.flags &
@@ -330,7 +352,7 @@ function convertFunctionOrMethod(context, symbol, exportSymbol) {
330
352
  // getDeclaredTypeOfSymbol gets the INSTANCE type
331
353
  // getTypeOfSymbolAtLocation gets the STATIC type
332
354
  function convertClassOrInterface(context, symbol, exportSymbol) {
333
- const reflection = context.createDeclarationReflection(ts.SymbolFlags.Class & symbol.flags
355
+ const reflection = context.createDeclarationReflection((ts.SymbolFlags.Class & symbol.flags) && !isTypeOnlyExport(exportSymbol)
334
356
  ? ReflectionKind.Class
335
357
  : ReflectionKind.Interface, symbol, exportSymbol, void 0);
336
358
  const classDeclaration = symbol
@@ -355,7 +377,7 @@ function convertClassOrInterface(context, symbol, exportSymbol) {
355
377
  reflection.implementedTypes = implementedTypes;
356
378
  }
357
379
  context.finalizeDeclarationReflection(reflection);
358
- if (classDeclaration) {
380
+ if (classDeclaration && reflection.kind === ReflectionKind.Class) {
359
381
  // Classes can have static props
360
382
  const staticType = context.checker.getTypeOfSymbolAtLocation(symbol, classDeclaration);
361
383
  reflectionContext.shouldBeStatic = true;
@@ -548,6 +570,9 @@ function createAlias(target, context, symbol, exportSymbol) {
548
570
  context.finalizeDeclarationReflection(ref);
549
571
  }
550
572
  function convertVariable(context, symbol, exportSymbol) {
573
+ if (isTypeOnlyExport(exportSymbol)) {
574
+ return convertTypeAliasFromValueDeclaration(context, symbol, exportSymbol, ReflectionKind.Variable);
575
+ }
551
576
  const declaration = symbol.getDeclarations()?.[0];
552
577
  const comment = context.getComment(symbol, ReflectionKind.Variable);
553
578
  const type = declaration
@@ -826,3 +851,13 @@ function isFunctionLikeInitializer(node) {
826
851
  }
827
852
  return false;
828
853
  }
854
+ function isTypeOnlyExport(symbol) {
855
+ if (!symbol)
856
+ return false;
857
+ const declaration = symbol.declarations?.[0];
858
+ if (!declaration)
859
+ return false;
860
+ if (!ts.isExportSpecifier(declaration))
861
+ return false;
862
+ return declaration.isTypeOnly || declaration.parent.parent.isTypeOnly;
863
+ }
@@ -140,7 +140,7 @@ let GitRepository = (() => {
140
140
  */
141
141
  static tryCreateRepository(path, sourceLinkTemplate, gitRevision, gitRemote, logger) {
142
142
  gitRevision ||= git("-C", path, "rev-parse", "HEAD").stdout.trim();
143
- if (!gitRevision)
143
+ if (gitRevision == "HEAD")
144
144
  return; // Will only happen in a repo with no commits.
145
145
  let urlTemplate;
146
146
  if (sourceLinkTemplate) {
@@ -16,7 +16,7 @@ export function loadTranslations(lang) {
16
16
  return req(`./locales/${lang}.cjs`);
17
17
  }
18
18
  catch {
19
- return {};
19
+ return loadTranslations("en");
20
20
  }
21
21
  }
22
22
  /**
@@ -126,7 +126,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
126
126
  file_0_not_an_object: "Die Datei {0} ist kein Objekt",
127
127
  // deserialization
128
128
  serialized_project_referenced_0_not_part_of_project: "Serialisiertes Projekt referenziert Reflection {0}, welche kein Teil des Projekts ist",
129
- saved_relative_path_0_resolved_from_1_is_not_a_file: "Serialisiertes Projekt referenziert {0}, was relativ zu {1} nicht existiert",
129
+ saved_relative_path_0_resolved_from_1_does_not_exist: "Serialisiertes Projekt referenziert {0}, was relativ zu {1} nicht existiert",
130
130
  // options
131
131
  circular_reference_extends_0: `Zyklische Referenz im "extends"-Feld von {0} gefunden`,
132
132
  failed_resolve_0_to_file_in_1: "Konnte {0} in {1} nicht zu einer Datei auflösen",
@@ -114,7 +114,7 @@ declare const _default: {
114
114
  entry_point_0_did_not_match_any_packages: "Der Einstiegspunkt-Glob {0} passte auf keine Verzeichnisse mit einer package.json-Datei";
115
115
  file_0_not_an_object: "Die Datei {0} ist kein Objekt";
116
116
  serialized_project_referenced_0_not_part_of_project: "Serialisiertes Projekt referenziert Reflection {0}, welche kein Teil des Projekts ist";
117
- saved_relative_path_0_resolved_from_1_is_not_a_file: "Serialisiertes Projekt referenziert {0}, was relativ zu {1} nicht existiert";
117
+ saved_relative_path_0_resolved_from_1_does_not_exist: "Serialisiertes Projekt referenziert {0}, was relativ zu {1} nicht existiert";
118
118
  circular_reference_extends_0: "Zyklische Referenz im \"extends\"-Feld von {0} gefunden";
119
119
  failed_resolve_0_to_file_in_1: "Konnte {0} in {1} nicht zu einer Datei auflösen";
120
120
  glob_0_should_use_posix_slash: "Der Glob \"{0}\" maskiert nichtspezielle Zeichen. Glob-Eingaben für TypeDoc dürfen keine Windows-Pfadtrennzeichen (\\) verwenden, nutzen Sie stattdessen Posix-Pfadtrennzeichen (/)";
@@ -54,6 +54,7 @@ module.exports = {
54
54
  open_brace_within_inline_tag: `Encountered an open brace within an inline tag, this is likely a mistake`,
55
55
  inline_tag_not_closed: `Inline tag is not closed`,
56
56
  // validation
57
+ comment_for_0_links_to_1_not_included_in_docs_use_external_link_2: `The comment for {0} links to "{1}" which was resolved but is not included in the documentation. To fix this warning export it or add {2} to the externalSymbolLinkMappings option`,
57
58
  failed_to_resolve_link_to_0_in_comment_for_1: `Failed to resolve link to "{0}" in comment for {1}`,
58
59
  failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: `Failed to resolve link to "{0}" in comment for {1}. You may have wanted "{2}"`,
59
60
  failed_to_resolve_link_to_0_in_readme_for_1: `Failed to resolve link to "{0}" in readme for {1}`,
@@ -71,6 +72,7 @@ module.exports = {
71
72
  not_all_search_group_boosts_used_0: `Not all groups specified in searchGroupBoosts were used in the documentation. The unused groups were:\n\t{0}`,
72
73
  comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: `Comment for {0} includes @categoryDescription for "{1}", but no child is placed in that category`,
73
74
  comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: `Comment for {0} includes @groupDescription for "{1}", but no child is placed in that group`,
75
+ comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid: `Comment for {0} specifies @sortStrategy with "{1}", which is an invalid sort strategy, the following are valid:\n\t{2}`,
74
76
  label_0_for_1_cannot_be_referenced: `The label "{0}" for {1} cannot be referenced with a declaration reference. Labels may only contain A-Z, 0-9, and _, and may not start with a number`,
75
77
  modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: `The modifier tag {0} is mutually exclusive with {1} in the comment for {2}`,
76
78
  signature_0_has_unused_param_with_name_1: `The signature {0} has an @param with name "{1}", which was not used`,
@@ -124,7 +126,7 @@ module.exports = {
124
126
  file_0_not_an_object: `The file {0} is not an object`,
125
127
  // deserialization
126
128
  serialized_project_referenced_0_not_part_of_project: `Serialized project referenced reflection {0}, which was not a part of the project`,
127
- saved_relative_path_0_resolved_from_1_is_not_a_file: `Serialized project referenced {0}, which does not exist relative to {1}`,
129
+ saved_relative_path_0_resolved_from_1_does_not_exist: `Serialized project referenced {0}, which does not exist relative to {1}`,
128
130
  // options
129
131
  circular_reference_extends_0: `Circular reference encountered for "extends" field of {0}`,
130
132
  failed_resolve_0_to_file_in_1: `Failed to resolve {0} to a file in {1}`,
@@ -273,13 +275,14 @@ module.exports = {
273
275
  useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: "The useHostedBaseUrlForAbsoluteLinks option requires that hostedBaseUrl be set",
274
276
  favicon_must_have_one_of_the_following_extensions_0: "Favicon must have one of the following extensions: {0}",
275
277
  option_0_must_be_an_object: "The '{0}' option must be a non-array object",
278
+ option_0_must_be_an_array_of_string: "The '{0}' option must be set to an array of strings",
276
279
  option_0_must_be_a_function: "The '{0}' option must be a function",
277
280
  option_0_must_be_object_with_urls: `{0} must be an object with string labels as keys and URL values`,
278
281
  visibility_filters_only_include_0: `visibilityFilters can only include the following non-@ keys: {0}`,
279
282
  visibility_filters_must_be_booleans: `All values of visibilityFilters must be booleans`,
280
283
  option_0_values_must_be_numbers: "All values of {0} must be numbers",
281
284
  option_0_values_must_be_array_of_tags: "{0} must be an array of valid tag names",
282
- option_0_specified_1_but_only_2_is_valid: `{0} may only specify known values, and invalid values were provided ({1}). The valid sort strategies are:\n{2}`,
285
+ option_0_specified_1_but_only_2_is_valid: `{0} may only specify known values, and invalid values were provided ({1}). The valid options are:\n{2}`,
283
286
  option_outputs_must_be_array: `"outputs" option must be an array of { name: string, path: string, options?: TypeDocOptions } values.`,
284
287
  specified_output_0_has_not_been_defined: `Specified output "{0}" has not been defined.`,
285
288
  // https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
@@ -49,6 +49,7 @@ declare const _default: {
49
49
  readonly unknown_inline_tag_0: "Encountered an unknown inline tag {0}";
50
50
  readonly open_brace_within_inline_tag: "Encountered an open brace within an inline tag, this is likely a mistake";
51
51
  readonly inline_tag_not_closed: "Inline tag is not closed";
52
+ readonly comment_for_0_links_to_1_not_included_in_docs_use_external_link_2: "The comment for {0} links to \"{1}\" which was resolved but is not included in the documentation. To fix this warning export it or add {2} to the externalSymbolLinkMappings option";
52
53
  readonly failed_to_resolve_link_to_0_in_comment_for_1: "Failed to resolve link to \"{0}\" in comment for {1}";
53
54
  readonly failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "Failed to resolve link to \"{0}\" in comment for {1}. You may have wanted \"{2}\"";
54
55
  readonly failed_to_resolve_link_to_0_in_readme_for_1: "Failed to resolve link to \"{0}\" in readme for {1}";
@@ -65,6 +66,7 @@ declare const _default: {
65
66
  readonly not_all_search_group_boosts_used_0: "Not all groups specified in searchGroupBoosts were used in the documentation. The unused groups were:\n\t{0}";
66
67
  readonly comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "Comment for {0} includes @categoryDescription for \"{1}\", but no child is placed in that category";
67
68
  readonly comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "Comment for {0} includes @groupDescription for \"{1}\", but no child is placed in that group";
69
+ readonly comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid: "Comment for {0} specifies @sortStrategy with \"{1}\", which is an invalid sort strategy, the following are valid:\n\t{2}";
68
70
  readonly label_0_for_1_cannot_be_referenced: "The label \"{0}\" for {1} cannot be referenced with a declaration reference. Labels may only contain A-Z, 0-9, and _, and may not start with a number";
69
71
  readonly modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "The modifier tag {0} is mutually exclusive with {1} in the comment for {2}";
70
72
  readonly signature_0_has_unused_param_with_name_1: "The signature {0} has an @param with name \"{1}\", which was not used";
@@ -114,7 +116,7 @@ declare const _default: {
114
116
  readonly entry_point_0_did_not_match_any_packages: "The entry point glob {0} did not match any directories containing package.json";
115
117
  readonly file_0_not_an_object: "The file {0} is not an object";
116
118
  readonly serialized_project_referenced_0_not_part_of_project: "Serialized project referenced reflection {0}, which was not a part of the project";
117
- readonly saved_relative_path_0_resolved_from_1_is_not_a_file: "Serialized project referenced {0}, which does not exist relative to {1}";
119
+ readonly saved_relative_path_0_resolved_from_1_does_not_exist: "Serialized project referenced {0}, which does not exist relative to {1}";
118
120
  readonly circular_reference_extends_0: "Circular reference encountered for \"extends\" field of {0}";
119
121
  readonly failed_resolve_0_to_file_in_1: "Failed to resolve {0} to a file in {1}";
120
122
  readonly glob_0_should_use_posix_slash: "The glob \"{0}\" escapes a non-special character. Glob inputs to TypeDoc may not use Windows path separators (\\), try replacing with posix path separators (/)";
@@ -257,13 +259,14 @@ declare const _default: {
257
259
  readonly useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: "The useHostedBaseUrlForAbsoluteLinks option requires that hostedBaseUrl be set";
258
260
  readonly favicon_must_have_one_of_the_following_extensions_0: "Favicon must have one of the following extensions: {0}";
259
261
  readonly option_0_must_be_an_object: "The '{0}' option must be a non-array object";
262
+ readonly option_0_must_be_an_array_of_string: "The '{0}' option must be set to an array of strings";
260
263
  readonly option_0_must_be_a_function: "The '{0}' option must be a function";
261
264
  readonly option_0_must_be_object_with_urls: "{0} must be an object with string labels as keys and URL values";
262
265
  readonly visibility_filters_only_include_0: "visibilityFilters can only include the following non-@ keys: {0}";
263
266
  readonly visibility_filters_must_be_booleans: "All values of visibilityFilters must be booleans";
264
267
  readonly option_0_values_must_be_numbers: "All values of {0} must be numbers";
265
268
  readonly option_0_values_must_be_array_of_tags: "{0} must be an array of valid tag names";
266
- readonly option_0_specified_1_but_only_2_is_valid: "{0} may only specify known values, and invalid values were provided ({1}). The valid sort strategies are:\n{2}";
269
+ readonly option_0_specified_1_but_only_2_is_valid: "{0} may only specify known values, and invalid values were provided ({1}). The valid options are:\n{2}";
267
270
  readonly option_outputs_must_be_array: "\"outputs\" option must be an array of { name: string, path: string, options?: TypeDocOptions } values.";
268
271
  readonly specified_output_0_has_not_been_defined: "Specified output \"{0}\" has not been defined.";
269
272
  readonly alert_note: "Note";
@@ -94,7 +94,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
94
94
  entry_point_0_did_not_match_any_packages: "エントリ ポイント glob {0} は、package.json を含むディレクトリと一致しませんでした。",
95
95
  file_0_not_an_object: "ファイル {0} はオブジェクトではありません",
96
96
  serialized_project_referenced_0_not_part_of_project: "シリアル化されたプロジェクトは、プロジェクトの一部ではないリフレクション {0} を参照しました",
97
- // saved_relative_path_0_resolved_from_1_is_not_a_file
97
+ // saved_relative_path_0_resolved_from_1_does_not_exist
98
98
  circular_reference_extends_0: '{0} の "extends" フィールドで循環参照が検出されました',
99
99
  failed_resolve_0_to_file_in_1: "{0} を {1} 内のファイルに解決できませんでした",
100
100
  option_0_can_only_be_specified_by_config_file: "'{0}' オプションは設定ファイル経由でのみ指定できます",
@@ -126,7 +126,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
126
126
  file_0_not_an_object: "文件 {0} 不是对象",
127
127
  // deserialization
128
128
  serialized_project_referenced_0_not_part_of_project: "序列化项目引用了反射 {0},但它不是项目的一部分",
129
- saved_relative_path_0_resolved_from_1_is_not_a_file: "序列化项目引用的 {0} 不存在或无法在 {1} 下找到",
129
+ saved_relative_path_0_resolved_from_1_does_not_exist: "序列化项目引用的 {0} 不存在或无法在 {1} 下找到",
130
130
  // options
131
131
  circular_reference_extends_0: "{0} 的“extends”字段出现循环引用",
132
132
  failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件",
@@ -114,7 +114,7 @@ declare const _default: {
114
114
  entry_point_0_did_not_match_any_packages: "入口点 glob {0} 与任何包含 package.json 的目录不匹配";
115
115
  file_0_not_an_object: "文件 {0} 不是对象";
116
116
  serialized_project_referenced_0_not_part_of_project: "序列化项目引用了反射 {0},但它不是项目的一部分";
117
- saved_relative_path_0_resolved_from_1_is_not_a_file: "序列化项目引用的 {0} 不存在或无法在 {1} 下找到";
117
+ saved_relative_path_0_resolved_from_1_does_not_exist: "序列化项目引用的 {0} 不存在或无法在 {1} 下找到";
118
118
  circular_reference_extends_0: "{0} 的“extends”字段出现循环引用";
119
119
  failed_resolve_0_to_file_in_1: "无法将 {0} 解析为 {1} 中的文件";
120
120
  option_0_can_only_be_specified_by_config_file: "“{0}”选项只能通过配置文件指定";
@@ -2,6 +2,7 @@ import { type NormalizedPath } from "#utils";
2
2
  import type { Reflection } from "./Reflection.js";
3
3
  import { ReflectionSymbolId } from "./ReflectionSymbolId.js";
4
4
  import type { Deserializer, JSONOutput, Serializer } from "#serialization";
5
+ import type { FileId } from "./FileRegistry.js";
5
6
  /**
6
7
  * Represents a parsed piece of a comment.
7
8
  * @category Comments
@@ -62,7 +63,7 @@ export interface RelativeLinkDisplayPart {
62
63
  * A link to either some document outside of the project or a reflection.
63
64
  * This may be `undefined` if the relative path does not exist.
64
65
  */
65
- target: number | undefined;
66
+ target: FileId | undefined;
66
67
  /**
67
68
  * Anchor within the target page, validated after rendering if possible
68
69
  */
@@ -74,7 +74,7 @@ export class CommentTag {
74
74
  */
75
75
  similarTo(other) {
76
76
  return (this.tag === other.tag &&
77
- this.name === other.tag &&
77
+ this.name === other.name &&
78
78
  Comment.combineDisplayParts(this.content) ===
79
79
  Comment.combineDisplayParts(other.content));
80
80
  }
@@ -49,6 +49,7 @@ export declare abstract class ContainerReflection extends Reflection {
49
49
  getChildrenByKind(kind: ReflectionKind): DeclarationReflection[];
50
50
  addChild(child: Reflection): void;
51
51
  removeChild(child: DeclarationReflection | DocumentReflection): void;
52
+ isContainer(): this is ContainerReflection;
52
53
  traverse(callback: TraverseCallback): void;
53
54
  toObject(serializer: Serializer): JSONOutput.ContainerReflection;
54
55
  fromObject(de: Deserializer, obj: JSONOutput.ContainerReflection): void;
@@ -100,6 +100,9 @@ export class ContainerReflection extends Reflection {
100
100
  delete this.childrenIncludingDocuments;
101
101
  }
102
102
  }
103
+ isContainer() {
104
+ return true;
105
+ }
103
106
  traverse(callback) {
104
107
  for (const child of this.children?.slice() || []) {
105
108
  if (callback(child, TraverseProperty.Children) === false) {
@@ -61,6 +61,6 @@ export class DocumentReflection extends Reflection {
61
61
  this.content = Comment.deserializeDisplayParts(de, obj.content);
62
62
  this.frontmatter = obj.frontmatter;
63
63
  this.relevanceBoost = obj.relevanceBoost;
64
- this.children = de.reviveMany(obj.children, (obj) => de.reflectionBuilders.document(this, obj));
64
+ this.children = de.reviveMany(obj.children, (obj) => de.constructReflection(obj));
65
65
  }
66
66
  }
@@ -2,27 +2,39 @@ import type { Deserializer, JSONOutput, Serializer } from "#serialization";
2
2
  import type { ProjectReflection, Reflection } from "./index.js";
3
3
  import type { ReflectionId } from "./Reflection.js";
4
4
  import { type NormalizedPath } from "#utils";
5
+ export type FileId = number & {
6
+ __mediaIdBrand: never;
7
+ };
5
8
  export declare class FileRegistry {
6
9
  protected nextId: number;
7
- protected mediaToReflection: Map<number, ReflectionId>;
8
- protected mediaToPath: Map<number, NormalizedPath>;
10
+ protected mediaToReflection: Map<FileId, ReflectionId>;
11
+ protected mediaToPath: Map<FileId, NormalizedPath>;
9
12
  protected reflectionToPath: Map<ReflectionId, NormalizedPath>;
10
- protected pathToMedia: Map<NormalizedPath, number>;
11
- protected names: Map<number, string>;
13
+ protected pathToMedia: Map<NormalizedPath, FileId>;
14
+ protected names: Map<FileId, string>;
12
15
  protected nameUsage: Map<string, number>;
13
16
  registerAbsolute(absolute: NormalizedPath): {
14
- target: number;
17
+ target: FileId;
15
18
  anchor: string | undefined;
16
19
  };
20
+ /**
21
+ * Registers the specified path as the canonical file for this reflection
22
+ */
17
23
  registerReflection(absolute: NormalizedPath, reflection: Reflection): void;
24
+ /**
25
+ * Registers the specified path as a path which should be resolved to the specified
26
+ * reflection. A reflection *may* be associated with multiple paths.
27
+ */
28
+ registerReflectionPath(absolute: NormalizedPath, reflection: Reflection): void;
18
29
  getReflectionPath(reflection: Reflection): string | undefined;
19
30
  register(sourcePath: NormalizedPath, relativePath: NormalizedPath): {
20
- target: number;
31
+ target: FileId;
21
32
  anchor: string | undefined;
22
33
  } | undefined;
23
34
  removeReflection(reflection: Reflection): void;
24
- resolve(id: number, project: ProjectReflection): string | Reflection | undefined;
25
- getName(id: number): string | undefined;
35
+ resolve(id: FileId, project: ProjectReflection): string | Reflection | undefined;
36
+ resolvePath(id: FileId): string | undefined;
37
+ getName(id: FileId): string | undefined;
26
38
  getNameToAbsoluteMap(): ReadonlyMap<string, string>;
27
39
  toObject(ser: Serializer): JSONOutput.FileRegistry;
28
40
  /**
@@ -16,7 +16,6 @@ export class FileRegistry {
16
16
  anchor = absolute.substring(anchorIndex + 1);
17
17
  absolute = absolute.substring(0, anchorIndex);
18
18
  }
19
- absolute = absolute.replace(/#.*/, "");
20
19
  const existing = this.pathToMedia.get(absolute);
21
20
  if (existing) {
22
21
  return { target: existing, anchor };
@@ -25,11 +24,22 @@ export class FileRegistry {
25
24
  this.pathToMedia.set(absolute, this.nextId);
26
25
  return { target: this.nextId++, anchor };
27
26
  }
27
+ /**
28
+ * Registers the specified path as the canonical file for this reflection
29
+ */
28
30
  registerReflection(absolute, reflection) {
29
31
  const { target } = this.registerAbsolute(absolute);
30
32
  this.reflectionToPath.set(reflection.id, absolute);
31
33
  this.mediaToReflection.set(target, reflection.id);
32
34
  }
35
+ /**
36
+ * Registers the specified path as a path which should be resolved to the specified
37
+ * reflection. A reflection *may* be associated with multiple paths.
38
+ */
39
+ registerReflectionPath(absolute, reflection) {
40
+ const { target } = this.registerAbsolute(absolute);
41
+ this.mediaToReflection.set(target, reflection.id);
42
+ }
33
43
  getReflectionPath(reflection) {
34
44
  return this.reflectionToPath.get(reflection.id);
35
45
  }
@@ -50,6 +60,9 @@ export class FileRegistry {
50
60
  }
51
61
  return this.mediaToPath.get(id);
52
62
  }
63
+ resolvePath(id) {
64
+ return this.mediaToPath.get(id);
65
+ }
53
66
  getName(id) {
54
67
  const absolute = this.mediaToPath.get(id);
55
68
  if (!absolute)
@@ -104,15 +117,15 @@ export class FileRegistry {
104
117
  * a single object, and should merge in files from the other registries.
105
118
  */
106
119
  fromObject(de, obj) {
107
- for (const [key, val] of Object.entries(obj.entries)) {
108
- const absolute = NormalizedPathUtils.resolve(de.projectRoot, val);
109
- de.oldFileIdToNewFileId[+key] = this.registerAbsolute(absolute).target;
120
+ for (const [fileId, path] of Object.entries(obj.entries)) {
121
+ const absolute = NormalizedPathUtils.resolve(de.projectRoot, path);
122
+ de.oldFileIdToNewFileId[+fileId] = this.registerAbsolute(absolute).target;
110
123
  }
111
124
  de.defer((project) => {
112
- for (const [media, reflId] of Object.entries(obj.reflections)) {
125
+ for (const [fileId, reflId] of Object.entries(obj.reflections)) {
113
126
  const refl = project.getReflectionById(de.oldIdToNewId[reflId]);
114
127
  if (refl) {
115
- this.mediaToReflection.set(de.oldFileIdToNewFileId[+media], refl.id);
128
+ this.mediaToReflection.set(de.oldFileIdToNewFileId[+fileId], refl.id);
116
129
  }
117
130
  }
118
131
  });
@@ -32,7 +32,7 @@ export class ProjectReflection extends ContainerReflection {
32
32
  *
33
33
  * This may be replaced with a `Map<number, Reflection>` someday.
34
34
  */
35
- reflections = { [this.id]: this };
35
+ reflections = {};
36
36
  /**
37
37
  * The name of the package that this reflection documents according to package.json.
38
38
  */
@@ -10,6 +10,7 @@ import type { ParameterReflection } from "./ParameterReflection.js";
10
10
  import type { ReferenceReflection } from "./ReferenceReflection.js";
11
11
  import type { SignatureReflection } from "./SignatureReflection.js";
12
12
  import type { TypeParameterReflection } from "./TypeParameterReflection.js";
13
+ import type { ContainerReflection } from "./ContainerReflection.js";
13
14
  /**
14
15
  * Reset the reflection id.
15
16
  *
@@ -99,6 +100,10 @@ export interface TraverseCallback {
99
100
  export type ReflectionVisitor = {
100
101
  [K in keyof ReflectionVariant]?: (refl: ReflectionVariant[K]) => void;
101
102
  };
103
+ /**
104
+ * Alias for a `number` which references a reflection.
105
+ * `-1` may be used for an invalid reflection ID.
106
+ */
102
107
  export type ReflectionId = number & {
103
108
  __reflectionIdBrand: never;
104
109
  };
@@ -189,6 +194,7 @@ export declare abstract class Reflection {
189
194
  isParameter(): this is ParameterReflection;
190
195
  isDocument(): this is DocumentReflection;
191
196
  isReference(): this is ReferenceReflection;
197
+ isContainer(): this is ContainerReflection;
192
198
  /**
193
199
  * Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
194
200
  */
@@ -419,6 +419,9 @@ let Reflection = (() => {
419
419
  isReference() {
420
420
  return this.variant === "reference";
421
421
  }
422
+ isContainer() {
423
+ return false;
424
+ }
422
425
  /**
423
426
  * Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
424
427
  */
@@ -1,4 +1,4 @@
1
- import type { Reflection } from "./Reflection.js";
1
+ import type { Reflection, ReflectionId } from "./Reflection.js";
2
2
  import type { DeclarationReflection } from "./DeclarationReflection.js";
3
3
  import type { ProjectReflection } from "./ProjectReflection.js";
4
4
  import type { Deserializer, JSONOutput, Serializer } from "#serialization";
@@ -386,7 +386,7 @@ export declare class ReferenceType extends Type {
386
386
  private _project;
387
387
  private constructor();
388
388
  static createUnresolvedReference(name: string, target: ReflectionSymbolId, project: ProjectReflection, qualifiedName: string): ReferenceType;
389
- static createResolvedReference(name: string, target: Reflection | number, project: ProjectReflection | null): ReferenceType;
389
+ static createResolvedReference(name: string, target: Reflection | ReflectionId, project: ProjectReflection | null): ReferenceType;
390
390
  /**
391
391
  * This is used for type parameters, which don't actually point to something,
392
392
  * and also for temporary references which will be cleaned up with real references
@@ -894,20 +894,22 @@ let ReferenceType = (() => {
894
894
  }
895
895
  fromObject(de, obj) {
896
896
  this.typeArguments = de.reviveMany(obj.typeArguments, (t) => de.constructType(t));
897
- if (typeof obj.target === "number" && obj.target !== -1) {
898
- de.defer((project) => {
899
- const target = project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1);
900
- if (target) {
901
- this._project = project;
902
- this._target = target.id;
903
- }
904
- else {
905
- de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(JSON.stringify(obj.target)));
906
- }
907
- });
908
- }
909
- else if (obj.target === -1) {
910
- this._target = -1;
897
+ if (typeof obj.target === "number") {
898
+ if (obj.target === -1) {
899
+ this._target = -1;
900
+ }
901
+ else {
902
+ de.defer((project) => {
903
+ const target = project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1);
904
+ if (target) {
905
+ this._project = project;
906
+ this._target = target.id;
907
+ }
908
+ else {
909
+ de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(JSON.stringify(obj.target)));
910
+ }
911
+ });
912
+ }
911
913
  }
912
914
  else {
913
915
  this._project = de.project;
@@ -34,7 +34,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
34
34
  };
35
35
  import { RendererComponent } from "../components.js";
36
36
  import { RendererEvent } from "../events.js";
37
- import { copySync, readFile, writeFileSync } from "../../utils/fs.js";
37
+ import { copySync, isFile, readFile, writeFileSync } from "../../utils/fs.js";
38
38
  import { DefaultTheme } from "../themes/default/DefaultTheme.js";
39
39
  import { getStyles } from "../../utils/highlighter.js";
40
40
  import { getEnumKeys, i18n } from "#utils";
@@ -146,7 +146,12 @@ let AssetsPlugin = (() => {
146
146
  const media = join(event.outputDirectory, "media");
147
147
  const toCopy = event.project.files.getNameToAbsoluteMap();
148
148
  for (const [fileName, absolute] of toCopy.entries()) {
149
- copySync(absolute, join(media, fileName));
149
+ if (isFile(absolute)) {
150
+ copySync(absolute, join(media, fileName));
151
+ }
152
+ else {
153
+ this.application.logger.warn(i18n.relative_path_0_is_not_a_file_and_will_not_be_copied_to_output(absolute));
154
+ }
150
155
  }
151
156
  }
152
157
  }