umberto 2.2.0 → 2.3.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 (198) hide show
  1. package/.eslintrc.js +4 -3
  2. package/LICENSE.md +1 -1
  3. package/hexo-shim.js +1 -1
  4. package/package.json +6 -2
  5. package/scripts/filter/after-post-render/basepath-replacer.js +1 -1
  6. package/scripts/filter/after-post-render/fix-code-samples.js +1 -1
  7. package/scripts/filter/after-post-render/gather-guides.js +1 -1
  8. package/scripts/filter/after-post-render/img-linker.js +1 -1
  9. package/scripts/filter/after-post-render/import-guide.js +1 -1
  10. package/scripts/filter/after-post-render/insert-error-codes.js +4 -2
  11. package/scripts/filter/after-post-render/linker.js +1 -1
  12. package/scripts/filter/after-post-render/parseicontag.js +1 -1
  13. package/scripts/filter/after-post-render/process-variables.js +1 -1
  14. package/scripts/filter/after-post-render/snippets.js +1 -1
  15. package/scripts/filter/after-post-render/time-end.js +1 -1
  16. package/scripts/filter/after-post-render/time-start.js +1 -1
  17. package/scripts/filter/after-post-render/validate-after-render.js +1 -1
  18. package/scripts/filter/before-post-render/add-project-info-to-page.js +1 -1
  19. package/scripts/filter/before-post-render/add-repo-url.js +1 -1
  20. package/scripts/filter/before-post-render/change-output-path.js +1 -1
  21. package/scripts/filter/before-post-render/escape-special-characters.js +1 -1
  22. package/scripts/filter/before-post-render/execute-and-insert-function-results.js +1 -1
  23. package/scripts/filter/before-post-render/infobox.js +1 -1
  24. package/scripts/filter/before-post-render/insertchangelog.js +1 -1
  25. package/scripts/filter/before-post-render/replace-macros.js +1 -1
  26. package/scripts/filter/before-post-render/set-layout.js +1 -1
  27. package/scripts/filter/before-post-render/validate-page-data.js +1 -1
  28. package/scripts/helper/find-main-category-page.js +1 -1
  29. package/scripts/helper/get-pages-for-nav-tree.js +1 -1
  30. package/scripts/helper/mark-empty-categories.js +1 -1
  31. package/scripts/helper/normalize-badges.js +1 -1
  32. package/scripts/helper/u-split-to-title-and-content.js +1 -1
  33. package/scripts/helper/u-toc.js +1 -1
  34. package/scripts/utils/execute-and-insert-function-results.js +1 -1
  35. package/scripts/utils/findmaincategorypage.js +1 -1
  36. package/scripts/utils/getreportissuewidgeturl.js +1 -1
  37. package/scripts/utils/insertchangelog.js +1 -1
  38. package/scripts/utils/normalizebadges.js +1 -1
  39. package/scripts/utils/parseicontag.js +1 -1
  40. package/scripts/utils/parselinks.js +61 -41
  41. package/scripts/utils/shoulddisplaynewindicator.js +1 -1
  42. package/scripts/utils/transforminfobox.js +14 -3
  43. package/scripts-dev/postinstall.js +1 -1
  44. package/src/api-builder/api-builder.js +28 -8
  45. package/src/api-builder/classes/description-parser.js +79 -63
  46. package/src/api-builder/classes/doc-data-factory.js +58 -5
  47. package/src/api-builder/classes/file-name-manager.js +1 -1
  48. package/src/api-builder/classes/html-file.js +1 -1
  49. package/src/api-builder/classes/navigation-tree.js +1 -1
  50. package/src/api-builder/classes/tree-node.js +1 -1
  51. package/src/api-builder/utils/findtargetdoclet.js +84 -0
  52. package/src/api-builder/utils/utils.js +41 -0
  53. package/src/data-converter/converters/jsdoc2umberto.js +8 -1
  54. package/src/data-converter/converters/jsduck2umberto.js +1 -1
  55. package/src/data-converter/converters/typedoc/abstractparser.js +372 -0
  56. package/src/data-converter/converters/typedoc/accessorparser.js +64 -0
  57. package/src/data-converter/converters/typedoc/classparser.js +49 -0
  58. package/src/data-converter/converters/typedoc/constantparser.js +45 -0
  59. package/src/data-converter/converters/typedoc/constructorparser.js +34 -0
  60. package/src/data-converter/converters/typedoc/errorparser.js +44 -0
  61. package/src/data-converter/converters/typedoc/eventparser.js +57 -0
  62. package/src/data-converter/converters/typedoc/functionparser.js +61 -0
  63. package/src/data-converter/converters/typedoc/interfaceparser.js +46 -0
  64. package/src/data-converter/converters/typedoc/methodparser.js +63 -0
  65. package/src/data-converter/converters/typedoc/moduleparser.js +31 -0
  66. package/src/data-converter/converters/typedoc/propertyparser.js +74 -0
  67. package/src/data-converter/converters/typedoc/typedoc.ts +299 -0
  68. package/src/data-converter/converters/typedoc/typedocconverter.js +759 -0
  69. package/src/data-converter/converters/typedoc/typeparser.js +71 -0
  70. package/src/data-converter/converters/typedoc2umberto.js +52 -0
  71. package/src/data-converter/data-collection.js +1 -1
  72. package/src/data-converter/data-provider.js +4 -2
  73. package/src/data-converter/doclet-collection.js +14 -2
  74. package/src/data-converter/middlewares/relation-fixer.js +1 -1
  75. package/src/helpers/capitalize.js +1 -1
  76. package/src/helpers/copy-file.js +1 -1
  77. package/src/helpers/create-filtering-data-attribs.js +1 -1
  78. package/src/helpers/doc-formats.js +3 -2
  79. package/src/helpers/escape-longname.js +1 -1
  80. package/src/helpers/extract-longname.js +1 -1
  81. package/src/helpers/get-api-infobox-tooltip.js +1 -1
  82. package/src/helpers/get-docsearch-config.js +1 -1
  83. package/src/helpers/get-file-patterns-to-process.js +1 -1
  84. package/src/helpers/get-short-module-path.js +1 -1
  85. package/src/helpers/github-url.js +1 -1
  86. package/src/helpers/glob-to-regexp.js +1 -1
  87. package/src/helpers/html-safe.js +1 -1
  88. package/src/helpers/is-non-empty-array.js +1 -1
  89. package/src/helpers/snippets.js +1 -1
  90. package/src/helpers/split-longname.js +101 -8
  91. package/src/hexo/filter/extend-config.js +1 -1
  92. package/src/hexo/filter/project-locals.js +1 -1
  93. package/src/hexo/get-repo-urls.js +1 -1
  94. package/src/hexo/helper/get-page-group.js +1 -1
  95. package/src/hexo/project-globals.js +1 -1
  96. package/src/hexo-manager.js +1 -1
  97. package/src/index.js +1 -1
  98. package/src/sdk-builder/get-sdk-sources.js +1 -1
  99. package/src/sdk-builder/sdk-builder.js +1 -1
  100. package/src/tasks/build-api-docs.js +4 -4
  101. package/src/tasks/build-documentation.js +3 -3
  102. package/src/tasks/build-sdk.js +1 -1
  103. package/src/tasks/build-snippets.js +1 -1
  104. package/src/tasks/cache-files.js +1 -1
  105. package/src/tasks/compile-sass.js +1 -1
  106. package/src/tasks/copy-assets.js +1 -1
  107. package/src/tasks/copy-files.js +1 -1
  108. package/src/tasks/copy-project-docs.js +1 -1
  109. package/src/tasks/copy-project-icons.js +1 -1
  110. package/src/tasks/create-redirect-page.js +1 -1
  111. package/src/tasks/create-sitemap.js +1 -1
  112. package/src/tasks/create-sym-links.js +1 -1
  113. package/src/tasks/execute-hooks.js +1 -1
  114. package/src/tasks/get-extra-files.js +1 -1
  115. package/src/tasks/get-hexo-config.js +1 -1
  116. package/src/tasks/get-main-config.js +1 -1
  117. package/src/tasks/get-project-config.js +3 -3
  118. package/src/tasks/macro-replacer.js +1 -1
  119. package/src/tasks/overwrite-api-guides.js +1 -1
  120. package/src/tasks/read-doc-sources.js +1 -1
  121. package/src/tasks/run-webpack.js +1 -1
  122. package/src/tasks/validate-html-w3c.js +1 -1
  123. package/src/tasks/validate-links.js +1 -1
  124. package/src/tasks/watcher.js +1 -1
  125. package/src/tasks/write-html-files.js +1 -1
  126. package/src/template/template-collection.js +1 -1
  127. package/themes/umberto/layout/_api-docs/_mixin/_api-see-source.pug +2 -1
  128. package/themes/umberto/layout/_api-docs/_mixin/_class-item.pug +0 -1
  129. package/themes/umberto/layout/_api-docs/_mixin/_dev-names.pug +9 -3
  130. package/themes/umberto/layout/_api-docs/_mixin/_fires-item.pug +2 -2
  131. package/themes/umberto/layout/_api-docs/_mixin/_hierarchy-item.pug +2 -2
  132. package/themes/umberto/layout/_api-docs/_mixin/_link-or-text.pug +40 -41
  133. package/themes/umberto/layout/_api-docs/_mixin/_method.pug +8 -2
  134. package/themes/umberto/layout/_api-docs/_mixin/_property.pug +1 -1
  135. package/themes/umberto/layout/_api-docs/_mixin/_related.pug +1 -1
  136. package/themes/umberto/layout/_api-docs/_mixin/_sidebox-list-item.pug +1 -1
  137. package/themes/umberto/layout/_api-docs/_mixin/_type.pug +175 -9
  138. package/themes/umberto/layout/_api-docs/_mixin/type-parameter.pug +18 -0
  139. package/themes/umberto/layout/_api-docs/_partial/filter.pug +16 -4
  140. package/themes/umberto/layout/_api-docs/_partial/type-parameters.pug +26 -0
  141. package/themes/umberto/layout/_api-docs/api-base.pug +2 -0
  142. package/themes/umberto/src/css/_api-content.scss +1 -1
  143. package/themes/umberto/src/css/_api-info-box.scss +1 -1
  144. package/themes/umberto/src/css/_api-props-filter.scss +1 -1
  145. package/themes/umberto/src/css/_api-see-source.scss +1 -1
  146. package/themes/umberto/src/css/_api-subheader.scss +1 -1
  147. package/themes/umberto/src/css/_api-tree.scss +1 -1
  148. package/themes/umberto/src/css/_badge.scss +1 -1
  149. package/themes/umberto/src/css/_collapsinglist.scss +1 -1
  150. package/themes/umberto/src/css/_content.scss +3 -2
  151. package/themes/umberto/src/css/_docsearch.scss +1 -1
  152. package/themes/umberto/src/css/_dropdown.scss +1 -1
  153. package/themes/umberto/src/css/_editor-icon.scss +1 -1
  154. package/themes/umberto/src/css/_feedback-widget.scss +1 -1
  155. package/themes/umberto/src/css/_footer.scss +1 -1
  156. package/themes/umberto/src/css/_formatted.scss +1 -1
  157. package/themes/umberto/src/css/_guide-content.scss +1 -1
  158. package/themes/umberto/src/css/_guide-sdk-tree.scss +1 -1
  159. package/themes/umberto/src/css/_loading-spinner.scss +1 -1
  160. package/themes/umberto/src/css/_main.scss +1 -1
  161. package/themes/umberto/src/css/_navigation.scss +1 -1
  162. package/themes/umberto/src/css/_notice.scss +1 -1
  163. package/themes/umberto/src/css/_print.scss +1 -1
  164. package/themes/umberto/src/css/_prism.scss +1 -1
  165. package/themes/umberto/src/css/_rwd-breadcrumbs.scss +1 -1
  166. package/themes/umberto/src/css/_rwd-menu.scss +1 -1
  167. package/themes/umberto/src/css/_secondary-navigation.scss +1 -1
  168. package/themes/umberto/src/css/_theme-dark.scss +1 -1
  169. package/themes/umberto/src/css/_toggler.scss +1 -1
  170. package/themes/umberto/src/css/_top.scss +7 -1
  171. package/themes/umberto/src/css/_tree.scss +7 -5
  172. package/themes/umberto/src/css/_warning-banner.scss +1 -1
  173. package/themes/umberto/src/css/components/_lightbox.scss +1 -1
  174. package/themes/umberto/src/css/helpers/_color.scss +1 -1
  175. package/themes/umberto/src/css/helpers/_font.scss +1 -1
  176. package/themes/umberto/src/css/helpers/_globals.scss +1 -1
  177. package/themes/umberto/src/css/helpers/_reset.scss +1 -1
  178. package/themes/umberto/src/css/helpers/_spacing.scss +1 -1
  179. package/themes/umberto/src/css/pages/_sdk.scss +1 -1
  180. package/themes/umberto/src/css/styles.scss +1 -1
  181. package/themes/umberto/src/js/_anchors.js +1 -1
  182. package/themes/umberto/src/js/_apisearch.js +1 -1
  183. package/themes/umberto/src/js/_apitree.js +1 -1
  184. package/themes/umberto/src/js/_collapsables.js +1 -1
  185. package/themes/umberto/src/js/_copymobileapinavigation.js +1 -1
  186. package/themes/umberto/src/js/_devnames.js +1 -1
  187. package/themes/umberto/src/js/_dropdowns.js +1 -1
  188. package/themes/umberto/src/js/_filtering.js +2 -1
  189. package/themes/umberto/src/js/_imageModal.js +1 -1
  190. package/themes/umberto/src/js/_pagenavigation.js +1 -1
  191. package/themes/umberto/src/js/_prism.js +6 -1
  192. package/themes/umberto/src/js/_rwdmenu.js +1 -1
  193. package/themes/umberto/src/js/_samplecode.js +1 -1
  194. package/themes/umberto/src/js/_sidenavigation.js +1 -1
  195. package/themes/umberto/src/js/_toc.js +1 -1
  196. package/themes/umberto/src/js/_tooltips.js +1 -1
  197. package/themes/umberto/src/js/_warningbanner.js +1 -1
  198. package/themes/umberto/src/js/app.js +1 -1
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const AbstractParser = require( './abstractparser' );
9
+
10
+ module.exports = class FunctionParser extends AbstractParser {
11
+ /**
12
+ * @param {TypedocReflectionMeta} item
13
+ * @returns {Boolean}
14
+ */
15
+ canParse( item ) {
16
+ return item.kindString === 'Function';
17
+ }
18
+
19
+ /**
20
+ * @param {TypedocReflection<'Function'>} item
21
+ * @param {String} parentName
22
+ * @returns {Array.<Object>}
23
+ */
24
+ parse( item, parentName ) {
25
+ return item.signatures.map( ( signature, index ) => {
26
+ const doclet = {
27
+ // Needed for post-processing once all project reflections are converted.
28
+ _signature: signature,
29
+
30
+ name: item.name,
31
+ memberof: parentName,
32
+ longname: this.getLongName( item, parentName ),
33
+
34
+ scope: this.getScope( signature ),
35
+ access: this.getVisibility( signature ),
36
+ kind: this.getKind( item ),
37
+ extraId: this.getExtraId( item ),
38
+ description: this.getComment( signature ),
39
+ file: this.getFile( item, index ),
40
+ skipSource: this.shouldSkipSource( signature ),
41
+ deprecated: this.isDeprecated( signature ),
42
+ see: this.getRelated( signature, parentName ),
43
+
44
+ isOverloaded: item.signatures.length > 1,
45
+ label: this._getLabelName( signature ),
46
+
47
+ // These properties will be filled in the post-processing phase.
48
+ returns: null,
49
+ params: null,
50
+ typeParameters: null
51
+ };
52
+
53
+ // Add a label as suffix for overloaded members.
54
+ if ( doclet.label ) {
55
+ doclet.extraId += ':' + doclet.label;
56
+ }
57
+
58
+ return doclet;
59
+ } );
60
+ }
61
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const AbstractParser = require( './abstractparser' );
9
+
10
+ module.exports = class InterfaceParser extends AbstractParser {
11
+ /**
12
+ * @param {TypedocReflectionMeta} item
13
+ * @returns {Boolean}
14
+ */
15
+ canParse( item ) {
16
+ return item.kindString === 'Interface';
17
+ }
18
+
19
+ /**
20
+ * @param {TypedocReflection<'Interface'>} item
21
+ * @param {String} parentName
22
+ * @returns {Object}
23
+ */
24
+ parse( item, parentName ) {
25
+ return {
26
+ // Needed for post-processing once all project reflections are converted.
27
+ _signature: item,
28
+
29
+ name: item.name,
30
+ memberof: parentName,
31
+ longname: this.getLongName( item, parentName ),
32
+
33
+ scope: this.getScope( item ),
34
+ kind: this.getKind( item ),
35
+ extraId: this.getExtraId( item ),
36
+ description: this.getComment( item ),
37
+ file: this.getFile( item ),
38
+ skipSource: this.shouldSkipSource( item ),
39
+ deprecated: this.isDeprecated( item ),
40
+
41
+ typeParameters: null,
42
+ augmentsNested: null,
43
+ descendants: null
44
+ };
45
+ }
46
+ };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const AbstractParser = require( './abstractparser' );
9
+
10
+ module.exports = class MethodParser extends AbstractParser {
11
+ /**
12
+ * @param {TypedocReflectionMeta} item
13
+ * @returns {Boolean}
14
+ */
15
+ canParse( item ) {
16
+ return item.kindString === 'Method';
17
+ }
18
+
19
+ /**
20
+ * @param {TypedocReflection<ConstructorOrMethod>} item
21
+ * @param {String} parentName
22
+ * @returns {Array.<Object>}
23
+ */
24
+ parse( item, parentName ) {
25
+ return item.signatures.map( ( signature, index ) => {
26
+ const doclet = {
27
+ // Needed for post-processing once all project reflections are converted.
28
+ _signature: signature,
29
+
30
+ name: item.name,
31
+ memberof: parentName,
32
+ longname: this.getLongName( item, parentName ),
33
+
34
+ scope: this.getScope( item ),
35
+ kind: this.getKind( item ),
36
+ access: this.getVisibility( item ),
37
+ extraId: this.getExtraId( item ),
38
+ fires: this.getFiredEvents( signature, parentName ),
39
+ description: this.getComment( signature ),
40
+ file: this.getFile( item, index ),
41
+ skipSource: this.shouldSkipSource( signature ),
42
+ deprecated: this.isDeprecated( signature ),
43
+ inherited: !!signature.inheritedFrom,
44
+ see: this.getRelated( signature, parentName ),
45
+
46
+ isOverloaded: item.signatures.length > 1,
47
+ label: this._getLabelName( signature ),
48
+
49
+ // These properties will be filled in the post-processing phase.
50
+ returns: null,
51
+ params: null,
52
+ typeParameters: null
53
+ };
54
+
55
+ // Add a label as suffix for overloaded members.
56
+ if ( doclet.label ) {
57
+ doclet.extraId += ':' + doclet.label;
58
+ }
59
+
60
+ return doclet;
61
+ } );
62
+ }
63
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const AbstractParser = require( './abstractparser' );
9
+
10
+ module.exports = class ModuleParser extends AbstractParser {
11
+ /**
12
+ * @param {TypedocReflectionMeta} item
13
+ * @returns {Boolean}
14
+ */
15
+ canParse( item ) {
16
+ return item.kindString === 'Module';
17
+ }
18
+
19
+ /**
20
+ * @param {TypedocReflection<'Module'>} item
21
+ * @returns {Object}
22
+ */
23
+ parse( item ) {
24
+ return {
25
+ name: item.name,
26
+ longname: this.getLongName( item ),
27
+ kind: this.getKind( item ),
28
+ extraId: this.getExtraId( item )
29
+ };
30
+ }
31
+ };
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const AbstractParser = require( './abstractparser' );
9
+
10
+ module.exports = class PropertyParser extends AbstractParser {
11
+ /**
12
+ * @param {TypedocReflectionMeta} item
13
+ * @returns {Boolean}
14
+ */
15
+ canParse( item ) {
16
+ return item.kindString === 'Property' && item.name !== 'constructor';
17
+ }
18
+
19
+ /**
20
+ * @param {TypedocReflection<'Property'>} item
21
+ * @param {String} parentName
22
+ * @returns {Object}
23
+ */
24
+ parse( item, parentName ) {
25
+ // By default, a comment that is associated in the source code with the property, is bound to the item itself, as anyone would
26
+ // expect. TypeDoc works differently for a callable property, for which the comment is moved down to the property signature.
27
+ // Hence, we must extract it back from the property signature to be able to display it correctly in the API docs.
28
+ const description = isCallableProperty( item ) ?
29
+ this.getComment( item.type.declaration.signatures[ 0 ] ) :
30
+ this.getComment( item );
31
+
32
+ return {
33
+ // Needed for post-processing once all project reflections are converted.
34
+ _signature: [ item, {} ],
35
+
36
+ name: item.name,
37
+ memberof: parentName,
38
+ longname: this.getLongName( item, parentName ),
39
+
40
+ scope: this.getScope( item ),
41
+ readonly: this.isReadonly( item ),
42
+ observable: this.isObservable( item ),
43
+ access: this.getVisibility( item ),
44
+ optional: this.isOptional( item ),
45
+ kind: this.getKind( item ),
46
+ extraId: this.getExtraId( item ),
47
+ description,
48
+ file: this.getFile( item ),
49
+ skipSource: this.shouldSkipSource( item ),
50
+ deprecated: this.isDeprecated( item ),
51
+ inherited: !!item.inheritedFrom,
52
+ see: this.getRelated( item, parentName ),
53
+
54
+ // This property will be filled in the post-processing phase.
55
+ type: null
56
+ };
57
+ }
58
+ };
59
+
60
+ /**
61
+ * @param {TypedocReflectionType} item
62
+ * @returns {Boolean}
63
+ */
64
+ function isCallableProperty( item ) {
65
+ if ( item.type.type !== 'reflection' ) {
66
+ return false;
67
+ }
68
+
69
+ if ( !Array.isArray( item.type.declaration.signatures ) ) {
70
+ return false;
71
+ }
72
+
73
+ return true;
74
+ }
@@ -0,0 +1,299 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ // This file contains several types and definitions used in the Typedoc converter mechanism.
7
+ // It is not loaded anywhere in Umberto, and should not cause any errors.
8
+
9
+ /**
10
+ * @typeParameter V Kind string.
11
+ */
12
+ export type TypedocReflectionMeta<V extends string> = {
13
+
14
+ /**
15
+ * A name of a parser that should process given structure.
16
+ */
17
+ kindString: V;
18
+
19
+ /**
20
+ * An internal (Typedoc) kind identifier.
21
+ */
22
+ kind: number;
23
+
24
+ /**
25
+ * An identifier used to map reference reflections.
26
+ */
27
+ id: number;
28
+
29
+ /**
30
+ * A name of a member.
31
+ */
32
+ name: string;
33
+
34
+ flags: Record<
35
+ 'isReadonly' | 'isPrivate' | 'isProtected' | 'isPublic' | 'isStatic' | 'isOptional' | 'isRest' | 'isExternal',
36
+ true | undefined
37
+ >;
38
+
39
+ comment?: {
40
+
41
+ /**
42
+ * A description of the code. It contains all text found before processing annotations.
43
+ */
44
+ summary: Array<TypedocCommentItem>;
45
+
46
+ /**
47
+ * Annotations that require additional description, e.g. `@param`.
48
+ */
49
+ blockTags: Array<{
50
+ tag: `@${ string }`;
51
+ name: string;
52
+ content: Array<TypedocCommentItem>;
53
+ }>;
54
+
55
+ /**
56
+ * Annotation without descriptions, e.g. `@internal`.
57
+ */
58
+ modifierTags: Array<`@${ string }`>;
59
+ };
60
+ };
61
+
62
+ /**
63
+ * @typeParam T A name of a parser that should process given structure.
64
+ */
65
+ export type TypedocReflection<T extends TypedocParsers> = TypedocReflectionMeta<T> & {
66
+
67
+ /**
68
+ * An array of reflections children if the given structure can be a parent. Otherwise, `undefined`.
69
+ */
70
+ children: ChildrenMap[T] extends null ? undefined : Array<ChildrenMap[T]>;
71
+
72
+ /**
73
+ * An array of parent classes or interfaces that given structure extends.
74
+ */
75
+ extendedTypes: T extends ClassOrInterface ? Array<TypedocReflectionMeta<TypedocParsers>> : undefined;
76
+
77
+ /**
78
+ * An array of interfaces that given class implements.
79
+ */
80
+ implementedTypes: T extends 'Class' ? Array<TypedocReflectionMeta<TypedocParsers>> : undefined;
81
+
82
+ /**
83
+ * Type parameters for an interface or a class.
84
+ *
85
+ * Also, due to lack of knowledge how to create parameters for a custom structure, we keep event arguments here.
86
+ */
87
+ typeParameters: T extends ClassOrInterface | 'Event' ? Array<TypedocReflectionTypeParameter> : undefined;
88
+
89
+ /**
90
+ * Type parameters for a constant or a callable expression.
91
+ */
92
+ typeParameter: T extends 'Variable' | 'Method' | 'Function' ? Array<TypedocReflectionTypeParameter> : undefined;
93
+
94
+ /**
95
+ * For inherited properties, the property contains a parent reflection.
96
+ */
97
+ inheritedFrom: T extends 'Method' | 'Function' ? Record<string, any> : undefined;
98
+
99
+ /**
100
+ * The `signatures` property exists only for callable doclets.
101
+ */
102
+ signatures: T extends ConstructorOrMethod | 'Function' ? Array<TypedocCallSignature> : undefined;
103
+
104
+ /**
105
+ * A value defined by an exported constant (`export const ...`).
106
+ */
107
+ defaultValue: T extends 'Variable' ? TypedocReflectionType : undefined;
108
+
109
+ /**
110
+ * The `setSignature` and `getSignature` exist only when processing a getter or/and setter.
111
+ *
112
+ * However, the getter does not allow setting a value. The `set*` property does not exist in such a case.
113
+ * The same applies to setters and their `get*` properties.
114
+ */
115
+ setSignature?: T extends 'Accessor' ? TypedocCallSignature : undefined;
116
+ getSignature?: T extends 'Accessor' ? TypedocCallSignature : undefined;
117
+
118
+ /**
119
+ * An array of sources that defines given structure.
120
+ */
121
+ sources?: Array<TypedocSource>;
122
+ originalName?: string;
123
+ };
124
+
125
+ export type TypedocReflectionType = TypedocReflectionMeta<'Parameter'> & {
126
+ type: TypedocTypeDetails;
127
+ elementType?: TypedocTypeDetails;
128
+ declaration?: {
129
+ signatures?: Array<TypedocCallSignature>;
130
+ children?: Array<TypedocReflection<TypedocParsers>>;
131
+ };
132
+ types?: Array<TypedocReflectionType>;
133
+ defaultValue?: string;
134
+ };
135
+
136
+ export type TypedocReflectionTypeParameter = TypedocReflectionMeta<'Type parameter'> & TypedocTypeDetails & {
137
+ default?: TypedocTypeDetails;
138
+ type?: TypedocReflectionType;
139
+ };
140
+
141
+ export type TypedocCallSignature = TypedocReflectionMeta<'Call signature'> & {
142
+ type: TypedocReflectionType;
143
+ parameters?: Array<TypedocReflectionType>;
144
+ inheritedFrom?: Record<string, any>;
145
+ };
146
+
147
+ export type TypedocTypeDetails = string | LiteralOrIntrinsic | Reference | TypeOperator |
148
+ {
149
+ type: 'union';
150
+ types: Array<TypedocReflectionType>;
151
+ } |
152
+ {
153
+ type: 'array';
154
+ elementType: TypedocTypeDetails;
155
+ } |
156
+ {
157
+ type: 'indexedAccess';
158
+ objectType: TypedocTypeDetails;
159
+ indexType: TypedocTypeDetails;
160
+ } |
161
+ {
162
+ type: 'reflection';
163
+ declaration: {
164
+ signatures?: Array<TypedocCallSignature>;
165
+ };
166
+ } |
167
+ {
168
+ type: 'tuple';
169
+ elements: Array<TypedocTypeDetails>;
170
+ } |
171
+ {
172
+ type: 'named-tuple-member';
173
+ element: TypedocTypeDetails;
174
+ } |
175
+ {
176
+ type: 'intersection';
177
+ types: Array<TypedocReflectionType>;
178
+ } |
179
+ {
180
+ type: 'query';
181
+ queryType: {
182
+ name: string;
183
+ };
184
+ } |
185
+ {
186
+ type: 'mapped';
187
+ parameter: string;
188
+ parameterType?: TypeOperator | string;
189
+ templateType: LiteralOrIntrinsic;
190
+ optionalModifier?: string;
191
+ } |
192
+ {
193
+ type: 'conditional';
194
+ checkType: Reference;
195
+ extendsType: TypedocTypeDetails;
196
+ trueType: TypedocTypeDetails;
197
+ falseType: TypedocTypeDetails;
198
+ } |
199
+ {
200
+ type: 'template-literal';
201
+ tail: Array<{
202
+ type: TypedocTypeDetails;
203
+ suffix: string;
204
+ }>;
205
+ head: string;
206
+ } |
207
+ {
208
+ type: 'predicate';
209
+ targetType: TypedocTypeDetails;
210
+ };
211
+
212
+ export type TypedocCommentItem = {
213
+ kind: 'text' | 'code' | 'inline-tag';
214
+ text: string;
215
+
216
+ /**
217
+ * Available when `kind === 'inline-tag'`.
218
+ */
219
+ tag?: string;
220
+
221
+ /**
222
+ * Available if `tag === '@link'` and it points to an existing reflection.
223
+ */
224
+ target?: number;
225
+ };
226
+
227
+ /**
228
+ * Available parsers for processing reflections.
229
+ */
230
+ export type TypedocParsers = keyof ChildrenMap;
231
+
232
+ /**
233
+ * An alias for callable properties from a class or an interface.
234
+ */
235
+ export type ConstructorOrMethod = 'Constructor' | 'Method';
236
+
237
+ /**
238
+ * An alias for types that contains children.
239
+ */
240
+ type ClassOrInterface = 'Class' | 'Interface';
241
+
242
+ /**
243
+ * A map containing the possible types of children for a given parent type.
244
+ */
245
+ type ChildrenMap = {
246
+ // Root.
247
+ Module: TypedocReflection<ClassOrInterface | 'Function' | 'Type alias' | 'Error' | 'Variable'>;
248
+
249
+ // Module children.
250
+ Class: TypedocReflection<ConstructorOrMethod | 'Event' | 'Accessor' | 'Property'>;
251
+ Interface: TypedocReflection<ConstructorOrMethod | 'Event' | 'Accessor' | 'Property'>;
252
+ Function: null;
253
+ 'Type alias': null;
254
+ Error: null;
255
+ Variable: null;
256
+
257
+ // Class/interface children.
258
+ Constructor: null;
259
+ Method: null;
260
+ Property: null;
261
+ Accessor: null;
262
+ Event: null;
263
+
264
+ // A special "parser" that points to an existing doclet that most probably has been already converted.
265
+ Reference: null;
266
+
267
+ // To detect if a specified argument is a class instance or a function.
268
+ 'Constructor signature': null;
269
+ };
270
+
271
+ type TypedocSource = {
272
+ fileName: string;
273
+ line: number;
274
+ character: number;
275
+ url: string;
276
+ };
277
+
278
+ type Reference = {
279
+ type: 'reference';
280
+ name: string;
281
+ id?: number;
282
+ typeArguments?: Array<TypedocReflectionTypeParameter>;
283
+ };
284
+
285
+ type TypeOperator = {
286
+ type: 'typeOperator';
287
+ operator: string;
288
+ target: Reference;
289
+ };
290
+
291
+ type LiteralOrIntrinsic =
292
+ {
293
+ type: 'literal';
294
+ value: string | number | boolean | null;
295
+ } |
296
+ {
297
+ type: 'intrinsic';
298
+ name: string;
299
+ };