typedoc 0.25.0 → 0.25.2

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 (85) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.js +2 -1
  3. package/dist/lib/application.d.ts +3 -3
  4. package/dist/lib/application.js +440 -359
  5. package/dist/lib/cli.js +6 -3
  6. package/dist/lib/converter/comments/discovery.js +8 -2
  7. package/dist/lib/converter/comments/index.js +9 -1
  8. package/dist/lib/converter/comments/parser.js +5 -11
  9. package/dist/lib/converter/comments/tagName.d.ts +8 -0
  10. package/dist/lib/converter/comments/tagName.js +62 -0
  11. package/dist/lib/converter/context.js +1 -2
  12. package/dist/lib/converter/converter.d.ts +11 -11
  13. package/dist/lib/converter/converter.js +436 -311
  14. package/dist/lib/converter/factories/signature.d.ts +1 -0
  15. package/dist/lib/converter/factories/signature.js +31 -5
  16. package/dist/lib/converter/jsdoc.js +2 -6
  17. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
  18. package/dist/lib/converter/plugins/CategoryPlugin.js +293 -200
  19. package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
  20. package/dist/lib/converter/plugins/CommentPlugin.js +433 -305
  21. package/dist/lib/converter/plugins/GroupPlugin.d.ts +4 -3
  22. package/dist/lib/converter/plugins/GroupPlugin.js +226 -145
  23. package/dist/lib/converter/plugins/ImplementsPlugin.js +239 -194
  24. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
  25. package/dist/lib/converter/plugins/InheritDocPlugin.js +201 -138
  26. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
  27. package/dist/lib/converter/plugins/LinkResolverPlugin.js +110 -44
  28. package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
  29. package/dist/lib/converter/plugins/PackagePlugin.js +191 -96
  30. package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -6
  31. package/dist/lib/converter/plugins/SourcePlugin.js +234 -146
  32. package/dist/lib/converter/plugins/TypePlugin.js +147 -102
  33. package/dist/lib/converter/symbols.js +1 -1
  34. package/dist/lib/converter/types.js +10 -0
  35. package/dist/lib/converter/utils/repository.js +2 -2
  36. package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
  37. package/dist/lib/models/reflections/abstract.d.ts +4 -0
  38. package/dist/lib/models/reflections/abstract.js +14 -2
  39. package/dist/lib/models/reflections/index.d.ts +1 -1
  40. package/dist/lib/output/components.d.ts +1 -0
  41. package/dist/lib/output/components.js +9 -1
  42. package/dist/lib/output/index.d.ts +1 -1
  43. package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
  44. package/dist/lib/output/plugins/AssetsPlugin.js +111 -44
  45. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
  46. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +173 -99
  47. package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
  48. package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
  49. package/dist/lib/output/plugins/index.d.ts +2 -1
  50. package/dist/lib/output/plugins/index.js +5 -3
  51. package/dist/lib/output/renderer.d.ts +10 -8
  52. package/dist/lib/output/renderer.js +315 -202
  53. package/dist/lib/output/theme.js +63 -18
  54. package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
  55. package/dist/lib/output/themes/MarkedPlugin.js +223 -145
  56. package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
  57. package/dist/lib/output/themes/default/DefaultTheme.js +72 -0
  58. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +42 -36
  59. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +15 -1
  60. package/dist/lib/output/themes/default/layouts/default.js +2 -0
  61. package/dist/lib/output/themes/default/partials/header.js +1 -1
  62. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
  63. package/dist/lib/output/themes/default/partials/icon.js +46 -35
  64. package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
  65. package/dist/lib/output/themes/default/partials/navigation.js +34 -67
  66. package/dist/lib/utils/component.d.ts +1 -1
  67. package/dist/lib/utils/component.js +3 -1
  68. package/dist/lib/utils/entry-point.js +36 -18
  69. package/dist/lib/utils/events.js +1 -1
  70. package/dist/lib/utils/general.js +1 -1
  71. package/dist/lib/utils/index.d.ts +1 -1
  72. package/dist/lib/utils/index.js +2 -1
  73. package/dist/lib/utils/jsx.js +1 -1
  74. package/dist/lib/utils/options/declaration.d.ts +4 -0
  75. package/dist/lib/utils/options/index.d.ts +1 -1
  76. package/dist/lib/utils/options/index.js +2 -1
  77. package/dist/lib/utils/options/options.d.ts +19 -0
  78. package/dist/lib/utils/options/options.js +22 -2
  79. package/dist/lib/utils/options/readers/tsconfig.js +2 -7
  80. package/dist/lib/utils/options/sources/typedoc.js +22 -0
  81. package/dist/lib/utils/perf.d.ts +1 -1
  82. package/dist/lib/utils/perf.js +10 -20
  83. package/package.json +9 -9
  84. package/static/main.js +4 -3
  85. package/static/style.css +7 -3
package/dist/lib/cli.js CHANGED
@@ -31,6 +31,7 @@ const ExitCodes = {
31
31
  ValidationError: 4,
32
32
  OutputError: 5,
33
33
  ExceptionThrown: 6,
34
+ Watching: 7,
34
35
  };
35
36
  const td = __importStar(require("typedoc"));
36
37
  void main();
@@ -46,8 +47,10 @@ async function main() {
46
47
  new td.ArgumentsReader(300),
47
48
  ]);
48
49
  const exitCode = await run(app);
49
- app.logger.verbose(`Full run took ${Date.now() - start}ms`);
50
- process.exit(exitCode);
50
+ if (exitCode !== ExitCodes.Watching) {
51
+ app.logger.verbose(`Full run took ${Date.now() - start}ms`);
52
+ process.exit(exitCode);
53
+ }
51
54
  }
52
55
  catch (error) {
53
56
  console.error("TypeDoc exiting with unexpected error:");
@@ -88,7 +91,7 @@ async function run(app) {
88
91
  await app.generateJson(project, json);
89
92
  }
90
93
  });
91
- return ExitCodes.Ok;
94
+ return ExitCodes.Watching;
92
95
  }
93
96
  const project = await app.convert();
94
97
  if (!project) {
@@ -28,8 +28,14 @@ const variablePropertyKinds = [
28
28
  // the JSDoc converter because we only want part of the comment when
29
29
  // getting them.
30
30
  const wantedKinds = {
31
- [models_1.ReflectionKind.Project]: [typescript_1.default.SyntaxKind.SourceFile],
32
- [models_1.ReflectionKind.Module]: [typescript_1.default.SyntaxKind.SourceFile],
31
+ [models_1.ReflectionKind.Project]: [
32
+ typescript_1.default.SyntaxKind.SourceFile,
33
+ typescript_1.default.SyntaxKind.ModuleDeclaration,
34
+ ],
35
+ [models_1.ReflectionKind.Module]: [
36
+ typescript_1.default.SyntaxKind.SourceFile,
37
+ typescript_1.default.SyntaxKind.ModuleDeclaration,
38
+ ],
33
39
  [models_1.ReflectionKind.Namespace]: [
34
40
  typescript_1.default.SyntaxKind.ModuleDeclaration,
35
41
  typescript_1.default.SyntaxKind.SourceFile,
@@ -74,7 +74,15 @@ function getComment(symbol, kind, config, logger, commentStyle, checker) {
74
74
  declarations.every((d) => jsDocCommentKinds.includes(d.kind))) {
75
75
  return getJsDocComment(declarations[0], config, logger, checker);
76
76
  }
77
- const comment = getCommentImpl((0, discovery_1.discoverComment)(symbol, kind, logger, commentStyle), config, logger, declarations.some(typescript_1.default.isSourceFile), checker);
77
+ const isModule = declarations.some((decl) => {
78
+ if (typescript_1.default.isSourceFile(decl))
79
+ return true;
80
+ if (typescript_1.default.isModuleDeclaration(decl) && typescript_1.default.isStringLiteral(decl.name)) {
81
+ return true;
82
+ }
83
+ return false;
84
+ });
85
+ const comment = getCommentImpl((0, discovery_1.discoverComment)(symbol, kind, logger, commentStyle), config, logger, isModule, checker);
78
86
  if (!comment && kind === models_1.ReflectionKind.Property) {
79
87
  return getConstructorParamPropertyComment(symbol, config, logger, commentStyle, checker);
80
88
  }
@@ -6,6 +6,7 @@ const models_1 = require("../../models");
6
6
  const utils_1 = require("../../utils");
7
7
  const paths_1 = require("../../utils/paths");
8
8
  const lexer_1 = require("./lexer");
9
+ const tagName_1 = require("./tagName");
9
10
  function makeLookaheadGenerator(gen) {
10
11
  let trackHistory = false;
11
12
  const history = [];
@@ -78,17 +79,10 @@ function postProcessComment(comment, warning) {
78
79
  if (HAS_USER_IDENTIFIER.includes(tag.tag) && tag.content.length) {
79
80
  const first = tag.content[0];
80
81
  if (first.kind === "text") {
81
- let end = first.text.search(/\s/);
82
- if (end === -1)
83
- end = first.text.length;
84
- tag.name = first.text.substring(0, end);
85
- if (tag.name.startsWith("[") && tag.name.endsWith("]")) {
86
- tag.name = tag.name.slice(1, tag.name.indexOf("="));
87
- }
88
- first.text = first.text.substring(end);
89
- const endOfTrivia = first.text.search(/[^\-\s]/);
90
- if (endOfTrivia !== -1) {
91
- first.text = first.text.substring(endOfTrivia);
82
+ const { name, newText } = (0, tagName_1.extractTagName)(first.text);
83
+ tag.name = name;
84
+ if (newText) {
85
+ first.text = newText;
92
86
  }
93
87
  else {
94
88
  // Remove this token, no real text in it.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Determines the name of the parameter/template/property from the tag content
3
+ * when processing `@param x`
4
+ */
5
+ export declare function extractTagName(text: string): {
6
+ name: string;
7
+ newText: string;
8
+ };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractTagName = void 0;
4
+ /**
5
+ * Determines the name of the parameter/template/property from the tag content
6
+ * when processing `@param x`
7
+ */
8
+ function extractTagName(text) {
9
+ let pos = skipWs(text, 0);
10
+ // Extract the "name" part of the comment, this might also include a default
11
+ // value if bracketed.
12
+ let nameStart = pos;
13
+ let bracketDepth = 0;
14
+ let stringChar = "";
15
+ while (pos < text.length && (bracketDepth > 0 || /\S/.test(text[pos]))) {
16
+ if (stringChar) {
17
+ if (text[pos] == stringChar) {
18
+ stringChar = "";
19
+ ++pos;
20
+ }
21
+ else if (text[pos] == "\\") {
22
+ pos += 2;
23
+ }
24
+ else {
25
+ ++pos;
26
+ }
27
+ }
28
+ else {
29
+ if ("\"'`".includes(text[pos])) {
30
+ stringChar = text[pos];
31
+ }
32
+ else if (text[pos] == "[") {
33
+ ++bracketDepth;
34
+ }
35
+ else if (text[pos] == "]") {
36
+ --bracketDepth;
37
+ }
38
+ ++pos;
39
+ }
40
+ }
41
+ let nameEnd = pos;
42
+ if (text[nameStart] === "[") {
43
+ nameStart = skipWs(text, nameStart + 1);
44
+ nameEnd = skipWith(text, nameStart, /[^\s=\]]/);
45
+ }
46
+ // Skip any whitespace & an optional dash before the description
47
+ pos = skipWith(text, pos, /[\s-]/);
48
+ return {
49
+ name: text.substring(nameStart, nameEnd),
50
+ newText: text.substring(pos),
51
+ };
52
+ }
53
+ exports.extractTagName = extractTagName;
54
+ function skipWs(text, pos) {
55
+ return skipWith(text, pos, /\s/);
56
+ }
57
+ function skipWith(text, pos, reg) {
58
+ while (pos < text.length && reg.test(text[pos])) {
59
+ ++pos;
60
+ }
61
+ return pos;
62
+ }
@@ -138,9 +138,8 @@ class Context {
138
138
  this.converter.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, this, reflection);
139
139
  }
140
140
  addChild(reflection) {
141
- var _a;
142
141
  if (this.scope instanceof index_1.ContainerReflection) {
143
- (_a = this.scope).children ?? (_a.children = []);
142
+ this.scope.children ??= [];
144
143
  this.scope.children.push(reflection);
145
144
  }
146
145
  }
@@ -15,29 +15,29 @@ import type { DeclarationReference } from "./comments/declarationReference";
15
15
  */
16
16
  export declare class Converter extends ChildableComponent<Application, ConverterComponent> {
17
17
  /** @internal */
18
- externalPattern: string[];
18
+ accessor externalPattern: string[];
19
19
  private externalPatternCache?;
20
20
  private excludeCache?;
21
21
  /** @internal */
22
- excludeExternals: boolean;
22
+ accessor excludeExternals: boolean;
23
23
  /** @internal */
24
- excludeNotDocumented: boolean;
24
+ accessor excludeNotDocumented: boolean;
25
25
  /** @internal */
26
- excludePrivate: boolean;
26
+ accessor excludePrivate: boolean;
27
27
  /** @internal */
28
- excludeProtected: boolean;
28
+ accessor excludeProtected: boolean;
29
29
  /** @internal */
30
- excludeReferences: boolean;
30
+ accessor excludeReferences: boolean;
31
31
  /** @internal */
32
- commentStyle: CommentStyle;
32
+ accessor commentStyle: CommentStyle;
33
33
  /** @internal */
34
- validation: ValidationOptions;
34
+ accessor validation: ValidationOptions;
35
35
  /** @internal */
36
- externalSymbolLinkMappings: Record<string, Record<string, string>>;
36
+ accessor externalSymbolLinkMappings: Record<string, Record<string, string>>;
37
37
  /** @internal */
38
- useTsLinkResolution: boolean;
38
+ accessor useTsLinkResolution: boolean;
39
39
  /** @internal */
40
- preserveLinkText: boolean;
40
+ accessor preserveLinkText: boolean;
41
41
  private _config?;
42
42
  private _externalSymbolResolvers;
43
43
  get config(): CommentParserConfig;