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.
- package/.eslintrc.js +4 -3
- package/LICENSE.md +1 -1
- package/hexo-shim.js +1 -1
- package/package.json +6 -2
- package/scripts/filter/after-post-render/basepath-replacer.js +1 -1
- package/scripts/filter/after-post-render/fix-code-samples.js +1 -1
- package/scripts/filter/after-post-render/gather-guides.js +1 -1
- package/scripts/filter/after-post-render/img-linker.js +1 -1
- package/scripts/filter/after-post-render/import-guide.js +1 -1
- package/scripts/filter/after-post-render/insert-error-codes.js +4 -2
- package/scripts/filter/after-post-render/linker.js +1 -1
- package/scripts/filter/after-post-render/parseicontag.js +1 -1
- package/scripts/filter/after-post-render/process-variables.js +1 -1
- package/scripts/filter/after-post-render/snippets.js +1 -1
- package/scripts/filter/after-post-render/time-end.js +1 -1
- package/scripts/filter/after-post-render/time-start.js +1 -1
- package/scripts/filter/after-post-render/validate-after-render.js +1 -1
- package/scripts/filter/before-post-render/add-project-info-to-page.js +1 -1
- package/scripts/filter/before-post-render/add-repo-url.js +1 -1
- package/scripts/filter/before-post-render/change-output-path.js +1 -1
- package/scripts/filter/before-post-render/escape-special-characters.js +1 -1
- package/scripts/filter/before-post-render/execute-and-insert-function-results.js +1 -1
- package/scripts/filter/before-post-render/infobox.js +1 -1
- package/scripts/filter/before-post-render/insertchangelog.js +1 -1
- package/scripts/filter/before-post-render/replace-macros.js +1 -1
- package/scripts/filter/before-post-render/set-layout.js +1 -1
- package/scripts/filter/before-post-render/validate-page-data.js +1 -1
- package/scripts/helper/find-main-category-page.js +1 -1
- package/scripts/helper/get-pages-for-nav-tree.js +1 -1
- package/scripts/helper/mark-empty-categories.js +1 -1
- package/scripts/helper/normalize-badges.js +1 -1
- package/scripts/helper/u-split-to-title-and-content.js +1 -1
- package/scripts/helper/u-toc.js +1 -1
- package/scripts/utils/execute-and-insert-function-results.js +1 -1
- package/scripts/utils/findmaincategorypage.js +1 -1
- package/scripts/utils/getreportissuewidgeturl.js +1 -1
- package/scripts/utils/insertchangelog.js +1 -1
- package/scripts/utils/normalizebadges.js +1 -1
- package/scripts/utils/parseicontag.js +1 -1
- package/scripts/utils/parselinks.js +61 -41
- package/scripts/utils/shoulddisplaynewindicator.js +1 -1
- package/scripts/utils/transforminfobox.js +14 -3
- package/scripts-dev/postinstall.js +1 -1
- package/src/api-builder/api-builder.js +28 -8
- package/src/api-builder/classes/description-parser.js +79 -63
- package/src/api-builder/classes/doc-data-factory.js +58 -5
- package/src/api-builder/classes/file-name-manager.js +1 -1
- package/src/api-builder/classes/html-file.js +1 -1
- package/src/api-builder/classes/navigation-tree.js +1 -1
- package/src/api-builder/classes/tree-node.js +1 -1
- package/src/api-builder/utils/findtargetdoclet.js +84 -0
- package/src/api-builder/utils/utils.js +41 -0
- package/src/data-converter/converters/jsdoc2umberto.js +8 -1
- package/src/data-converter/converters/jsduck2umberto.js +1 -1
- package/src/data-converter/converters/typedoc/abstractparser.js +372 -0
- package/src/data-converter/converters/typedoc/accessorparser.js +64 -0
- package/src/data-converter/converters/typedoc/classparser.js +49 -0
- package/src/data-converter/converters/typedoc/constantparser.js +45 -0
- package/src/data-converter/converters/typedoc/constructorparser.js +34 -0
- package/src/data-converter/converters/typedoc/errorparser.js +44 -0
- package/src/data-converter/converters/typedoc/eventparser.js +57 -0
- package/src/data-converter/converters/typedoc/functionparser.js +61 -0
- package/src/data-converter/converters/typedoc/interfaceparser.js +46 -0
- package/src/data-converter/converters/typedoc/methodparser.js +63 -0
- package/src/data-converter/converters/typedoc/moduleparser.js +31 -0
- package/src/data-converter/converters/typedoc/propertyparser.js +74 -0
- package/src/data-converter/converters/typedoc/typedoc.ts +299 -0
- package/src/data-converter/converters/typedoc/typedocconverter.js +759 -0
- package/src/data-converter/converters/typedoc/typeparser.js +71 -0
- package/src/data-converter/converters/typedoc2umberto.js +52 -0
- package/src/data-converter/data-collection.js +1 -1
- package/src/data-converter/data-provider.js +4 -2
- package/src/data-converter/doclet-collection.js +14 -2
- package/src/data-converter/middlewares/relation-fixer.js +1 -1
- package/src/helpers/capitalize.js +1 -1
- package/src/helpers/copy-file.js +1 -1
- package/src/helpers/create-filtering-data-attribs.js +1 -1
- package/src/helpers/doc-formats.js +3 -2
- package/src/helpers/escape-longname.js +1 -1
- package/src/helpers/extract-longname.js +1 -1
- package/src/helpers/get-api-infobox-tooltip.js +1 -1
- package/src/helpers/get-docsearch-config.js +1 -1
- package/src/helpers/get-file-patterns-to-process.js +1 -1
- package/src/helpers/get-short-module-path.js +1 -1
- package/src/helpers/github-url.js +1 -1
- package/src/helpers/glob-to-regexp.js +1 -1
- package/src/helpers/html-safe.js +1 -1
- package/src/helpers/is-non-empty-array.js +1 -1
- package/src/helpers/snippets.js +1 -1
- package/src/helpers/split-longname.js +101 -8
- package/src/hexo/filter/extend-config.js +1 -1
- package/src/hexo/filter/project-locals.js +1 -1
- package/src/hexo/get-repo-urls.js +1 -1
- package/src/hexo/helper/get-page-group.js +1 -1
- package/src/hexo/project-globals.js +1 -1
- package/src/hexo-manager.js +1 -1
- package/src/index.js +1 -1
- package/src/sdk-builder/get-sdk-sources.js +1 -1
- package/src/sdk-builder/sdk-builder.js +1 -1
- package/src/tasks/build-api-docs.js +4 -4
- package/src/tasks/build-documentation.js +3 -3
- package/src/tasks/build-sdk.js +1 -1
- package/src/tasks/build-snippets.js +1 -1
- package/src/tasks/cache-files.js +1 -1
- package/src/tasks/compile-sass.js +1 -1
- package/src/tasks/copy-assets.js +1 -1
- package/src/tasks/copy-files.js +1 -1
- package/src/tasks/copy-project-docs.js +1 -1
- package/src/tasks/copy-project-icons.js +1 -1
- package/src/tasks/create-redirect-page.js +1 -1
- package/src/tasks/create-sitemap.js +1 -1
- package/src/tasks/create-sym-links.js +1 -1
- package/src/tasks/execute-hooks.js +1 -1
- package/src/tasks/get-extra-files.js +1 -1
- package/src/tasks/get-hexo-config.js +1 -1
- package/src/tasks/get-main-config.js +1 -1
- package/src/tasks/get-project-config.js +3 -3
- package/src/tasks/macro-replacer.js +1 -1
- package/src/tasks/overwrite-api-guides.js +1 -1
- package/src/tasks/read-doc-sources.js +1 -1
- package/src/tasks/run-webpack.js +1 -1
- package/src/tasks/validate-html-w3c.js +1 -1
- package/src/tasks/validate-links.js +1 -1
- package/src/tasks/watcher.js +1 -1
- package/src/tasks/write-html-files.js +1 -1
- package/src/template/template-collection.js +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_api-see-source.pug +2 -1
- package/themes/umberto/layout/_api-docs/_mixin/_class-item.pug +0 -1
- package/themes/umberto/layout/_api-docs/_mixin/_dev-names.pug +9 -3
- package/themes/umberto/layout/_api-docs/_mixin/_fires-item.pug +2 -2
- package/themes/umberto/layout/_api-docs/_mixin/_hierarchy-item.pug +2 -2
- package/themes/umberto/layout/_api-docs/_mixin/_link-or-text.pug +40 -41
- package/themes/umberto/layout/_api-docs/_mixin/_method.pug +8 -2
- package/themes/umberto/layout/_api-docs/_mixin/_property.pug +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_related.pug +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_sidebox-list-item.pug +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_type.pug +175 -9
- package/themes/umberto/layout/_api-docs/_mixin/type-parameter.pug +18 -0
- package/themes/umberto/layout/_api-docs/_partial/filter.pug +16 -4
- package/themes/umberto/layout/_api-docs/_partial/type-parameters.pug +26 -0
- package/themes/umberto/layout/_api-docs/api-base.pug +2 -0
- package/themes/umberto/src/css/_api-content.scss +1 -1
- package/themes/umberto/src/css/_api-info-box.scss +1 -1
- package/themes/umberto/src/css/_api-props-filter.scss +1 -1
- package/themes/umberto/src/css/_api-see-source.scss +1 -1
- package/themes/umberto/src/css/_api-subheader.scss +1 -1
- package/themes/umberto/src/css/_api-tree.scss +1 -1
- package/themes/umberto/src/css/_badge.scss +1 -1
- package/themes/umberto/src/css/_collapsinglist.scss +1 -1
- package/themes/umberto/src/css/_content.scss +3 -2
- package/themes/umberto/src/css/_docsearch.scss +1 -1
- package/themes/umberto/src/css/_dropdown.scss +1 -1
- package/themes/umberto/src/css/_editor-icon.scss +1 -1
- package/themes/umberto/src/css/_feedback-widget.scss +1 -1
- package/themes/umberto/src/css/_footer.scss +1 -1
- package/themes/umberto/src/css/_formatted.scss +1 -1
- package/themes/umberto/src/css/_guide-content.scss +1 -1
- package/themes/umberto/src/css/_guide-sdk-tree.scss +1 -1
- package/themes/umberto/src/css/_loading-spinner.scss +1 -1
- package/themes/umberto/src/css/_main.scss +1 -1
- package/themes/umberto/src/css/_navigation.scss +1 -1
- package/themes/umberto/src/css/_notice.scss +1 -1
- package/themes/umberto/src/css/_print.scss +1 -1
- package/themes/umberto/src/css/_prism.scss +1 -1
- package/themes/umberto/src/css/_rwd-breadcrumbs.scss +1 -1
- package/themes/umberto/src/css/_rwd-menu.scss +1 -1
- package/themes/umberto/src/css/_secondary-navigation.scss +1 -1
- package/themes/umberto/src/css/_theme-dark.scss +1 -1
- package/themes/umberto/src/css/_toggler.scss +1 -1
- package/themes/umberto/src/css/_top.scss +7 -1
- package/themes/umberto/src/css/_tree.scss +7 -5
- package/themes/umberto/src/css/_warning-banner.scss +1 -1
- package/themes/umberto/src/css/components/_lightbox.scss +1 -1
- package/themes/umberto/src/css/helpers/_color.scss +1 -1
- package/themes/umberto/src/css/helpers/_font.scss +1 -1
- package/themes/umberto/src/css/helpers/_globals.scss +1 -1
- package/themes/umberto/src/css/helpers/_reset.scss +1 -1
- package/themes/umberto/src/css/helpers/_spacing.scss +1 -1
- package/themes/umberto/src/css/pages/_sdk.scss +1 -1
- package/themes/umberto/src/css/styles.scss +1 -1
- package/themes/umberto/src/js/_anchors.js +1 -1
- package/themes/umberto/src/js/_apisearch.js +1 -1
- package/themes/umberto/src/js/_apitree.js +1 -1
- package/themes/umberto/src/js/_collapsables.js +1 -1
- package/themes/umberto/src/js/_copymobileapinavigation.js +1 -1
- package/themes/umberto/src/js/_devnames.js +1 -1
- package/themes/umberto/src/js/_dropdowns.js +1 -1
- package/themes/umberto/src/js/_filtering.js +2 -1
- package/themes/umberto/src/js/_imageModal.js +1 -1
- package/themes/umberto/src/js/_pagenavigation.js +1 -1
- package/themes/umberto/src/js/_prism.js +6 -1
- package/themes/umberto/src/js/_rwdmenu.js +1 -1
- package/themes/umberto/src/js/_samplecode.js +1 -1
- package/themes/umberto/src/js/_sidenavigation.js +1 -1
- package/themes/umberto/src/js/_toc.js +1 -1
- package/themes/umberto/src/js/_tooltips.js +1 -1
- package/themes/umberto/src/js/_warningbanner.js +1 -1
- package/themes/umberto/src/js/app.js +1 -1
|
@@ -0,0 +1,372 @@
|
|
|
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 TypedocConverter = require( './typedocconverter' );
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An abstract parser class providing basic utils for converting Typedoc reflection to JSDoc doclet.
|
|
12
|
+
*/
|
|
13
|
+
module.exports = class AbstractParser {
|
|
14
|
+
/**
|
|
15
|
+
* @abstract
|
|
16
|
+
* @method canParse
|
|
17
|
+
* @param {TypedocReflection<TypedocParsers>} item
|
|
18
|
+
* @returns {Boolean}
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @abstract
|
|
23
|
+
* @method parse
|
|
24
|
+
* @param {TypedocReflection<TypedocParsers>} item
|
|
25
|
+
* @param {String|null} [parentName=null]
|
|
26
|
+
* @returns {Object}
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Coverts the item's comment from Markdown to HTML.
|
|
31
|
+
*
|
|
32
|
+
* @param {TypedocReflectionMeta} item
|
|
33
|
+
* @returns {String}
|
|
34
|
+
*/
|
|
35
|
+
getComment( item ) {
|
|
36
|
+
if ( item.comment && Array.isArray( item.comment.summary ) ) {
|
|
37
|
+
return TypedocConverter.convertComment( item.comment.summary );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {TypedocReflectionMeta} item
|
|
45
|
+
* @param {String|null} [parentName=null]
|
|
46
|
+
* @returns {String}
|
|
47
|
+
*/
|
|
48
|
+
getLongName( item, parentName = null ) {
|
|
49
|
+
let separator;
|
|
50
|
+
|
|
51
|
+
switch ( item.kindString ) {
|
|
52
|
+
case 'Module':
|
|
53
|
+
separator = ':';
|
|
54
|
+
parentName = 'module';
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
case 'Class':
|
|
58
|
+
case 'Function':
|
|
59
|
+
case 'Interface':
|
|
60
|
+
case 'Type alias':
|
|
61
|
+
separator = '~';
|
|
62
|
+
break;
|
|
63
|
+
|
|
64
|
+
case 'Event':
|
|
65
|
+
separator = '#event:';
|
|
66
|
+
break;
|
|
67
|
+
|
|
68
|
+
default:
|
|
69
|
+
separator = this.getScope( item ) === 'static' ? '.' : '#';
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return `${ parentName }${ separator }${ item.name }`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns the access type for the item.
|
|
78
|
+
*
|
|
79
|
+
* @param {TypedocReflectionMeta} item
|
|
80
|
+
* @returns {'public'|'internal'|'protected'|'private'}
|
|
81
|
+
*/
|
|
82
|
+
getVisibility( item ) {
|
|
83
|
+
const flags = item.flags || {};
|
|
84
|
+
|
|
85
|
+
if ( this.isInternal( item ) ) {
|
|
86
|
+
return 'internal';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ( flags.isProtected ) {
|
|
90
|
+
return 'protected';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if ( flags.isPrivate ) {
|
|
94
|
+
return 'private';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return 'public';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Returns the item's kind.
|
|
102
|
+
*
|
|
103
|
+
* @param {TypedocReflectionMeta} item
|
|
104
|
+
* @returns {String}
|
|
105
|
+
*/
|
|
106
|
+
getKind( item ) {
|
|
107
|
+
switch ( item.kindString ) {
|
|
108
|
+
case 'Module':
|
|
109
|
+
return 'module';
|
|
110
|
+
|
|
111
|
+
case 'Class':
|
|
112
|
+
return 'class';
|
|
113
|
+
|
|
114
|
+
case 'Function':
|
|
115
|
+
case 'Method':
|
|
116
|
+
case 'Constructor':
|
|
117
|
+
return 'function';
|
|
118
|
+
|
|
119
|
+
case 'Interface':
|
|
120
|
+
return 'interface';
|
|
121
|
+
|
|
122
|
+
case 'Accessor':
|
|
123
|
+
case 'Property':
|
|
124
|
+
return 'member';
|
|
125
|
+
|
|
126
|
+
case 'Variable':
|
|
127
|
+
return 'constant';
|
|
128
|
+
|
|
129
|
+
case 'Type alias':
|
|
130
|
+
return 'typedef';
|
|
131
|
+
|
|
132
|
+
case 'Event':
|
|
133
|
+
return 'event';
|
|
134
|
+
|
|
135
|
+
case 'Error':
|
|
136
|
+
return 'error';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Returns the item's scope.
|
|
142
|
+
*
|
|
143
|
+
* @param {TypedocReflectionMeta} item
|
|
144
|
+
* @returns {'instance'|'static'}
|
|
145
|
+
*/
|
|
146
|
+
getScope( item ) {
|
|
147
|
+
const flags = item.flags || {};
|
|
148
|
+
|
|
149
|
+
if ( flags.isStatic ) {
|
|
150
|
+
return 'static';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return 'instance';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Returns the `extraId` combined from the item's scope, kind, name and optional variation.
|
|
158
|
+
*
|
|
159
|
+
* @param {TypedocReflectionMeta} item
|
|
160
|
+
* @returns {String}
|
|
161
|
+
*/
|
|
162
|
+
getExtraId( item ) {
|
|
163
|
+
const staticModifier = this.getScope( item ) === 'static' ? 'static-' : '';
|
|
164
|
+
|
|
165
|
+
return staticModifier + this.getKind( item ) + '-' + item.name;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Returns the long names of the events that are fired from the signature.
|
|
170
|
+
*
|
|
171
|
+
* @param {TypedocReflectionMeta} signature
|
|
172
|
+
* @param {String} parentName
|
|
173
|
+
* @returns {Array.<String>|null}
|
|
174
|
+
*/
|
|
175
|
+
getFiredEvents( signature, parentName ) {
|
|
176
|
+
if ( !signature.comment || !signature.comment.blockTags ) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return signature.comment.blockTags
|
|
181
|
+
.filter( blockTag => blockTag.tag === '@fires' )
|
|
182
|
+
.map( blockTag => {
|
|
183
|
+
const content = blockTag.content[ 0 ].text;
|
|
184
|
+
|
|
185
|
+
if ( content.startsWith( 'module:' ) ) {
|
|
186
|
+
return content;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return `${ parentName }#event:${ content }`;
|
|
190
|
+
} );
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Returns the URL to GitHub with selected line, where the given doclet is defined.
|
|
195
|
+
* The URL includes a commit hash which was used to build the API docs.
|
|
196
|
+
*
|
|
197
|
+
* @param {TypedocReflection<TypedocParsers>} item
|
|
198
|
+
* @param {Number} sourceIndex
|
|
199
|
+
* @returns {Object|null}
|
|
200
|
+
*/
|
|
201
|
+
getFile( item, sourceIndex = 0 ) {
|
|
202
|
+
if ( !item.sources ) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const { url } = item.sources[ sourceIndex ];
|
|
207
|
+
|
|
208
|
+
if ( !url ) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return { url };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Returns links from the "@see" tags.
|
|
217
|
+
*
|
|
218
|
+
* @param {TypedocReflectionMeta} item
|
|
219
|
+
* @param {String|null} [parentName=null]
|
|
220
|
+
* @returns {Array.<String>}
|
|
221
|
+
*/
|
|
222
|
+
getRelated( item, parentName ) {
|
|
223
|
+
if ( !item.comment || !item.comment.blockTags ) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return item.comment.blockTags
|
|
228
|
+
.filter( blockTag => blockTag.tag === '@see' )
|
|
229
|
+
.flatMap( blockTag => {
|
|
230
|
+
const items = blockTag.content
|
|
231
|
+
.map( ( { text } ) => text.trim() )
|
|
232
|
+
// To remove list markers.
|
|
233
|
+
.filter( text => text.length > 1 );
|
|
234
|
+
|
|
235
|
+
if ( !parentName ) {
|
|
236
|
+
return items;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return items.map( text => {
|
|
240
|
+
// A full reference to a module.
|
|
241
|
+
if ( text.startsWith( 'module:' ) ) {
|
|
242
|
+
return text;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// A short reference to an existing item in the `parentName` module.
|
|
246
|
+
if ( text.startsWith( '~' ) ) {
|
|
247
|
+
const [ moduleName ] = parentName.split( '~' );
|
|
248
|
+
|
|
249
|
+
return moduleName + text;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return parentName + text;
|
|
253
|
+
} );
|
|
254
|
+
} );
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Checks if the item is readonly.
|
|
259
|
+
*
|
|
260
|
+
* The readonly state can be marked either by a TypeScript `readonly` keyword, or by the `@readonly` JSDoc keyword.
|
|
261
|
+
*
|
|
262
|
+
* @param {TypedocReflection} item
|
|
263
|
+
* @returns {Boolean}
|
|
264
|
+
*/
|
|
265
|
+
isReadonly( item ) {
|
|
266
|
+
if ( item.flags && item.flags.isReadonly ) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Checks if the item is observable.
|
|
275
|
+
*
|
|
276
|
+
* The observable state can be marked by the `@observable` JSDoc keyword.
|
|
277
|
+
*
|
|
278
|
+
* @param {TypedocReflectionMeta} item
|
|
279
|
+
* @returns {Boolean}
|
|
280
|
+
*/
|
|
281
|
+
isObservable( item ) {
|
|
282
|
+
if ( item.comment && item.comment.blockTags ) {
|
|
283
|
+
return item.comment.blockTags.some( tag => tag.tag === '@observable' );
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Checks if the item is marked as an optional.
|
|
291
|
+
*
|
|
292
|
+
* @param {TypedocReflectionMeta} item
|
|
293
|
+
* @returns {Boolean}
|
|
294
|
+
*/
|
|
295
|
+
isOptional( item ) {
|
|
296
|
+
if ( item.flags && item.flags.isOptional ) {
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Checks if the member is marked as `internal` one.
|
|
305
|
+
*
|
|
306
|
+
* The `internal` state means the same as `protected`, but with one exception: the `internal` member can be used from outside the class
|
|
307
|
+
* in which it is defined (or its derivatives), as opposed to the `protected` state.
|
|
308
|
+
*
|
|
309
|
+
* @param {TypedocReflectionMeta} item
|
|
310
|
+
* @returns {Boolean}
|
|
311
|
+
*/
|
|
312
|
+
isInternal( item ) {
|
|
313
|
+
if ( item.comment && item.comment.modifierTags ) {
|
|
314
|
+
return item.comment.modifierTags.some( tag => tag === '@internal' );
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Checks if the member is marked by the `@deprecated` JSDoc tag.
|
|
322
|
+
*
|
|
323
|
+
* @param {TypedocReflectionMeta>} item
|
|
324
|
+
* @returns {Boolean}
|
|
325
|
+
*/
|
|
326
|
+
isDeprecated( item ) {
|
|
327
|
+
if ( item.comment && item.comment.blockTags ) {
|
|
328
|
+
return item.comment.blockTags.some( tag => tag.tag === '@deprecated' );
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Checks if the member contains the `@skipSource` annotation.
|
|
336
|
+
*
|
|
337
|
+
* Note: The `skipSource` flag can be set to `true` even if the member does not contain the annotation.
|
|
338
|
+
* It happens when the member has not specified `file` property. In such a case, Umberto does not know
|
|
339
|
+
* where to point to a source and decides to skip generating the "See source" button.
|
|
340
|
+
*
|
|
341
|
+
* @param {TypedocReflectionMeta} item
|
|
342
|
+
* @returns {Boolean}
|
|
343
|
+
*/
|
|
344
|
+
shouldSkipSource( item ) {
|
|
345
|
+
if ( item.comment && item.comment.modifierTags ) {
|
|
346
|
+
return item.comment.modifierTags.some( tag => tag === '@skipSource' );
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Returns a name specified in the `@label` annotation.
|
|
354
|
+
*
|
|
355
|
+
* @protected
|
|
356
|
+
* @param {TypedocReflectionMeta} item
|
|
357
|
+
* @returns {String}
|
|
358
|
+
*/
|
|
359
|
+
_getLabelName( item ) {
|
|
360
|
+
if ( item.comment && item.comment.blockTags ) {
|
|
361
|
+
const labelComment = item.comment.blockTags.find( tag => tag.tag === '@label' );
|
|
362
|
+
|
|
363
|
+
if ( !labelComment ) {
|
|
364
|
+
return '';
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return labelComment.content[ 0 ].text;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return '';
|
|
371
|
+
}
|
|
372
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
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 AccessorParser extends AbstractParser {
|
|
11
|
+
/**
|
|
12
|
+
* @param {TypedocReflectionMeta} item
|
|
13
|
+
* @returns {Boolean}
|
|
14
|
+
*/
|
|
15
|
+
canParse( item ) {
|
|
16
|
+
return item.kindString === 'Accessor';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the accessor is readonly.
|
|
21
|
+
*
|
|
22
|
+
* @override
|
|
23
|
+
* @param {TypedocReflection} item
|
|
24
|
+
* @returns {Boolean}
|
|
25
|
+
*/
|
|
26
|
+
isReadonly( item ) {
|
|
27
|
+
return !item.setSignature;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {TypedocReflection<'Accessor'>} item
|
|
32
|
+
* @param {String} parentName
|
|
33
|
+
* @returns {Object}
|
|
34
|
+
*/
|
|
35
|
+
parse( item, parentName ) {
|
|
36
|
+
// A getter and setter can't be overloaded, so their first signature (if exists) is the only one.
|
|
37
|
+
// Starting from `typedoc@0.23`, these properties are no longer an array.
|
|
38
|
+
const { getSignature, setSignature } = item;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
// Needed for post-processing once all project reflections are converted.
|
|
42
|
+
_signature: [ getSignature || {}, setSignature || {} ],
|
|
43
|
+
|
|
44
|
+
name: item.name,
|
|
45
|
+
memberof: parentName,
|
|
46
|
+
longname: this.getLongName( item, parentName ),
|
|
47
|
+
|
|
48
|
+
scope: this.getScope( item ),
|
|
49
|
+
readonly: this.isReadonly( item ),
|
|
50
|
+
access: this.getVisibility( item ),
|
|
51
|
+
kind: this.getKind( item ),
|
|
52
|
+
extraId: this.getExtraId( item ),
|
|
53
|
+
description: this.getComment( getSignature || setSignature ),
|
|
54
|
+
file: this.getFile( item ),
|
|
55
|
+
skipSource: this.shouldSkipSource( getSignature || setSignature ),
|
|
56
|
+
deprecated: this.isDeprecated( getSignature || setSignature ),
|
|
57
|
+
inherited: !!item.inheritedFrom,
|
|
58
|
+
|
|
59
|
+
// These properties will be filled in the post-processing phase.
|
|
60
|
+
type: null,
|
|
61
|
+
params: null
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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 ClassParser extends AbstractParser {
|
|
11
|
+
/**
|
|
12
|
+
* @param {TypedocReflectionMeta} item
|
|
13
|
+
* @returns {Boolean}
|
|
14
|
+
*/
|
|
15
|
+
canParse( item ) {
|
|
16
|
+
return item.kindString === 'Class';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {TypedocReflection<'Class'>} 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
|
+
access: this.getVisibility( item ),
|
|
35
|
+
kind: this.getKind( item ),
|
|
36
|
+
extraId: this.getExtraId( item ),
|
|
37
|
+
description: this.getComment( item ),
|
|
38
|
+
file: this.getFile( item ),
|
|
39
|
+
skipSource: this.shouldSkipSource( item ),
|
|
40
|
+
deprecated: this.isDeprecated( item ),
|
|
41
|
+
|
|
42
|
+
// Properties specified below will be mapped to module names once the entire project is transformed.
|
|
43
|
+
typeParameters: null,
|
|
44
|
+
augmentsNested: null,
|
|
45
|
+
implementsNested: null,
|
|
46
|
+
descendants: null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 ConstantParser extends AbstractParser {
|
|
11
|
+
/**
|
|
12
|
+
* @param {TypedocReflectionMeta} item
|
|
13
|
+
* @returns {Boolean}
|
|
14
|
+
*/
|
|
15
|
+
canParse( item ) {
|
|
16
|
+
return item.kindString === 'Variable';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {TypedocReflection<'Variable'>} 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: 'inner',
|
|
34
|
+
kind: this.getKind( item ),
|
|
35
|
+
extraId: `constant-${ item.name }`,
|
|
36
|
+
file: this.getFile( item ),
|
|
37
|
+
skipSource: this.shouldSkipSource( item ),
|
|
38
|
+
description: this.getComment( item ),
|
|
39
|
+
deprecated: this.isDeprecated( item ),
|
|
40
|
+
|
|
41
|
+
// This property will be filled in the post-processing phase.
|
|
42
|
+
type: null
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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 MethodParser = require( './methodparser' );
|
|
9
|
+
|
|
10
|
+
module.exports = class ConstructorParser extends MethodParser {
|
|
11
|
+
/**
|
|
12
|
+
* @param {TypedocReflectionMeta} item
|
|
13
|
+
* @returns {Boolean}
|
|
14
|
+
*/
|
|
15
|
+
canParse( item ) {
|
|
16
|
+
return item.kindString === 'Constructor';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {TypedocReflection<'Constructor'>} item
|
|
21
|
+
* @param {String} parentName
|
|
22
|
+
* @returns {Array.<Object>}
|
|
23
|
+
*/
|
|
24
|
+
parse( item, parentName ) {
|
|
25
|
+
const results = super.parse( item, parentName );
|
|
26
|
+
|
|
27
|
+
for ( const item of results ) {
|
|
28
|
+
// Constructors cannot return any value.
|
|
29
|
+
delete item.returns;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return results;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
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 ErrorParser extends AbstractParser {
|
|
11
|
+
/**
|
|
12
|
+
* @param {TypedocReflectionMeta} item
|
|
13
|
+
* @returns {Boolean}
|
|
14
|
+
*/
|
|
15
|
+
canParse( item ) {
|
|
16
|
+
return item.kindString === 'Error';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {TypedocReflection<'Error'>} item
|
|
21
|
+
* @returns {Object}
|
|
22
|
+
*/
|
|
23
|
+
parse( item ) {
|
|
24
|
+
return {
|
|
25
|
+
_signature: [
|
|
26
|
+
{},
|
|
27
|
+
// As errors are our custom implementation, TypeDoc does not allow creating `parameters` property for them. Error parameters
|
|
28
|
+
// are passed in `typeParameters` property. To process the error parameters properly, we manually map `typeParameters` into
|
|
29
|
+
// `parameters` property.
|
|
30
|
+
{ parameters: item.typeParameters }
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
kind: this.getKind( item ),
|
|
34
|
+
scope: 'inner',
|
|
35
|
+
name: item.name,
|
|
36
|
+
longname: `module:errors/${ item.name }`,
|
|
37
|
+
extraId: this.getExtraId( item ),
|
|
38
|
+
description: this.getComment( item ),
|
|
39
|
+
|
|
40
|
+
// This property will be filled in the post-processing phase.
|
|
41
|
+
params: null
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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 EventParser extends AbstractParser {
|
|
11
|
+
/**
|
|
12
|
+
* @param {TypedocReflectionMeta} item
|
|
13
|
+
* @returns {Boolean}
|
|
14
|
+
*/
|
|
15
|
+
canParse( item ) {
|
|
16
|
+
return item.kindString === 'Event';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {TypedocReflection<'Event'>} item
|
|
21
|
+
* @param {String} parentName
|
|
22
|
+
* @returns {Object}
|
|
23
|
+
*/
|
|
24
|
+
parse( item, parentName ) {
|
|
25
|
+
// TypeDoc adds the "event:" prefix to the event name to make sure the name is unique in the scope of its parent.
|
|
26
|
+
// Here, in the parser, we do not need it anymore.
|
|
27
|
+
item.name = item.name.replace( 'event:', '' );
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
// Needed for post-processing once all project reflections are converted.
|
|
31
|
+
_signature: [
|
|
32
|
+
{},
|
|
33
|
+
// As events are our custom implementation, TypeDoc does not allow creating `parameters` property for them. Event parameters
|
|
34
|
+
// are passed in `typeParameters` property. To process the event parameters properly, we manually map `typeParameters` into
|
|
35
|
+
// `parameters` property.
|
|
36
|
+
{ parameters: item.typeParameters }
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
name: item.name,
|
|
40
|
+
memberof: parentName,
|
|
41
|
+
longname: this.getLongName( item, parentName ),
|
|
42
|
+
|
|
43
|
+
scope: this.getScope( item ),
|
|
44
|
+
kind: this.getKind( item ),
|
|
45
|
+
extraId: this.getExtraId( item ),
|
|
46
|
+
description: this.getComment( item ),
|
|
47
|
+
file: this.getFile( item ),
|
|
48
|
+
skipSource: this.shouldSkipSource( item ),
|
|
49
|
+
deprecated: this.isDeprecated( item ),
|
|
50
|
+
inherited: !!item.inheritedFrom,
|
|
51
|
+
see: this.getRelated( item, parentName ),
|
|
52
|
+
|
|
53
|
+
// These properties will be filled in the post-processing phase.
|
|
54
|
+
params: null
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|