typedoc 0.23.27 → 0.23.28

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.
@@ -9,6 +9,7 @@ const models_1 = require("../../models");
9
9
  const utils_1 = require("../../utils");
10
10
  const declaration_1 = require("../../utils/options/declaration");
11
11
  const paths_1 = require("../../utils/paths");
12
+ const assert_1 = require("assert");
12
13
  // Note: This does NOT include JSDoc syntax kinds. This is important!
13
14
  // Comments from @typedef and @callback tags are handled specially by
14
15
  // the JSDoc converter because we only want part of the comment when
@@ -147,6 +148,20 @@ function discoverSignatureComment(declaration, commentStyle) {
147
148
  if (!node) {
148
149
  return;
149
150
  }
151
+ if (typescript_1.default.isJSDocSignature(node)) {
152
+ const comment = node.parent.parent;
153
+ (0, assert_1.ok)(typescript_1.default.isJSDoc(comment));
154
+ return [
155
+ node.getSourceFile(),
156
+ [
157
+ {
158
+ kind: typescript_1.default.SyntaxKind.MultiLineCommentTrivia,
159
+ pos: comment.pos,
160
+ end: comment.end,
161
+ },
162
+ ],
163
+ ];
164
+ }
150
165
  const text = node.getSourceFile().text;
151
166
  const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
152
167
  comments.reverse();
@@ -46,7 +46,7 @@ export declare class Context {
46
46
  */
47
47
  constructor(converter: Converter, programs: readonly ts.Program[], project: ProjectReflection, scope?: Context["scope"]);
48
48
  /** @internal */
49
- get logger(): import("../utils/loggers").Logger;
49
+ get logger(): import("../utils").Logger;
50
50
  /**
51
51
  * Return the compiler options.
52
52
  */
@@ -153,9 +153,15 @@ function convertTypeParameters(context, parent, parameters) {
153
153
  : void 0;
154
154
  // There's no way to determine directly from a ts.TypeParameter what it's variance modifiers are
155
155
  // so unfortunately we have to go back to the node for this...
156
- const variance = getVariance(param.getSymbol()?.declarations?.find(typescript_1.default.isTypeParameterDeclaration)
157
- ?.modifiers);
156
+ const declaration = param
157
+ .getSymbol()
158
+ ?.declarations?.find(typescript_1.default.isTypeParameterDeclaration);
159
+ const variance = getVariance(declaration?.modifiers);
158
160
  const paramRefl = new models_1.TypeParameterReflection(param.symbol.name, constraint, defaultType, parent, variance);
161
+ // No way to determine this from the type parameter itself, need to go back to the declaration
162
+ if (declaration?.modifiers?.some((m) => m.kind === typescript_1.default.SyntaxKind.ConstKeyword)) {
163
+ paramRefl.flags.setFlag(models_1.ReflectionFlag.Const, true);
164
+ }
159
165
  context.registerReflection(paramRefl, param.getSymbol());
160
166
  context.trigger(converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER, paramRefl);
161
167
  return paramRefl;
@@ -173,6 +179,9 @@ function createTypeParamReflection(param, context) {
173
179
  ? context.converter.convertType(context, param.default)
174
180
  : void 0;
175
181
  const paramRefl = new models_1.TypeParameterReflection(param.name.text, constraint, defaultType, context.scope, getVariance(param.modifiers));
182
+ if (param.modifiers?.some((m) => m.kind === typescript_1.default.SyntaxKind.ConstKeyword)) {
183
+ paramRefl.flags.setFlag(models_1.ReflectionFlag.Const, true);
184
+ }
176
185
  context.registerReflection(paramRefl, param.symbol);
177
186
  if (typescript_1.default.isJSDocTemplateTag(param.parent)) {
178
187
  paramRefl.comment = (0, comments_1.getJsDocComment)(param.parent, context.converter.config, context.logger);
@@ -243,8 +243,8 @@ function convertFunctionOrMethod(context, symbol, exportSymbol) {
243
243
  const scope = context.withScope(reflection);
244
244
  // Can't use zip here. We might have less declarations than signatures
245
245
  // or less signatures than declarations.
246
- for (let i = 0; i < signatures.length; i++) {
247
- (0, signature_1.createSignature)(scope, models_1.ReflectionKind.CallSignature, signatures[i], declarations[i]);
246
+ for (const sig of signatures) {
247
+ (0, signature_1.createSignature)(scope, models_1.ReflectionKind.CallSignature, sig);
248
248
  }
249
249
  }
250
250
  // getDeclaredTypeOfSymbol gets the INSTANCE type
@@ -546,8 +546,9 @@ function setModifiers(symbol, declaration, reflection) {
546
546
  reflection.setFlag(models_1.ReflectionFlag.Public);
547
547
  }
548
548
  reflection.setFlag(models_1.ReflectionFlag.Optional, (0, enum_1.hasAllFlags)(symbol.flags, typescript_1.default.SymbolFlags.Optional));
549
- reflection.setFlag(models_1.ReflectionFlag.Readonly, (0, enum_1.hasAllFlags)(symbol.checkFlags ?? 0, typescript_1.default.CheckFlags.Readonly) ||
550
- (0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Readonly));
549
+ reflection.setFlag(models_1.ReflectionFlag.Readonly, (0, enum_1.hasAllFlags)(
550
+ // TS 4.9: symbol.checkFlags, links was introduced in 5.0
551
+ symbol.checkFlags ?? symbol.links?.checkFlags ?? 0, typescript_1.default.CheckFlags.Readonly) || (0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Readonly));
551
552
  reflection.setFlag(models_1.ReflectionFlag.Abstract, (0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Abstract));
552
553
  if (reflection.kindOf(models_1.ReflectionKind.Variable) &&
553
554
  (0, enum_1.hasAllFlags)(symbol.flags, typescript_1.default.SymbolFlags.BlockScopedVariable)) {
@@ -172,7 +172,6 @@ class ReflectionFlags extends Array {
172
172
  .map((flag) => [flag, true]));
173
173
  }
174
174
  }
175
- exports.ReflectionFlags = ReflectionFlags;
176
175
  ReflectionFlags.serializedFlags = [
177
176
  "isPrivate",
178
177
  "isProtected",
@@ -186,6 +185,7 @@ ReflectionFlags.serializedFlags = [
186
185
  "isConst",
187
186
  "isReadonly",
188
187
  ];
188
+ exports.ReflectionFlags = ReflectionFlags;
189
189
  var TraverseProperty;
190
190
  (function (TraverseProperty) {
191
191
  TraverseProperty[TraverseProperty["Children"] = 0] = "Children";
@@ -56,7 +56,6 @@ class RendererEvent extends events_1.Event {
56
56
  return event;
57
57
  }
58
58
  }
59
- exports.RendererEvent = RendererEvent;
60
59
  /**
61
60
  * Triggered before the renderer starts rendering a project.
62
61
  * @event
@@ -67,6 +66,7 @@ RendererEvent.BEGIN = "beginRender";
67
66
  * @event
68
67
  */
69
68
  RendererEvent.END = "endRender";
69
+ exports.RendererEvent = RendererEvent;
70
70
  /**
71
71
  * An event emitted by the {@link Renderer} class before and after the
72
72
  * markup of a page is rendered.
@@ -76,7 +76,6 @@ RendererEvent.END = "endRender";
76
76
  */
77
77
  class PageEvent extends events_1.Event {
78
78
  }
79
- exports.PageEvent = PageEvent;
80
79
  /**
81
80
  * Triggered before a document will be rendered.
82
81
  * @event
@@ -87,6 +86,7 @@ PageEvent.BEGIN = "beginPage";
87
86
  * @event
88
87
  */
89
88
  PageEvent.END = "endPage";
89
+ exports.PageEvent = PageEvent;
90
90
  /**
91
91
  * An event emitted when markdown is being parsed. Allows other plugins to manipulate the result.
92
92
  *
@@ -99,12 +99,12 @@ class MarkdownEvent extends events_1.Event {
99
99
  this.parsedText = parsedText;
100
100
  }
101
101
  }
102
- exports.MarkdownEvent = MarkdownEvent;
103
102
  /**
104
103
  * Triggered on the renderer when this plugin parses a markdown string.
105
104
  * @event
106
105
  */
107
106
  MarkdownEvent.PARSE = "parseMarkdown";
107
+ exports.MarkdownEvent = MarkdownEvent;
108
108
  /**
109
109
  * An event emitted when the search index is being prepared.
110
110
  */
@@ -136,9 +136,9 @@ class IndexEvent extends events_1.Event {
136
136
  this.searchFields = Array.from({ length: this.searchResults.length }, () => ({}));
137
137
  }
138
138
  }
139
- exports.IndexEvent = IndexEvent;
140
139
  /**
141
140
  * Triggered on the renderer when the search index is being prepared.
142
141
  * @event
143
142
  */
144
143
  IndexEvent.PREPARE_INDEX = "prepareIndex";
144
+ exports.IndexEvent = IndexEvent;
@@ -253,8 +253,8 @@ class DefaultTheme extends theme_1.Theme {
253
253
  return str.replace(/(\w)([A-Z])/g, (_m, m1, m2) => m1 + "-" + m2).toLowerCase();
254
254
  }
255
255
  }
256
- exports.DefaultTheme = DefaultTheme;
257
256
  DefaultTheme.URL_PREFIX = /^(http|ftp)s?:\/\//;
257
+ exports.DefaultTheme = DefaultTheme;
258
258
  function hasReadme(readme) {
259
259
  return !readme.endsWith("none");
260
260
  }
@@ -8,6 +8,7 @@ function typeParameters(context, typeParameters) {
8
8
  utils_1.JSX.createElement("h4", null, "Type Parameters"),
9
9
  utils_1.JSX.createElement("ul", { class: "tsd-type-parameters" }, typeParameters?.map((item) => (utils_1.JSX.createElement("li", null,
10
10
  utils_1.JSX.createElement("h4", null,
11
+ item.flags.isConst && "const ",
11
12
  item.varianceModifier ? `${item.varianceModifier} ` : "",
12
13
  item.name,
13
14
  !!item.type && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
@@ -73,6 +73,7 @@ function renderTypeParametersSignature(typeParameters) {
73
73
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null, !!typeParameters && typeParameters.length > 0 && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
74
74
  utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
75
75
  join(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), typeParameters, (item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
76
+ item.flags.isConst && "const ",
76
77
  item.varianceModifier ? `${item.varianceModifier} ` : "",
77
78
  utils_1.JSX.createElement("span", { class: "tsd-signature-type", "data-tsd-kind": item.kindString }, item.name)))),
78
79
  utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ">")))));
@@ -52,7 +52,6 @@ class Serializer extends utils_1.EventDispatcher {
52
52
  return project;
53
53
  }
54
54
  }
55
- exports.Serializer = Serializer;
56
55
  /**
57
56
  * Triggered when the {@link Serializer} begins transforming a project.
58
57
  * @event EVENT_BEGIN
@@ -63,3 +62,4 @@ Serializer.EVENT_BEGIN = "begin";
63
62
  * @event EVENT_END
64
63
  */
65
64
  Serializer.EVENT_END = "end";
65
+ exports.Serializer = Serializer;
@@ -49,9 +49,9 @@ class ComponentEvent extends events_1.Event {
49
49
  this.component = component;
50
50
  }
51
51
  }
52
- exports.ComponentEvent = ComponentEvent;
53
52
  ComponentEvent.ADDED = "componentAdded";
54
53
  ComponentEvent.REMOVED = "componentRemoved";
54
+ exports.ComponentEvent = ComponentEvent;
55
55
  /**
56
56
  * Component base class. Has an owner (unless it's the application root component),
57
57
  * can dispatch events to its children, and has access to the root Application component.
@@ -291,12 +291,12 @@ function getEntryPointsForPackages(logger, packageGlobPaths, options) {
291
291
  logger.error(`Entry point "${packageEntryPoint}" does not appear to be built by/included in the tsconfig found at "${tsconfigFile}"`);
292
292
  return;
293
293
  }
294
+ const packageName = packageJson["name"];
294
295
  if (includeVersion && !(0, validation_1.validate)({ version: String }, packageJson)) {
295
296
  logger.warn(`--includeVersion was specified, but "${(0, paths_1.nicePath)(packageJsonPath)}" does not properly specify a version.`);
296
297
  }
297
298
  results.push({
298
- displayName: typedocPackageConfig?.displayName ??
299
- packageJson["name"],
299
+ displayName: typedocPackageConfig?.displayName ?? packageName,
300
300
  version: includeVersion
301
301
  ? packageJson["version"]
302
302
  : void 0,
@@ -288,7 +288,12 @@ function addTypeDocOptions(options) {
288
288
  name: "excludeTags",
289
289
  help: "Remove the listed block/modifier tags from doc comments.",
290
290
  type: declaration_1.ParameterType.Array,
291
- defaultValue: ["@override", "@virtual", "@privateRemarks"],
291
+ defaultValue: [
292
+ "@override",
293
+ "@virtual",
294
+ "@privateRemarks",
295
+ "@satisfies",
296
+ ],
292
297
  validate(value) {
293
298
  if (!Validation.validate([Array, Validation.isTagString], value)) {
294
299
  throw new Error(`excludeTags must be an array of valid tag names.`);
@@ -1,6 +1,6 @@
1
1
  export declare const tsdocBlockTags: readonly ["@deprecated", "@param", "@remarks", "@returns", "@throws", "@privateRemarks", "@defaultValue", "@typeParam"];
2
- export declare const blockTags: readonly ["@deprecated", "@param", "@remarks", "@returns", "@throws", "@privateRemarks", "@defaultValue", "@typeParam", "@module", "@inheritDoc", "@group", "@category", "@template", "@type", "@typedef", "@callback", "@prop", "@property"];
2
+ export declare const blockTags: readonly ["@deprecated", "@param", "@remarks", "@returns", "@throws", "@privateRemarks", "@defaultValue", "@typeParam", "@module", "@inheritDoc", "@group", "@category", "@template", "@type", "@typedef", "@callback", "@prop", "@property", "@satisfies"];
3
3
  export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
4
4
  export declare const inlineTags: string[];
5
5
  export declare const tsdocModifierTags: readonly ["@public", "@private", "@protected", "@internal", "@readonly", "@packageDocumentation", "@eventProperty", "@alpha", "@beta", "@experimental", "@sealed", "@override", "@virtual"];
6
- export declare const modifierTags: readonly ["@public", "@private", "@protected", "@internal", "@readonly", "@packageDocumentation", "@eventProperty", "@alpha", "@beta", "@experimental", "@sealed", "@override", "@virtual", "@hidden", "@ignore", "@enum", "@event"];
6
+ export declare const modifierTags: readonly ["@public", "@private", "@protected", "@internal", "@readonly", "@packageDocumentation", "@eventProperty", "@alpha", "@beta", "@experimental", "@sealed", "@override", "@virtual", "@hidden", "@ignore", "@enum", "@event", "@overload"];
@@ -26,6 +26,7 @@ exports.blockTags = [
26
26
  "@callback",
27
27
  "@prop",
28
28
  "@property",
29
+ "@satisfies",
29
30
  ];
30
31
  exports.tsdocInlineTags = ["@link", "@inheritDoc", "@label"];
31
32
  exports.inlineTags = [...exports.tsdocInlineTags, "@linkcode", "@linkplain"];
@@ -50,4 +51,5 @@ exports.modifierTags = [
50
51
  "@ignore",
51
52
  "@enum",
52
53
  "@event",
54
+ "@overload",
53
55
  ];
@@ -44,13 +44,13 @@ function extractTypedocConfigFromPackageManifest(logger, packageJsonPath) {
44
44
  return undefined;
45
45
  }
46
46
  if (hasOwnProperty(packageJson, "typedoc") &&
47
- typeof packageJson.typedoc == "object" &&
48
- packageJson.typedoc) {
49
- if (!(0, validation_1.validate)(typedocPackageManifestConfigSchema, packageJson.typedoc)) {
47
+ typeof packageJson["typedoc"] == "object" &&
48
+ packageJson["typedoc"]) {
49
+ if (!(0, validation_1.validate)(typedocPackageManifestConfigSchema, packageJson["typedoc"])) {
50
50
  logger.error(`Typedoc config extracted from package manifest file ${packageJsonPath} is not valid`);
51
51
  return undefined;
52
52
  }
53
- return packageJson.typedoc;
53
+ return packageJson["typedoc"];
54
54
  }
55
55
  return undefined;
56
56
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typedoc",
3
3
  "description": "Create api documentation for TypeScript projects.",
4
- "version": "0.23.27",
4
+ "version": "0.23.28",
5
5
  "homepage": "https://typedoc.org",
6
6
  "main": "./dist/index.js",
7
7
  "exports": {
@@ -31,24 +31,24 @@
31
31
  "shiki": "^0.14.1"
32
32
  },
33
33
  "peerDependencies": {
34
- "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x"
34
+ "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/lunr": "^2.3.4",
38
38
  "@types/marked": "^4.0.8",
39
39
  "@types/mocha": "^10.0.1",
40
40
  "@types/node": "14",
41
- "@typescript-eslint/eslint-plugin": "^5.51.0",
42
- "@typescript-eslint/parser": "^5.51.0",
41
+ "@typescript-eslint/eslint-plugin": "^5.55.0",
42
+ "@typescript-eslint/parser": "^5.55.0",
43
43
  "@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#5a9486bc66f6e36988106685768396281f6cbc10",
44
- "c8": "^7.12.0",
45
- "esbuild": "^0.17.7",
46
- "eslint": "^8.34.0",
44
+ "c8": "^7.13.0",
45
+ "esbuild": "^0.17.12",
46
+ "eslint": "^8.36.0",
47
47
  "mocha": "^10.2.0",
48
48
  "prettier": "2.8.4",
49
49
  "puppeteer": "^13.5.2",
50
50
  "ts-node": "^10.9.1",
51
- "typescript": "4.9.5"
51
+ "typescript": "5.0.2"
52
52
  },
53
53
  "files": [
54
54
  "/bin",
package/tsdoc.json CHANGED
@@ -74,6 +74,14 @@
74
74
  {
75
75
  "tagName": "@protected",
76
76
  "syntaxKind": "modifier"
77
+ },
78
+ {
79
+ "tagName": "@satisfies",
80
+ "syntaxKind": "block"
81
+ },
82
+ {
83
+ "tagName": "@overload",
84
+ "syntaxKind": "modifier"
77
85
  }
78
86
  ]
79
87
  }