typedoc 0.24.4 → 0.24.6

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 (36) hide show
  1. package/dist/lib/application.js +12 -5
  2. package/dist/lib/converter/comments/blockLexer.js +20 -8
  3. package/dist/lib/converter/comments/discovery.d.ts +5 -0
  4. package/dist/lib/converter/comments/discovery.js +14 -1
  5. package/dist/lib/converter/comments/index.d.ts +1 -0
  6. package/dist/lib/converter/comments/index.js +6 -1
  7. package/dist/lib/converter/comments/parser.js +17 -4
  8. package/dist/lib/converter/context.d.ts +1 -0
  9. package/dist/lib/converter/context.js +3 -0
  10. package/dist/lib/converter/converter.js +6 -2
  11. package/dist/lib/converter/plugins/GroupPlugin.d.ts +6 -0
  12. package/dist/lib/converter/plugins/GroupPlugin.js +32 -3
  13. package/dist/lib/output/themes/MarkedPlugin.js +20 -2
  14. package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
  15. package/dist/lib/output/themes/default/partials/comment.js +5 -1
  16. package/dist/lib/output/themes/default/partials/member.declaration.js +1 -1
  17. package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
  18. package/dist/lib/output/themes/default/partials/member.signature.body.js +28 -24
  19. package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -1
  20. package/dist/lib/output/themes/default/partials/navigation.js +38 -13
  21. package/dist/lib/output/themes/default/partials/type.js +1 -1
  22. package/dist/lib/output/themes/default/partials/typeParameters.js +2 -2
  23. package/dist/lib/output/themes/lib.d.ts +2 -1
  24. package/dist/lib/output/themes/lib.js +19 -4
  25. package/dist/lib/utils/entry-point.js +27 -6
  26. package/dist/lib/utils/fs.js +2 -1
  27. package/dist/lib/utils/html.d.ts +1 -0
  28. package/dist/lib/utils/html.js +12 -1
  29. package/dist/lib/utils/jsx.elements.d.ts +52 -0
  30. package/dist/lib/utils/jsx.js +2 -11
  31. package/dist/lib/utils/options/declaration.d.ts +15 -0
  32. package/dist/lib/utils/options/sources/typedoc.js +92 -57
  33. package/dist/lib/utils/package-manifest.js +6 -0
  34. package/package.json +1 -1
  35. package/static/main.js +3 -3
  36. package/static/style.css +56 -29
@@ -68,14 +68,18 @@ exports.EntryPointStrategy = {
68
68
  };
69
69
  function getEntryPoints(logger, options) {
70
70
  const entryPoints = options.getValue("entryPoints");
71
+ if (entryPoints.length === 0) {
72
+ logger.error("No entry points were provided.");
73
+ return;
74
+ }
71
75
  let result;
72
76
  const strategy = options.getValue("entryPointStrategy");
73
77
  switch (strategy) {
74
78
  case exports.EntryPointStrategy.Resolve:
75
- result = getEntryPointsForPaths(logger, expandGlobs(entryPoints), options);
79
+ result = getEntryPointsForPaths(logger, expandGlobs(entryPoints, logger), options);
76
80
  break;
77
81
  case exports.EntryPointStrategy.Expand:
78
- result = getExpandedEntryPointsForPaths(logger, expandGlobs(entryPoints), options);
82
+ result = getExpandedEntryPointsForPaths(logger, expandGlobs(entryPoints, logger), options);
79
83
  break;
80
84
  case exports.EntryPointStrategy.LegacyPackages:
81
85
  result = getEntryPointsForLegacyPackages(logger, entryPoints, options);
@@ -88,7 +92,7 @@ function getEntryPoints(logger, options) {
88
92
  (0, general_1.assertNever)(strategy);
89
93
  }
90
94
  if (result && result.length === 0) {
91
- logger.error("Unable to find any entry points. Make sure TypeDoc can find your tsconfig");
95
+ logger.error("Unable to find any entry points. See previous warnings.");
92
96
  return;
93
97
  }
94
98
  return result;
@@ -153,7 +157,10 @@ function getEntryPointsForPaths(logger, inputFiles, options, programs = getEntry
153
157
  }
154
158
  }
155
159
  }
156
- logger.warn(`The entry point ${(0, paths_1.nicePath)(fileOrDir)} does not exist or is not included in the program for your provided tsconfig.`);
160
+ const suggestion = (0, fs_1.isDir)(fileOrDir)
161
+ ? " If you wanted to include files inside this directory, set --entryPointStrategy to expand or specify a glob."
162
+ : "";
163
+ logger.warn(`The entry point ${(0, paths_1.nicePath)(fileOrDir)} is not included in the program for your provided tsconfig.${suggestion}`);
157
164
  }
158
165
  return entryPoints;
159
166
  }
@@ -161,9 +168,23 @@ function getExpandedEntryPointsForPaths(logger, inputFiles, options, programs =
161
168
  return getEntryPointsForPaths(logger, expandInputFiles(logger, inputFiles, options), options, programs);
162
169
  }
163
170
  exports.getExpandedEntryPointsForPaths = getExpandedEntryPointsForPaths;
164
- function expandGlobs(inputFiles) {
171
+ function expandGlobs(inputFiles, logger) {
165
172
  const base = (0, fs_1.deriveRootDir)(inputFiles);
166
- const result = inputFiles.flatMap((entry) => (0, fs_1.glob)(entry, base, { includeDirectories: true, followSymlinks: true }));
173
+ const result = inputFiles.flatMap((entry) => {
174
+ const result = (0, fs_1.glob)(entry, base, {
175
+ includeDirectories: true,
176
+ followSymlinks: true,
177
+ });
178
+ if (result.length === 0) {
179
+ logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(entry)} did not match any files.`);
180
+ }
181
+ else {
182
+ logger.verbose(`Expanded ${(0, paths_1.nicePath)(entry)} to:\n\t${result
183
+ .map(paths_1.nicePath)
184
+ .join("\n\t")}`);
185
+ }
186
+ return result;
187
+ });
167
188
  return result;
168
189
  }
169
190
  function getEntryPrograms(logger, options) {
@@ -77,7 +77,8 @@ function getCommonDirectory(files) {
77
77
  return roots[0].slice(0, -1).join("/");
78
78
  }
79
79
  let i = 0;
80
- while (new Set(roots.map((part) => part[i])).size === 1) {
80
+ while (i < roots[0].length &&
81
+ new Set(roots.map((part) => part[i])).size === 1) {
81
82
  i++;
82
83
  }
83
84
  return roots[0].slice(0, i).join("/");
@@ -1 +1,2 @@
1
1
  export declare function getTextContent(text: string): string;
2
+ export declare function escapeHtml(html: string): string;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getTextContent = void 0;
6
+ exports.escapeHtml = exports.getTextContent = void 0;
7
7
  // There is a fixed list of named character references which will not be expanded in the future.
8
8
  // This json file is based on https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
9
9
  // with some modifications to reduce the file size of the original JSON since we just need.
@@ -26,3 +26,14 @@ function getTextContent(text) {
26
26
  return unescapeEntities(text.replace(/<.*?(?:>|$)/g, ""));
27
27
  }
28
28
  exports.getTextContent = getTextContent;
29
+ const htmlEscapes = {
30
+ "&": "&amp;",
31
+ "<": "&lt;",
32
+ ">": "&gt;",
33
+ '"': "&quot;",
34
+ "'": "&#39;",
35
+ };
36
+ function escapeHtml(html) {
37
+ return html.replace(/[&<>'"]/g, (c) => htmlEscapes[c]);
38
+ }
39
+ exports.escapeHtml = escapeHtml;
@@ -112,8 +112,13 @@ export interface IntrinsicElements {
112
112
  video: JsxVideoElementProps;
113
113
  wbr: JsxHtmlGlobalProps;
114
114
  svg: JsxSvgElementProps;
115
+ g: JsxGElementProps;
115
116
  path: JsxPathElementProps;
116
117
  rect: JsxRectElementProps;
118
+ circle: JsxCircleElementProps;
119
+ ellipse: JsxEllipseElementProps;
120
+ polygon: JsxPolygonElementProps;
121
+ polyline: JsxPolylineElementProps;
117
122
  use: JsxUseElementProps;
118
123
  }
119
124
  export declare const JsxFragment: unique symbol;
@@ -810,6 +815,13 @@ export interface JsxSvgElementProps extends JsxSvgCoreProps, JsxSvgStyleProps, J
810
815
  x?: string | number;
811
816
  y?: string | number;
812
817
  }
818
+ /**
819
+ * Properties permitted on the `<g>` element.
820
+ *
821
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g
822
+ */
823
+ export interface JsxGElementProps extends JsxSvgCoreProps, JsxSvgStyleProps, JsxSvgConditionalProcessingProps, JsxSvgPresentationProps {
824
+ }
813
825
  /**
814
826
  * Properties permitted on the `<path>` element.
815
827
  *
@@ -833,6 +845,46 @@ export interface JsxRectElementProps extends JsxSvgCoreProps, JsxSvgStyleProps,
833
845
  x?: string | number;
834
846
  y?: string | number;
835
847
  }
848
+ /**
849
+ * Properties permitted on the `<circle>` element.
850
+ *
851
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/circle
852
+ */
853
+ export interface JsxCircleElementProps extends JsxSvgCoreProps, JsxSvgStyleProps, JsxSvgConditionalProcessingProps, JsxSvgPresentationProps {
854
+ cx?: string | number;
855
+ cy?: string | number;
856
+ r?: string | number;
857
+ pathLength?: number;
858
+ }
859
+ /**
860
+ * Properties permitted on the `<ellipse>` element.
861
+ *
862
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/ellipse
863
+ */
864
+ export interface JsxEllipseElementProps extends JsxSvgCoreProps, JsxSvgStyleProps, JsxSvgConditionalProcessingProps, JsxSvgPresentationProps {
865
+ cx?: string | number;
866
+ cy?: string | number;
867
+ rx?: string | number;
868
+ ry?: string | number;
869
+ pathLength?: number;
870
+ }
871
+ /**
872
+ * Properties permitted on the `<polygon>` element.
873
+ *
874
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polygon
875
+ */
876
+ export interface JsxPolygonElementProps extends JsxSvgCoreProps, JsxSvgStyleProps, JsxSvgConditionalProcessingProps, JsxSvgPresentationProps {
877
+ points?: string;
878
+ pathLength?: number;
879
+ }
880
+ /** Properties permitted on the `<polyline>` element.
881
+ *
882
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polyline
883
+ */
884
+ export interface JsxPolylineElementProps extends JsxSvgCoreProps, JsxSvgStyleProps, JsxSvgConditionalProcessingProps, JsxSvgPresentationProps {
885
+ points?: string;
886
+ pathLength?: number;
887
+ }
836
888
  /**
837
889
  * Properties permitted on the `<use>` element.
838
890
  *
@@ -15,6 +15,7 @@
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.renderElement = exports.createElement = exports.Raw = exports.Fragment = void 0;
18
+ const html_1 = require("./html");
18
19
  const jsx_elements_1 = require("./jsx.elements");
19
20
  var jsx_elements_2 = require("./jsx.elements");
20
21
  Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return jsx_elements_2.JsxFragment; } });
@@ -28,16 +29,6 @@ function Raw(_props) {
28
29
  return null;
29
30
  }
30
31
  exports.Raw = Raw;
31
- const htmlEscapes = {
32
- "&": "&amp;",
33
- "<": "&lt;",
34
- ">": "&gt;",
35
- '"': "&quot;",
36
- "'": "&#39;",
37
- };
38
- function escapeHtml(html) {
39
- return html.replace(/[&<>'"]/g, (c) => htmlEscapes[c]);
40
- }
41
32
  const voidElements = new Set([
42
33
  "area",
43
34
  "base",
@@ -139,7 +130,7 @@ function renderElement(element) {
139
130
  renderChildren(child);
140
131
  }
141
132
  else if (typeof child === "string" || typeof child === "number") {
142
- html.push(escapeHtml(child.toString()));
133
+ html.push((0, html_1.escapeHtml)(child.toString()));
143
134
  }
144
135
  else {
145
136
  html.push(renderElement(child));
@@ -100,6 +100,10 @@ export interface TypeDocOptionMap {
100
100
  titleLink: string;
101
101
  navigationLinks: ManuallyValidatedOption<Record<string, string>>;
102
102
  sidebarLinks: ManuallyValidatedOption<Record<string, string>>;
103
+ navigation: {
104
+ includeCategories: boolean;
105
+ includeGroups: boolean;
106
+ };
103
107
  visibilityFilters: ManuallyValidatedOption<{
104
108
  protected?: boolean;
105
109
  private?: boolean;
@@ -122,6 +126,7 @@ export interface TypeDocOptionMap {
122
126
  categorizeByGroup: boolean;
123
127
  defaultCategory: string;
124
128
  categoryOrder: string[];
129
+ groupOrder: string[];
125
130
  sort: SortStrategy[];
126
131
  kindSortOrder: ReflectionKind.KindString[];
127
132
  treatWarningsAsErrors: boolean;
@@ -170,6 +175,16 @@ export type JsDocCompatibility = {
170
175
  * On by default, this is how VSCode renders blocks.
171
176
  */
172
177
  defaultTag: boolean;
178
+ /**
179
+ * If set, TypeDoc will warn if a `@inheritDoc` tag is spelled without TSDoc capitalization
180
+ * (i.e. `@inheritdoc`). On by default.
181
+ */
182
+ inheritDocTag: boolean;
183
+ /**
184
+ * If set, TypeDoc will not emit warnings about unescaped `{` and `}` characters encountered
185
+ * when parsing a comment. On by default.
186
+ */
187
+ ignoreUnescapedBraces: boolean;
173
188
  };
174
189
  /**
175
190
  * Converts a given TypeDoc option key to the type of the declaration expected.
@@ -407,6 +407,71 @@ function addTypeDocOptions(options) {
407
407
  }
408
408
  },
409
409
  });
410
+ options.addDeclaration({
411
+ name: "navigation",
412
+ help: "Determines how the navigation sidebar is organized.",
413
+ type: declaration_1.ParameterType.Flags,
414
+ defaults: {
415
+ includeCategories: false,
416
+ includeGroups: false,
417
+ },
418
+ });
419
+ options.addDeclaration({
420
+ name: "visibilityFilters",
421
+ help: "Specify the default visibility for builtin filters and additional filters according to modifier tags.",
422
+ type: declaration_1.ParameterType.Mixed,
423
+ configFileOnly: true,
424
+ defaultValue: {
425
+ protected: false,
426
+ private: false,
427
+ inherited: true,
428
+ external: false,
429
+ },
430
+ validate(value) {
431
+ const knownKeys = ["protected", "private", "inherited", "external"];
432
+ if (!value || typeof value !== "object") {
433
+ throw new Error("visibilityFilters must be an object.");
434
+ }
435
+ for (const [key, val] of Object.entries(value)) {
436
+ if (!key.startsWith("@") && !knownKeys.includes(key)) {
437
+ throw new Error(`visibilityFilters can only include the following non-@ keys: ${knownKeys.join(", ")}`);
438
+ }
439
+ if (typeof val !== "boolean") {
440
+ throw new Error(`All values of visibilityFilters must be booleans.`);
441
+ }
442
+ }
443
+ },
444
+ });
445
+ options.addDeclaration({
446
+ name: "searchCategoryBoosts",
447
+ help: "Configure search to give a relevance boost to selected categories",
448
+ type: declaration_1.ParameterType.Mixed,
449
+ configFileOnly: true,
450
+ defaultValue: {},
451
+ validate(value) {
452
+ if (!isObject(value)) {
453
+ throw new Error("The 'searchCategoryBoosts' option must be a non-array object.");
454
+ }
455
+ if (Object.values(value).some((x) => typeof x !== "number")) {
456
+ throw new Error("All values of 'searchCategoryBoosts' must be numbers.");
457
+ }
458
+ },
459
+ });
460
+ options.addDeclaration({
461
+ name: "searchGroupBoosts",
462
+ help: 'Configure search to give a relevance boost to selected kinds (eg "class")',
463
+ type: declaration_1.ParameterType.Mixed,
464
+ configFileOnly: true,
465
+ defaultValue: {},
466
+ validate(value) {
467
+ if (!isObject(value)) {
468
+ throw new Error("The 'searchGroupBoosts' option must be a non-array object.");
469
+ }
470
+ if (Object.values(value).some((x) => typeof x !== "number")) {
471
+ throw new Error("All values of 'searchGroupBoosts' must be numbers.");
472
+ }
473
+ },
474
+ });
410
475
  ///////////////////////////
411
476
  ///// Comment Options /////
412
477
  ///////////////////////////
@@ -417,6 +482,8 @@ function addTypeDocOptions(options) {
417
482
  defaults: {
418
483
  defaultTag: true,
419
484
  exampleTag: true,
485
+ inheritDocTag: true,
486
+ ignoreUnescapedBraces: true,
420
487
  },
421
488
  });
422
489
  options.addDeclaration({
@@ -472,7 +539,7 @@ function addTypeDocOptions(options) {
472
539
  name: "categorizeByGroup",
473
540
  help: "Specify whether categorization will be done at the group level.",
474
541
  type: declaration_1.ParameterType.Boolean,
475
- defaultValue: true,
542
+ defaultValue: true, // 0.25, change this to false.
476
543
  });
477
544
  options.addDeclaration({
478
545
  name: "defaultCategory",
@@ -484,6 +551,30 @@ function addTypeDocOptions(options) {
484
551
  help: "Specify the order in which categories appear. * indicates the relative order for categories not in the list.",
485
552
  type: declaration_1.ParameterType.Array,
486
553
  });
554
+ options.addDeclaration({
555
+ name: "groupOrder",
556
+ help: "Specify the order in which groups appear. * indicates the relative order for groups not in the list.",
557
+ type: declaration_1.ParameterType.Array,
558
+ // Defaults to the same as the defaultKindSortOrder in sort.ts
559
+ defaultValue: [
560
+ kind_1.ReflectionKind.Reference,
561
+ // project is never a child so never added to a group
562
+ kind_1.ReflectionKind.Module,
563
+ kind_1.ReflectionKind.Namespace,
564
+ kind_1.ReflectionKind.Enum,
565
+ kind_1.ReflectionKind.EnumMember,
566
+ kind_1.ReflectionKind.Class,
567
+ kind_1.ReflectionKind.Interface,
568
+ kind_1.ReflectionKind.TypeAlias,
569
+ kind_1.ReflectionKind.Constructor,
570
+ kind_1.ReflectionKind.Property,
571
+ kind_1.ReflectionKind.Variable,
572
+ kind_1.ReflectionKind.Function,
573
+ kind_1.ReflectionKind.Accessor,
574
+ kind_1.ReflectionKind.Method,
575
+ // others are never added to groups
576
+ ].map(kind_1.ReflectionKind.pluralString),
577
+ });
487
578
  options.addDeclaration({
488
579
  name: "sort",
489
580
  help: "Specify the sort strategy for documented values.",
@@ -515,62 +606,6 @@ function addTypeDocOptions(options) {
515
606
  }
516
607
  },
517
608
  });
518
- options.addDeclaration({
519
- name: "visibilityFilters",
520
- help: "Specify the default visibility for builtin filters and additional filters according to modifier tags.",
521
- type: declaration_1.ParameterType.Mixed,
522
- configFileOnly: true,
523
- defaultValue: {
524
- protected: false,
525
- private: false,
526
- inherited: true,
527
- external: false,
528
- },
529
- validate(value) {
530
- const knownKeys = ["protected", "private", "inherited", "external"];
531
- if (!value || typeof value !== "object") {
532
- throw new Error("visibilityFilters must be an object.");
533
- }
534
- for (const [key, val] of Object.entries(value)) {
535
- if (!key.startsWith("@") && !knownKeys.includes(key)) {
536
- throw new Error(`visibilityFilters can only include the following non-@ keys: ${knownKeys.join(", ")}`);
537
- }
538
- if (typeof val !== "boolean") {
539
- throw new Error(`All values of visibilityFilters must be booleans.`);
540
- }
541
- }
542
- },
543
- });
544
- options.addDeclaration({
545
- name: "searchCategoryBoosts",
546
- help: "Configure search to give a relevance boost to selected categories",
547
- type: declaration_1.ParameterType.Mixed,
548
- configFileOnly: true,
549
- defaultValue: {},
550
- validate(value) {
551
- if (!isObject(value)) {
552
- throw new Error("The 'searchCategoryBoosts' option must be a non-array object.");
553
- }
554
- if (Object.values(value).some((x) => typeof x !== "number")) {
555
- throw new Error("All values of 'searchCategoryBoosts' must be numbers.");
556
- }
557
- },
558
- });
559
- options.addDeclaration({
560
- name: "searchGroupBoosts",
561
- help: 'Configure search to give a relevance boost to selected kinds (eg "class")',
562
- type: declaration_1.ParameterType.Mixed,
563
- configFileOnly: true,
564
- defaultValue: {},
565
- validate(value) {
566
- if (!isObject(value)) {
567
- throw new Error("The 'searchGroupBoosts' option must be a non-array object.");
568
- }
569
- if (Object.values(value).some((x) => typeof x !== "number")) {
570
- throw new Error("All values of 'searchGroupBoosts' must be numbers.");
571
- }
572
- },
573
- });
574
609
  ///////////////////////////
575
610
  ///// General Options /////
576
611
  ///////////////////////////
@@ -88,6 +88,12 @@ function expandPackages(logger, packageJsonDir, workspaces, exclude) {
88
88
  // as it actually is simpler from an implementation perspective anyway.
89
89
  return workspaces.flatMap((workspace) => {
90
90
  const globbedPackageJsonPaths = (0, fs_2.glob)((0, path_1.resolve)(packageJsonDir, workspace, "package.json"), (0, path_1.resolve)(packageJsonDir));
91
+ if (globbedPackageJsonPaths.length === 0) {
92
+ logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(workspace)} did not match any directories containing package.json.`);
93
+ }
94
+ else {
95
+ logger.verbose(`Expanded ${(0, paths_1.nicePath)(workspace)} to:\n\t${globbedPackageJsonPaths.map(paths_1.nicePath).join("\n\t")}`);
96
+ }
91
97
  return globbedPackageJsonPaths.flatMap((packageJsonPath) => {
92
98
  if ((0, paths_1.matchesAny)(exclude, (0, path_1.dirname)(packageJsonPath))) {
93
99
  return [];
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.24.4",
4
+ "version": "0.24.6",
5
5
  "homepage": "https://typedoc.org",
6
6
  "exports": {
7
7
  ".": "./dist/index.js",