typedoc 0.23.25 → 0.24.0-beta.1

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 (159) hide show
  1. package/bin/typedoc +1 -130
  2. package/dist/index.d.ts +3 -4
  3. package/dist/index.js +15 -5
  4. package/dist/lib/application-events.d.ts +1 -0
  5. package/dist/lib/application-events.js +1 -0
  6. package/dist/lib/application.d.ts +26 -10
  7. package/dist/lib/application.js +138 -65
  8. package/dist/lib/cli.d.ts +1 -0
  9. package/dist/lib/cli.js +129 -0
  10. package/dist/lib/converter/comments/declarationReference.d.ts +1 -1
  11. package/dist/lib/converter/comments/declarationReferenceResolver.js +11 -5
  12. package/dist/lib/converter/comments/discovery.d.ts +1 -1
  13. package/dist/lib/converter/comments/discovery.js +96 -76
  14. package/dist/lib/converter/comments/index.d.ts +1 -1
  15. package/dist/lib/converter/comments/index.js +37 -17
  16. package/dist/lib/converter/comments/linkResolver.d.ts +2 -3
  17. package/dist/lib/converter/comments/linkResolver.js +37 -132
  18. package/dist/lib/converter/context.d.ts +1 -1
  19. package/dist/lib/converter/context.js +27 -14
  20. package/dist/lib/converter/convert-expression.d.ts +1 -1
  21. package/dist/lib/converter/convert-expression.js +35 -15
  22. package/dist/lib/converter/converter.d.ts +1 -1
  23. package/dist/lib/converter/converter.js +35 -23
  24. package/dist/lib/converter/factories/index-signature.d.ts +1 -1
  25. package/dist/lib/converter/factories/index-signature.js +26 -3
  26. package/dist/lib/converter/factories/signature.d.ts +2 -2
  27. package/dist/lib/converter/factories/signature.js +76 -52
  28. package/dist/lib/converter/jsdoc.d.ts +1 -1
  29. package/dist/lib/converter/jsdoc.js +39 -17
  30. package/dist/lib/converter/plugins/CommentPlugin.d.ts +0 -2
  31. package/dist/lib/converter/plugins/CommentPlugin.js +7 -28
  32. package/dist/lib/converter/plugins/GroupPlugin.d.ts +1 -39
  33. package/dist/lib/converter/plugins/GroupPlugin.js +3 -61
  34. package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +1 -4
  35. package/dist/lib/converter/plugins/ImplementsPlugin.js +49 -28
  36. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +0 -3
  37. package/dist/lib/converter/plugins/InheritDocPlugin.js +6 -7
  38. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +2 -3
  39. package/dist/lib/converter/plugins/LinkResolverPlugin.js +12 -10
  40. package/dist/lib/converter/plugins/PackagePlugin.d.ts +5 -14
  41. package/dist/lib/converter/plugins/PackagePlugin.js +44 -56
  42. package/dist/lib/converter/plugins/SourcePlugin.js +31 -6
  43. package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -10
  44. package/dist/lib/converter/plugins/TypePlugin.js +23 -13
  45. package/dist/lib/converter/symbols.d.ts +1 -1
  46. package/dist/lib/converter/symbols.js +153 -132
  47. package/dist/lib/converter/types.d.ts +1 -1
  48. package/dist/lib/converter/types.js +121 -95
  49. package/dist/lib/converter/utils/nodes.d.ts +1 -1
  50. package/dist/lib/converter/utils/nodes.js +24 -4
  51. package/dist/lib/converter/utils/symbols.d.ts +1 -1
  52. package/dist/lib/converter/utils/symbols.js +24 -4
  53. package/dist/lib/models/ReflectionCategory.d.ts +2 -1
  54. package/dist/lib/models/ReflectionCategory.js +12 -0
  55. package/dist/lib/models/ReflectionGroup.d.ts +3 -2
  56. package/dist/lib/models/ReflectionGroup.js +20 -0
  57. package/dist/lib/models/comments/comment.d.ts +12 -1
  58. package/dist/lib/models/comments/comment.js +80 -17
  59. package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +29 -0
  60. package/dist/lib/models/reflections/ReflectionSymbolId.js +94 -0
  61. package/dist/lib/models/reflections/abstract.d.ts +12 -37
  62. package/dist/lib/models/reflections/abstract.js +27 -35
  63. package/dist/lib/models/reflections/container.d.ts +6 -10
  64. package/dist/lib/models/reflections/container.js +8 -1
  65. package/dist/lib/models/reflections/declaration.d.ts +19 -4
  66. package/dist/lib/models/reflections/declaration.js +54 -1
  67. package/dist/lib/models/reflections/index.d.ts +2 -0
  68. package/dist/lib/models/reflections/index.js +3 -1
  69. package/dist/lib/models/reflections/kind.d.ts +15 -1
  70. package/dist/lib/models/reflections/kind.js +43 -1
  71. package/dist/lib/models/reflections/parameter.d.ts +3 -1
  72. package/dist/lib/models/reflections/parameter.js +10 -0
  73. package/dist/lib/models/reflections/project.d.ts +32 -5
  74. package/dist/lib/models/reflections/project.js +84 -20
  75. package/dist/lib/models/reflections/reference.d.ts +5 -9
  76. package/dist/lib/models/reflections/reference.js +13 -29
  77. package/dist/lib/models/reflections/signature.d.ts +8 -1
  78. package/dist/lib/models/reflections/signature.js +14 -0
  79. package/dist/lib/models/reflections/type-parameter.d.ts +7 -4
  80. package/dist/lib/models/reflections/type-parameter.js +9 -3
  81. package/dist/lib/models/reflections/variant.d.ts +18 -0
  82. package/dist/lib/models/reflections/variant.js +2 -0
  83. package/dist/lib/models/sources/file.d.ts +2 -0
  84. package/dist/lib/models/sources/file.js +3 -0
  85. package/dist/lib/models/types.d.ts +24 -20
  86. package/dist/lib/models/types.js +132 -33
  87. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +3 -7
  88. package/dist/lib/output/renderer.d.ts +21 -14
  89. package/dist/lib/output/renderer.js +25 -25
  90. package/dist/lib/output/themes/MarkedPlugin.js +2 -3
  91. package/dist/lib/output/themes/default/DefaultTheme.d.ts +2 -20
  92. package/dist/lib/output/themes/default/DefaultTheme.js +4 -75
  93. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +9 -8
  94. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +54 -0
  95. package/dist/lib/output/themes/default/partials/header.js +2 -5
  96. package/dist/lib/output/themes/default/partials/index.js +2 -2
  97. package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +2 -2
  98. package/dist/lib/output/themes/default/partials/member.getterSetter.js +4 -1
  99. package/dist/lib/output/themes/default/partials/member.js +1 -1
  100. package/dist/lib/output/themes/default/partials/member.signatures.js +2 -1
  101. package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
  102. package/dist/lib/output/themes/default/partials/members.js +3 -1
  103. package/dist/lib/output/themes/default/partials/navigation.js +6 -4
  104. package/dist/lib/output/themes/default/partials/parameter.js +1 -1
  105. package/dist/lib/output/themes/default/partials/type.js +4 -4
  106. package/dist/lib/output/themes/default/templates/reflection.js +1 -1
  107. package/dist/lib/output/themes/lib.d.ts +1 -0
  108. package/dist/lib/output/themes/lib.js +13 -3
  109. package/dist/lib/serialization/deserializer.d.ts +54 -0
  110. package/dist/lib/serialization/deserializer.js +212 -0
  111. package/dist/lib/serialization/events.d.ts +0 -15
  112. package/dist/lib/serialization/index.d.ts +2 -3
  113. package/dist/lib/serialization/index.js +4 -3
  114. package/dist/lib/serialization/schema.d.ts +23 -17
  115. package/dist/lib/serialization/serializer.d.ts +5 -5
  116. package/dist/lib/serialization/serializer.js +4 -15
  117. package/dist/lib/utils/array.d.ts +0 -1
  118. package/dist/lib/utils/array.js +1 -2
  119. package/dist/lib/utils/entry-point.d.ts +15 -4
  120. package/dist/lib/utils/entry-point.js +45 -28
  121. package/dist/lib/utils/enum.d.ts +4 -1
  122. package/dist/lib/utils/enum.js +2 -3
  123. package/dist/lib/utils/fs.d.ts +3 -1
  124. package/dist/lib/utils/fs.js +36 -73
  125. package/dist/lib/utils/index.d.ts +4 -3
  126. package/dist/lib/utils/index.js +3 -3
  127. package/dist/lib/utils/loggers.d.ts +5 -26
  128. package/dist/lib/utils/loggers.js +38 -42
  129. package/dist/lib/utils/map.d.ts +17 -0
  130. package/dist/lib/utils/map.js +49 -1
  131. package/dist/lib/utils/options/declaration.d.ts +20 -6
  132. package/dist/lib/utils/options/help.js +1 -1
  133. package/dist/lib/utils/options/options.d.ts +27 -18
  134. package/dist/lib/utils/options/options.js +68 -14
  135. package/dist/lib/utils/options/readers/arguments.d.ts +2 -1
  136. package/dist/lib/utils/options/readers/arguments.js +9 -2
  137. package/dist/lib/utils/options/readers/tsconfig.d.ts +3 -7
  138. package/dist/lib/utils/options/readers/tsconfig.js +35 -36
  139. package/dist/lib/utils/options/readers/typedoc.d.ts +4 -5
  140. package/dist/lib/utils/options/readers/typedoc.js +9 -21
  141. package/dist/lib/utils/options/sources/typedoc.js +18 -64
  142. package/dist/lib/utils/package-manifest.d.ts +1 -1
  143. package/dist/lib/utils/package-manifest.js +1 -2
  144. package/dist/lib/utils/paths.d.ts +2 -2
  145. package/dist/lib/utils/paths.js +2 -0
  146. package/dist/lib/utils/plugins.d.ts +1 -2
  147. package/dist/lib/utils/plugins.js +22 -106
  148. package/dist/lib/utils/sort.d.ts +1 -1
  149. package/dist/lib/utils/sort.js +8 -11
  150. package/dist/lib/utils/tsconfig.d.ts +4 -0
  151. package/dist/lib/utils/tsconfig.js +36 -0
  152. package/dist/lib/utils/tsutils.d.ts +3 -2
  153. package/dist/lib/utils/tsutils.js +46 -12
  154. package/dist/lib/validation/documentation.d.ts +1 -1
  155. package/dist/lib/validation/documentation.js +5 -16
  156. package/dist/lib/validation/exports.js +18 -21
  157. package/dist/lib/validation/links.js +1 -1
  158. package/package.json +18 -19
  159. package/static/main.js +0 -54
@@ -1,51 +1,73 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
29
  exports.createTypeParamReflection = exports.convertTypeParameterNodes = exports.convertParameterNodes = exports.createSignature = void 0;
7
- const typescript_1 = __importDefault(require("typescript"));
30
+ const ts = __importStar(require("typescript"));
8
31
  const assert_1 = __importDefault(require("assert"));
9
32
  const models_1 = require("../../models");
10
33
  const converter_events_1 = require("../converter-events");
11
34
  const convert_expression_1 = require("../convert-expression");
12
35
  const reflections_1 = require("../utils/reflections");
13
36
  const comments_1 = require("../comments");
14
- function createSignature(context, kind, signature, declaration) {
37
+ const ReflectionSymbolId_1 = require("../../models/reflections/ReflectionSymbolId");
38
+ function createSignature(context, kind, signature, symbol, declaration) {
15
39
  var _a;
16
40
  (0, assert_1.default)(context.scope instanceof models_1.DeclarationReflection);
17
41
  declaration || (declaration = signature.getDeclaration());
18
42
  const sigRef = new models_1.SignatureReflection(kind == models_1.ReflectionKind.ConstructorSignature
19
43
  ? `new ${context.scope.parent.name}`
20
44
  : context.scope.name, kind, context.scope);
21
- // If we are creating signatures for a variable or property and it has a comment associated with it
22
- // then we should prefer that comment over any comment on the signature. The comment plugin
23
- // will copy the comment down if this signature doesn't have one, so don't set one.
24
- let parentReflection = context.scope;
25
- if (parentReflection.kindOf(models_1.ReflectionKind.TypeLiteral) &&
26
- parentReflection.parent instanceof models_1.DeclarationReflection) {
27
- parentReflection = parentReflection.parent;
45
+ const sigRefCtx = context.withScope(sigRef);
46
+ if (symbol && declaration) {
47
+ context.project.registerSymbolId(sigRef, new ReflectionSymbolId_1.ReflectionSymbolId(symbol, declaration));
28
48
  }
49
+ // If we are creating signatures for a variable and the variable has a comment associated with it
50
+ // then we should prefer that variable's comment over any comment on the signature. The comment plugin
51
+ // will copy the comment down if this signature doesn't have one, so don't set one.
29
52
  if (declaration &&
30
- (!parentReflection.comment ||
31
- !(parentReflection.conversionFlags &
32
- models_1.ConversionFlags.VariableOrPropertySource))) {
53
+ (!context.scope.comment ||
54
+ !(context.scope.conversionFlags & models_1.ConversionFlags.VariableSource))) {
33
55
  sigRef.comment = (0, comments_1.getSignatureComment)(declaration, context.converter.config, context.logger, context.converter.commentStyle);
34
56
  }
35
- sigRef.typeParameters = convertTypeParameters(context, sigRef, signature.typeParameters);
57
+ sigRef.typeParameters = convertTypeParameters(sigRefCtx, sigRef, signature.typeParameters);
36
58
  const parameterSymbols = signature.thisParameter
37
59
  ? [signature.thisParameter, ...signature.parameters]
38
60
  : signature.parameters;
39
- sigRef.parameters = convertParameters(context, sigRef, parameterSymbols, declaration?.parameters);
61
+ sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, declaration?.parameters);
40
62
  const predicate = context.checker.getTypePredicateOfSignature(signature);
41
63
  if (predicate) {
42
- sigRef.type = convertPredicate(predicate, context.withScope(sigRef));
64
+ sigRef.type = convertPredicate(predicate, sigRefCtx);
43
65
  }
44
66
  else if (kind == models_1.ReflectionKind.SetSignature) {
45
67
  sigRef.type = new models_1.IntrinsicType("void");
46
68
  }
47
69
  else {
48
- sigRef.type = context.converter.convertType(context.withScope(sigRef), (declaration?.kind === typescript_1.default.SyntaxKind.FunctionDeclaration &&
70
+ sigRef.type = context.converter.convertType(sigRefCtx, (declaration?.kind === ts.SyntaxKind.FunctionDeclaration &&
49
71
  declaration.type) ||
50
72
  signature.getReturnType());
51
73
  }
@@ -70,10 +92,10 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
70
92
  return parameters.map((param, i) => {
71
93
  const declaration = param.valueDeclaration;
72
94
  (0, assert_1.default)(!declaration ||
73
- typescript_1.default.isParameter(declaration) ||
74
- typescript_1.default.isJSDocParameterTag(declaration));
95
+ ts.isParameter(declaration) ||
96
+ ts.isJSDocParameterTag(declaration));
75
97
  const paramRefl = new models_1.ParameterReflection(/__\d+/.test(param.name) ? "__namedParameters" : param.name, models_1.ReflectionKind.Parameter, sigRef);
76
- if (declaration && typescript_1.default.isJSDocParameterTag(declaration)) {
98
+ if (declaration && ts.isJSDocParameterTag(declaration)) {
77
99
  paramRefl.comment = (0, comments_1.getJsDocComment)(declaration, context.converter.config, context.logger);
78
100
  }
79
101
  paramRefl.comment || (paramRefl.comment = (0, comments_1.getComment)(param, paramRefl.kind, context.converter.config, context.logger, context.converter.commentStyle));
@@ -89,9 +111,9 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
89
111
  paramRefl.type = context.converter.convertType(context.withScope(paramRefl), type);
90
112
  let isOptional = false;
91
113
  if (declaration) {
92
- isOptional = typescript_1.default.isParameter(declaration)
114
+ isOptional = ts.isParameter(declaration)
93
115
  ? !!declaration.questionToken ||
94
- typescript_1.default
116
+ ts
95
117
  .getJSDocParameterTags(declaration)
96
118
  .some((tag) => tag.isBracketed)
97
119
  : declaration.isBracketed;
@@ -105,10 +127,10 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
105
127
  // because the method body uses `arguments`... which is always a rest argument
106
128
  let isRest = true;
107
129
  if (declaration) {
108
- isRest = typescript_1.default.isParameter(declaration)
130
+ isRest = ts.isParameter(declaration)
109
131
  ? !!declaration.dotDotDotToken
110
132
  : !!declaration.typeExpression &&
111
- typescript_1.default.isJSDocVariadicType(declaration.typeExpression.type);
133
+ ts.isJSDocVariadicType(declaration.typeExpression.type);
112
134
  }
113
135
  paramRefl.setFlag(models_1.ReflectionFlag.Rest, isRest);
114
136
  return paramRefl;
@@ -119,13 +141,13 @@ function convertParameterNodes(context, sigRef, parameters) {
119
141
  const paramRefl = new models_1.ParameterReflection(/__\d+/.test(param.name.getText())
120
142
  ? "__namedParameters"
121
143
  : param.name.getText(), models_1.ReflectionKind.Parameter, sigRef);
122
- if (typescript_1.default.isJSDocParameterTag(param)) {
144
+ if (ts.isJSDocParameterTag(param)) {
123
145
  paramRefl.comment = (0, comments_1.getJsDocComment)(param, context.converter.config, context.logger);
124
146
  }
125
147
  context.registerReflection(paramRefl, context.getSymbolAtLocation(param));
126
148
  context.trigger(converter_events_1.ConverterEvents.CREATE_PARAMETER, paramRefl);
127
- paramRefl.type = context.converter.convertType(context.withScope(paramRefl), typescript_1.default.isParameter(param) ? param.type : param.typeExpression?.type);
128
- const isOptional = typescript_1.default.isParameter(param)
149
+ paramRefl.type = context.converter.convertType(context.withScope(paramRefl), ts.isParameter(param) ? param.type : param.typeExpression?.type);
150
+ const isOptional = ts.isParameter(param)
129
151
  ? !!param.questionToken
130
152
  : param.isBracketed;
131
153
  if (isOptional) {
@@ -133,10 +155,10 @@ function convertParameterNodes(context, sigRef, parameters) {
133
155
  }
134
156
  paramRefl.defaultValue = (0, convert_expression_1.convertDefaultValue)(param);
135
157
  paramRefl.setFlag(models_1.ReflectionFlag.Optional, isOptional);
136
- paramRefl.setFlag(models_1.ReflectionFlag.Rest, typescript_1.default.isParameter(param)
158
+ paramRefl.setFlag(models_1.ReflectionFlag.Rest, ts.isParameter(param)
137
159
  ? !!param.dotDotDotToken
138
160
  : !!param.typeExpression &&
139
- typescript_1.default.isJSDocVariadicType(param.typeExpression.type));
161
+ ts.isJSDocVariadicType(param.typeExpression.type));
140
162
  return paramRefl;
141
163
  });
142
164
  }
@@ -145,17 +167,18 @@ function convertTypeParameters(context, parent, parameters) {
145
167
  return parameters?.map((param) => {
146
168
  const constraintT = param.getConstraint();
147
169
  const defaultT = param.getDefault();
148
- const constraint = constraintT
149
- ? context.converter.convertType(context, constraintT)
150
- : void 0;
151
- const defaultType = defaultT
152
- ? context.converter.convertType(context, defaultT)
153
- : void 0;
154
170
  // There's no way to determine directly from a ts.TypeParameter what it's variance modifiers are
155
171
  // so unfortunately we have to go back to the node for this...
156
- const variance = getVariance(param.getSymbol()?.declarations?.find(typescript_1.default.isTypeParameterDeclaration)
172
+ const variance = getVariance(param.getSymbol()?.declarations?.find(ts.isTypeParameterDeclaration)
157
173
  ?.modifiers);
158
- const paramRefl = new models_1.TypeParameterReflection(param.symbol.name, constraint, defaultType, parent, variance);
174
+ const paramRefl = new models_1.TypeParameterReflection(param.symbol.name, parent, variance);
175
+ const paramCtx = context.withScope(paramRefl);
176
+ paramRefl.type = constraintT
177
+ ? context.converter.convertType(paramCtx, constraintT)
178
+ : void 0;
179
+ paramRefl.default = defaultT
180
+ ? context.converter.convertType(paramCtx, defaultT)
181
+ : void 0;
159
182
  context.registerReflection(paramRefl, param.getSymbol());
160
183
  context.trigger(converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER, paramRefl);
161
184
  return paramRefl;
@@ -166,15 +189,16 @@ function convertTypeParameterNodes(context, parameters) {
166
189
  }
167
190
  exports.convertTypeParameterNodes = convertTypeParameterNodes;
168
191
  function createTypeParamReflection(param, context) {
169
- const constraint = param.constraint
170
- ? context.converter.convertType(context, param.constraint)
192
+ const paramRefl = new models_1.TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
193
+ const paramScope = context.withScope(paramRefl);
194
+ paramRefl.type = param.constraint
195
+ ? context.converter.convertType(paramScope, param.constraint)
171
196
  : void 0;
172
- const defaultType = param.default
173
- ? context.converter.convertType(context, param.default)
197
+ paramRefl.default = param.default
198
+ ? context.converter.convertType(paramScope, param.default)
174
199
  : void 0;
175
- const paramRefl = new models_1.TypeParameterReflection(param.name.text, constraint, defaultType, context.scope, getVariance(param.modifiers));
176
200
  context.registerReflection(paramRefl, param.symbol);
177
- if (typescript_1.default.isJSDocTemplateTag(param.parent)) {
201
+ if (ts.isJSDocTemplateTag(param.parent)) {
178
202
  paramRefl.comment = (0, comments_1.getJsDocComment)(param.parent, context.converter.config, context.logger);
179
203
  }
180
204
  context.trigger(converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER, paramRefl, param);
@@ -182,8 +206,8 @@ function createTypeParamReflection(param, context) {
182
206
  }
183
207
  exports.createTypeParamReflection = createTypeParamReflection;
184
208
  function getVariance(modifiers) {
185
- const hasIn = modifiers?.some((mod) => mod.kind === typescript_1.default.SyntaxKind.InKeyword);
186
- const hasOut = modifiers?.some((mod) => mod.kind === typescript_1.default.SyntaxKind.OutKeyword);
209
+ const hasIn = modifiers?.some((mod) => mod.kind === ts.SyntaxKind.InKeyword);
210
+ const hasOut = modifiers?.some((mod) => mod.kind === ts.SyntaxKind.OutKeyword);
187
211
  if (hasIn && hasOut) {
188
212
  return models_1.VarianceModifier.inOut;
189
213
  }
@@ -197,23 +221,23 @@ function getVariance(modifiers) {
197
221
  function convertPredicate(predicate, context) {
198
222
  let name;
199
223
  switch (predicate.kind) {
200
- case typescript_1.default.TypePredicateKind.This:
201
- case typescript_1.default.TypePredicateKind.AssertsThis:
224
+ case ts.TypePredicateKind.This:
225
+ case ts.TypePredicateKind.AssertsThis:
202
226
  name = "this";
203
227
  break;
204
- case typescript_1.default.TypePredicateKind.Identifier:
205
- case typescript_1.default.TypePredicateKind.AssertsIdentifier:
228
+ case ts.TypePredicateKind.Identifier:
229
+ case ts.TypePredicateKind.AssertsIdentifier:
206
230
  name = predicate.parameterName;
207
231
  break;
208
232
  }
209
233
  let asserts;
210
234
  switch (predicate.kind) {
211
- case typescript_1.default.TypePredicateKind.This:
212
- case typescript_1.default.TypePredicateKind.Identifier:
235
+ case ts.TypePredicateKind.This:
236
+ case ts.TypePredicateKind.Identifier:
213
237
  asserts = false;
214
238
  break;
215
- case typescript_1.default.TypePredicateKind.AssertsThis:
216
- case typescript_1.default.TypePredicateKind.AssertsIdentifier:
239
+ case ts.TypePredicateKind.AssertsThis:
240
+ case ts.TypePredicateKind.AssertsIdentifier:
217
241
  asserts = true;
218
242
  break;
219
243
  }
@@ -1,4 +1,4 @@
1
- import ts from "typescript";
1
+ import * as ts from "typescript";
2
2
  import type { Context } from "./context";
3
3
  export declare function convertJsDocAlias(context: Context, symbol: ts.Symbol, declaration: ts.JSDocTypedefTag | ts.JSDocEnumTag, exportSymbol?: ts.Symbol): void;
4
4
  export declare function convertJsDocCallback(context: Context, symbol: ts.Symbol, declaration: ts.JSDocCallbackTag, exportSymbol?: ts.Symbol): void;
@@ -2,20 +2,41 @@
2
2
  // Converter functions for JSDoc defined types
3
3
  // @typedef
4
4
  // @callback
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
7
27
  };
8
28
  Object.defineProperty(exports, "__esModule", { value: true });
9
29
  exports.convertJsDocCallback = exports.convertJsDocAlias = void 0;
10
30
  const assert_1 = require("assert");
11
- const typescript_1 = __importDefault(require("typescript"));
31
+ const ts = __importStar(require("typescript"));
12
32
  const models_1 = require("../models");
33
+ const ReflectionSymbolId_1 = require("../models/reflections/ReflectionSymbolId");
13
34
  const comments_1 = require("./comments");
14
35
  const converter_events_1 = require("./converter-events");
15
36
  const signature_1 = require("./factories/signature");
16
37
  function convertJsDocAlias(context, symbol, declaration, exportSymbol) {
17
38
  if (declaration.typeExpression &&
18
- typescript_1.default.isJSDocTypeLiteral(declaration.typeExpression)) {
39
+ ts.isJSDocTypeLiteral(declaration.typeExpression)) {
19
40
  convertJsDocInterface(context, declaration, symbol, exportSymbol);
20
41
  return;
21
42
  }
@@ -64,6 +85,7 @@ function convertJsDocSignature(context, node) {
64
85
  context.registerReflection(reflection, symbol);
65
86
  context.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, reflection);
66
87
  const signature = new models_1.SignatureReflection("__type", models_1.ReflectionKind.CallSignature, reflection);
88
+ context.project.registerSymbolId(signature, new ReflectionSymbolId_1.ReflectionSymbolId(symbol, node));
67
89
  context.registerReflection(signature, void 0);
68
90
  const signatureCtx = context.withScope(signature);
69
91
  reflection.signatures = [signature];
@@ -74,7 +96,7 @@ function convertJsDocSignature(context, node) {
74
96
  }
75
97
  function convertTemplateParameters(context, node) {
76
98
  (0, assert_1.ok)(context.scope instanceof models_1.DeclarationReflection);
77
- context.scope.typeParameters = convertTemplateParameterNodes(context, node.tags?.filter(typescript_1.default.isJSDocTemplateTag));
99
+ context.scope.typeParameters = convertTemplateParameterNodes(context, node.tags?.filter(ts.isJSDocTemplateTag));
78
100
  }
79
101
  function convertTemplateParameterNodes(context, nodes) {
80
102
  const params = (nodes ?? []).flatMap((tag) => tag.typeParameters);
@@ -82,31 +104,31 @@ function convertTemplateParameterNodes(context, nodes) {
82
104
  }
83
105
  function getTypedefReExportTarget(context, declaration) {
84
106
  const typeExpression = declaration.typeExpression;
85
- if (!typescript_1.default.isJSDocTypedefTag(declaration) ||
107
+ if (!ts.isJSDocTypedefTag(declaration) ||
86
108
  !typeExpression ||
87
- typescript_1.default.isJSDocTypeLiteral(typeExpression) ||
88
- !typescript_1.default.isImportTypeNode(typeExpression.type) ||
109
+ ts.isJSDocTypeLiteral(typeExpression) ||
110
+ !ts.isImportTypeNode(typeExpression.type) ||
89
111
  !typeExpression.type.qualifier ||
90
- !typescript_1.default.isIdentifier(typeExpression.type.qualifier)) {
112
+ !ts.isIdentifier(typeExpression.type.qualifier)) {
91
113
  return;
92
114
  }
93
115
  const targetSymbol = context.expectSymbolAtLocation(typeExpression.type.qualifier);
94
116
  const decl = targetSymbol.declarations?.[0];
95
117
  if (!decl ||
96
- !(typescript_1.default.isTypeAliasDeclaration(decl) ||
97
- typescript_1.default.isInterfaceDeclaration(decl) ||
98
- typescript_1.default.isJSDocTypedefTag(decl) ||
99
- typescript_1.default.isJSDocCallbackTag(decl))) {
118
+ !(ts.isTypeAliasDeclaration(decl) ||
119
+ ts.isInterfaceDeclaration(decl) ||
120
+ ts.isJSDocTypedefTag(decl) ||
121
+ ts.isJSDocCallbackTag(decl))) {
100
122
  return;
101
123
  }
102
- const targetParams = typescript_1.default.getEffectiveTypeParameterDeclarations(decl);
103
- const localParams = typescript_1.default.getEffectiveTypeParameterDeclarations(declaration);
124
+ const targetParams = ts.getEffectiveTypeParameterDeclarations(decl);
125
+ const localParams = ts.getEffectiveTypeParameterDeclarations(declaration);
104
126
  const localArgs = typeExpression.type.typeArguments || [];
105
127
  // If we have type parameters, ensure they are forwarding parameters with no transformations.
106
128
  // This doesn't check constraints since they aren't checked in JSDoc types.
107
129
  if (targetParams.length !== localParams.length ||
108
- localArgs.some((arg, i) => !typescript_1.default.isTypeReferenceNode(arg) ||
109
- !typescript_1.default.isIdentifier(arg.typeName) ||
130
+ localArgs.some((arg, i) => !ts.isTypeReferenceNode(arg) ||
131
+ !ts.isIdentifier(arg.typeName) ||
110
132
  arg.typeArguments ||
111
133
  localParams[i]?.name.text !== arg.typeName.text)) {
112
134
  return;
@@ -61,8 +61,6 @@ export declare class CommentPlugin extends ConverterComponent {
61
61
  excludePrivate: boolean;
62
62
  excludeProtected: boolean;
63
63
  excludeNotDocumented: boolean;
64
- private _excludeKinds;
65
- private get excludeNotDocumentedKinds();
66
64
  /**
67
65
  * Create a new CommentPlugin instance.
68
66
  */
@@ -89,12 +89,6 @@ const NEVER_RENDERED = [
89
89
  *
90
90
  */
91
91
  let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent {
92
- get excludeNotDocumentedKinds() {
93
- this._excludeKinds ?? (this._excludeKinds = this.application.options
94
- .getValue("excludeNotDocumentedKinds")
95
- .reduce((a, b) => a | models_1.ReflectionKind[b], 0));
96
- return this._excludeKinds;
97
- }
98
92
  /**
99
93
  * Create a new CommentPlugin instance.
100
94
  */
@@ -105,9 +99,6 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
105
99
  [converter_1.Converter.EVENT_CREATE_TYPE_PARAMETER]: this.onCreateTypeParameter,
106
100
  [converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
107
101
  [converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
108
- [converter_1.Converter.EVENT_END]: () => {
109
- this._excludeKinds = undefined;
110
- },
111
102
  });
112
103
  }
113
104
  /**
@@ -261,9 +252,9 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
261
252
  */
262
253
  onResolve(context, reflection) {
263
254
  if (reflection.comment) {
264
- reflection.label = extractLabelTag(reflection.comment);
265
- if (reflection.label && !/[A-Z_][A-Z0-9_]/.test(reflection.label)) {
266
- context.logger.warn(`The label "${reflection.label}" for ${reflection.getFriendlyFullName()} cannot be referenced with a declaration reference. ` +
255
+ if (reflection.comment.label &&
256
+ !/[A-Z_][A-Z0-9_]/.test(reflection.comment.label)) {
257
+ context.logger.warn(`The label "${reflection.comment.label}" for ${reflection.getFriendlyFullName()} cannot be referenced with a declaration reference. ` +
267
258
  `Labels may only contain A-Z, 0-9, and _, and may not start with a number.`);
268
259
  }
269
260
  mergeSeeTags(reflection.comment);
@@ -344,22 +335,12 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
344
335
  return true;
345
336
  }
346
337
  if (!comment) {
347
- // We haven't moved comments from the parent for signatures without a direct
348
- // comment, so don't exclude those due to not being documented.
349
- if (reflection.kindOf(models_1.ReflectionKind.CallSignature |
350
- models_1.ReflectionKind.ConstructorSignature) &&
351
- reflection.parent?.comment) {
352
- return false;
353
- }
354
338
  if (this.excludeNotDocumented) {
355
339
  // Don't let excludeNotDocumented remove parameters.
356
340
  if (!(reflection instanceof models_1.DeclarationReflection) &&
357
341
  !(reflection instanceof models_1.SignatureReflection)) {
358
342
  return false;
359
343
  }
360
- if (!reflection.kindOf(this.excludeNotDocumentedKinds)) {
361
- return false;
362
- }
363
344
  // excludeNotDocumented should hide a module only if it has no visible children
364
345
  if (reflection.kindOf(models_1.ReflectionKind.SomeModule)) {
365
346
  if (!reflection.children) {
@@ -367,6 +348,10 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
367
348
  }
368
349
  return reflection.children.every((child) => this.isHidden(child));
369
350
  }
351
+ // enum members should all be included if the parent enum is documented
352
+ if (reflection.kind === models_1.ReflectionKind.EnumMember) {
353
+ return false;
354
+ }
370
355
  // signature containers should only be hidden if all their signatures are hidden
371
356
  if (reflection.kindOf(models_1.ReflectionKind.SignatureContainer)) {
372
357
  return reflection
@@ -445,12 +430,6 @@ function moveNestedParamTags(comment, parameter) {
445
430
  };
446
431
  parameter.type?.visit(visitor);
447
432
  }
448
- function extractLabelTag(comment) {
449
- const index = comment.summary.findIndex((part) => part.kind === "inline-tag" && part.tag === "@label");
450
- if (index !== -1) {
451
- return comment.summary.splice(index, 1)[0].text;
452
- }
453
- }
454
433
  function mergeSeeTags(comment) {
455
434
  const see = comment.getTags("@see");
456
435
  if (see.length < 2)
@@ -1,4 +1,4 @@
1
- import { ReflectionKind, DeclarationReflection } from "../../models/reflections/index";
1
+ import { DeclarationReflection } from "../../models/reflections/index";
2
2
  import { ReflectionGroup } from "../../models/ReflectionGroup";
3
3
  import { ConverterComponent } from "../components";
4
4
  /**
@@ -7,23 +7,6 @@ import { ConverterComponent } from "../components";
7
7
  * The handler sets the `groups` property of all container reflections.
8
8
  */
9
9
  export declare class GroupPlugin extends ConverterComponent {
10
- /**
11
- * Define the singular name of individual reflection kinds.
12
- */
13
- static SINGULARS: {
14
- 8: string;
15
- 16: string;
16
- };
17
- /**
18
- * Define the plural name of individual reflection kinds.
19
- */
20
- static PLURALS: {
21
- 128: string;
22
- 1024: string;
23
- 8: string;
24
- 16: string;
25
- 4194304: string;
26
- };
27
10
  sortFunction: (reflections: DeclarationReflection[]) => void;
28
11
  boosts: Record<string, number>;
29
12
  usedBoosts: Set<string>;
@@ -61,25 +44,4 @@ export declare class GroupPlugin extends ConverterComponent {
61
44
  * @returns An array containing all children of the given reflection grouped by their kind.
62
45
  */
63
46
  getReflectionGroups(reflections: DeclarationReflection[]): ReflectionGroup[];
64
- /**
65
- * Transform the internal typescript kind identifier into a human readable version.
66
- *
67
- * @param kind The original typescript kind identifier.
68
- * @returns A human readable version of the given typescript kind identifier.
69
- */
70
- private static getKindString;
71
- /**
72
- * Return the singular name of a internal typescript kind identifier.
73
- *
74
- * @param kind The original internal typescript kind identifier.
75
- * @returns The singular name of the given internal typescript kind identifier
76
- */
77
- static getKindSingular(kind: ReflectionKind): string;
78
- /**
79
- * Return the plural name of a internal typescript kind identifier.
80
- *
81
- * @param kind The original internal typescript kind identifier.
82
- * @returns The plural name of the given internal typescript kind identifier
83
- */
84
- static getKindPlural(kind: ReflectionKind): string;
85
47
  }
@@ -5,7 +5,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
- var GroupPlugin_1;
9
8
  Object.defineProperty(exports, "__esModule", { value: true });
10
9
  exports.GroupPlugin = void 0;
11
10
  const index_1 = require("../../models/reflections/index");
@@ -20,7 +19,7 @@ const models_1 = require("../../models");
20
19
  *
21
20
  * The handler sets the `groups` property of all container reflections.
22
21
  */
23
- let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.ConverterComponent {
22
+ let GroupPlugin = class GroupPlugin extends components_1.ConverterComponent {
24
23
  constructor() {
25
24
  super(...arguments);
26
25
  this.usedBoosts = new Set();
@@ -44,7 +43,6 @@ let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.Convert
44
43
  * @param reflection The reflection that is currently resolved.
45
44
  */
46
45
  onResolve(_context, reflection) {
47
- reflection.kindString = GroupPlugin_1.getKindSingular(reflection.kind);
48
46
  if (reflection instanceof index_1.ContainerReflection) {
49
47
  this.group(reflection);
50
48
  }
@@ -106,7 +104,7 @@ let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.Convert
106
104
  }
107
105
  groups.delete("");
108
106
  if (groups.size === 0) {
109
- groups.add(GroupPlugin_1.getKindPlural(reflection.kind));
107
+ groups.add(index_1.ReflectionKind.pluralString(reflection.kind));
110
108
  }
111
109
  for (const group of groups) {
112
110
  if (group in this.boosts) {
@@ -139,67 +137,11 @@ let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.Convert
139
137
  });
140
138
  return Array.from(groups.values());
141
139
  }
142
- /**
143
- * Transform the internal typescript kind identifier into a human readable version.
144
- *
145
- * @param kind The original typescript kind identifier.
146
- * @returns A human readable version of the given typescript kind identifier.
147
- */
148
- static getKindString(kind) {
149
- let str = index_1.ReflectionKind[kind];
150
- str = str.replace(/(.)([A-Z])/g, (_m, a, b) => a + " " + b.toLowerCase());
151
- return str;
152
- }
153
- /**
154
- * Return the singular name of a internal typescript kind identifier.
155
- *
156
- * @param kind The original internal typescript kind identifier.
157
- * @returns The singular name of the given internal typescript kind identifier
158
- */
159
- static getKindSingular(kind) {
160
- if (kind in GroupPlugin_1.SINGULARS) {
161
- return GroupPlugin_1.SINGULARS[kind];
162
- }
163
- else {
164
- return GroupPlugin_1.getKindString(kind);
165
- }
166
- }
167
- /**
168
- * Return the plural name of a internal typescript kind identifier.
169
- *
170
- * @param kind The original internal typescript kind identifier.
171
- * @returns The plural name of the given internal typescript kind identifier
172
- */
173
- static getKindPlural(kind) {
174
- if (kind in GroupPlugin_1.PLURALS) {
175
- return GroupPlugin_1.PLURALS[kind];
176
- }
177
- else {
178
- return this.getKindString(kind) + "s";
179
- }
180
- }
181
- };
182
- /**
183
- * Define the singular name of individual reflection kinds.
184
- */
185
- GroupPlugin.SINGULARS = {
186
- [index_1.ReflectionKind.Enum]: "Enumeration",
187
- [index_1.ReflectionKind.EnumMember]: "Enumeration Member",
188
- };
189
- /**
190
- * Define the plural name of individual reflection kinds.
191
- */
192
- GroupPlugin.PLURALS = {
193
- [index_1.ReflectionKind.Class]: "Classes",
194
- [index_1.ReflectionKind.Property]: "Properties",
195
- [index_1.ReflectionKind.Enum]: "Enumerations",
196
- [index_1.ReflectionKind.EnumMember]: "Enumeration Members",
197
- [index_1.ReflectionKind.TypeAlias]: "Type Aliases",
198
140
  };
199
141
  __decorate([
200
142
  (0, utils_1.BindOption)("searchGroupBoosts")
201
143
  ], GroupPlugin.prototype, "boosts", void 0);
202
- GroupPlugin = GroupPlugin_1 = __decorate([
144
+ GroupPlugin = __decorate([
203
145
  (0, components_1.Component)({ name: "group" })
204
146
  ], GroupPlugin);
205
147
  exports.GroupPlugin = GroupPlugin;
@@ -12,14 +12,11 @@ export declare class ImplementsPlugin extends ConverterComponent {
12
12
  initialize(): void;
13
13
  /**
14
14
  * Mark all members of the given class to be the implementation of the matching interface member.
15
- *
16
- * @param context The context object describing the current state the converter is in.
17
- * @param classReflection The reflection of the classReflection class.
18
- * @param interfaceReflection The reflection of the interfaceReflection interface.
19
15
  */
20
16
  private analyzeImplements;
21
17
  private analyzeInheritance;
22
18
  private onResolveEnd;
19
+ private resolve;
23
20
  private tryResolve;
24
21
  private doResolve;
25
22
  private getExtensionInfo;