@@ -12,35 +12,37 @@ import Extractor from '../Extractor';
1212import ResolvedApiItem from '../ResolvedApiItem' ;
1313
1414/**
15- * A "release tag" is a custom JSDoc tag which indicates whether an ApiItem definition
15+ * A "release tag" is an AEDoc tag which indicates whether an ApiItem definition
1616 * is considered Public API for third party developers, as well as its release
1717 * stage (alpha, beta, etc).
1818 * @see https://onedrive.visualstudio.com/DefaultCollection/SPPPlat/_git/sp-client
1919 * ?path=/common/docs/ApiPrinciplesAndProcess.md
2020 */
2121export enum ReleaseTag {
2222 /**
23- * No release tag was specified in the JSDoc summary.
23+ * No release tag was specified in the AEDoc summary.
2424 */
2525 None = 0 ,
2626 /**
27- * The API was documented as internal, i.e. not callable by third party developers.
27+ * Indicates that an API item is meant only for usage by other NPM packages from the same
28+ * maintainer. Third parties should never use "internal" APIs. (To emphasize this, their
29+ * names are prefixed by underscores.)
2830 */
2931 Internal = 1 ,
3032 /**
31- * The API was documented as "alpha." This status is not generally used. See the
32- * ApiPrinciplesAndProcess.md for details .
33+ * Indicates that an API item is eventually intended to be public, but currently is in an
34+ * early stage of development. Third parties should not use "alpha" APIs .
3335 */
3436 Alpha = 2 ,
3537 /**
36- * The API was documented as callable by third party developers, but at their own risk.
37- * Web parts that call beta APIs should only be used for experimentation, because the Web Part
38- * will break if Microsoft changes the API signature later .
38+ * Indicates that an API item has been released in an experimental state. Third parties are
39+ * encouraged to try it and provide feedback. However, a "beta" API should NOT be used
40+ * in production .
3941 */
4042 Beta = 3 ,
4143 /**
42- * The API was documented as callable by third party developers, with a guarantee that Microsoft will
43- * never make any breaking changes once the API is published .
44+ * Indicates that an API item has been officially released. It is part of the supported
45+ * contract (e.g. SemVer) for a package .
4446 */
4547 Public = 4
4648}
@@ -65,15 +67,14 @@ export interface IReferenceResolver {
6567
6668export default class ApiDocumentation {
6769 /**
68- * Match JsDoc block tags and inline tags
70+ * Match AEDoc block tags and inline tags
6971 * Example "@a @b@c d@e @f {whatever} {@link a} { @something } \@g" => ["@a", "@f", "{@link a}", "{ @something }"]
7072 */
71- public static readonly _jsdocTagsRegex : RegExp = / { \s * @ ( \\ { | \\ } | [ ^ { } ] ) * } | (?: ^ | \s ) ( \@ [ a - z _ ] + ) (? = \s | $ ) / gi;
73+ public static readonly _aedocTagsRegex : RegExp = / { \s * @ ( \\ { | \\ } | [ ^ { } ] ) * } | (?: ^ | \s ) ( \@ [ a - z _ ] + ) (? = \s | $ ) / gi;
7274
73- // For guidance about using these tags, please see this document:
74- // https://onedrive.visualstudio.com/DefaultCollection/SPPPlat/_git/sp-client
75- // ?path=/common/docs/ApiPrinciplesAndProcess.md
76- private static _allowedRegularJsdocTags : string [ ] = [
75+ // For guidance about using these tags, please see this documentation:
76+ // https://github.com/Microsoft/web-build-tools/wiki/API-Extractor-~-AEDoc-tags
77+ private static _allowedRegularAedocTags : string [ ] = [
7778 // (alphabetical order)
7879 '@alpha' ,
7980 '@beta' ,
@@ -91,22 +92,22 @@ export default class ApiDocumentation {
9192 '@remarks'
9293 ] ;
9394
94- private static _allowedInlineJsdocTags : string [ ] = [
95+ private static _allowedInlineAedocTags : string [ ] = [
9596 // (alphabetical order)
9697 '@inheritdoc' ,
9798 '@link'
9899 ] ;
99100
100101 /**
101- * The original JsDoc comment.
102+ * The original AEDoc comment.
102103 *
103104 * Example: "This is a summary. \{\@link a\} \@remarks These are remarks."
104105 */
105- public originalJsDoc : string ;
106+ public originalAedoc : string ;
106107
107108 /**
108109 * The docComment text string split into an array of ITokenItems. The tokens are essentially either
109- * JSDoc tags (which start with the "@" character) or substrings containing the
110+ * AEDoc tags (which start with the "@" character) or substrings containing the
110111 * remaining text. The array can be empty, but not undefined.
111112 * Example:
112113 * docComment = "Example Function\n@returns the number of items\n@internal "
@@ -145,7 +146,7 @@ export default class ApiDocumentation {
145146 public incompleteInheritdocs : Token [ ] ;
146147
147148 /**
148- * A "release tag" is a custom JSDoc tag which indicates whether this definition
149+ * A "release tag" is an AEDoc tag which indicates whether this definition
149150 * is considered Public API for third party developers, as well as its release
150151 * stage (alpha, beta, etc).
151152 */
@@ -192,7 +193,7 @@ export default class ApiDocumentation {
192193 extractor : Extractor ,
193194 errorLogger : ( message : string ) => void ,
194195 warnings : string [ ] ) {
195- this . originalJsDoc = docComment ;
196+ this . originalAedoc = docComment ;
196197 this . referenceResolver = referenceResolver ;
197198 this . extractor = extractor ;
198199 this . reportError = errorLogger ;
@@ -220,7 +221,7 @@ export default class ApiDocumentation {
220221 this . incompleteLinks = [ ] ;
221222 this . incompleteInheritdocs = [ ] ;
222223 this . releaseTag = ReleaseTag . None ;
223- const tokenizer : Tokenizer = new Tokenizer ( this . originalJsDoc , this . reportError ) ;
224+ const tokenizer : Tokenizer = new Tokenizer ( this . originalAedoc , this . reportError ) ;
224225 this . summary = DocElementParser . parse ( this , tokenizer ) ;
225226
226227 let releaseTagCount : number = 0 ;
@@ -264,7 +265,7 @@ export default class ApiDocumentation {
264265 tokenizer . getToken ( ) ;
265266 this . deprecatedMessage = DocElementParser . parse ( this , tokenizer ) ;
266267 if ( ! this . deprecatedMessage || this . deprecatedMessage . length === 0 ) {
267- this . reportError ( `deprecated description required after @deprecated JSDoc tag.` ) ;
268+ this . reportError ( `deprecated description required after @deprecated AEDoc tag.` ) ;
268269 }
269270 break ;
270271 case '@internalremarks' :
@@ -306,7 +307,7 @@ export default class ApiDocumentation {
306307 break ;
307308 default :
308309 tokenizer . getToken ( ) ;
309- this . _reportBadJSDocTag ( token ) ;
310+ this . _reportBadAedocTag ( token ) ;
310311 }
311312 } else if ( token . type === TokenType . Inline ) {
312313 switch ( token . tag ) {
@@ -318,7 +319,7 @@ export default class ApiDocumentation {
318319 break ;
319320 default :
320321 tokenizer . getToken ( ) ;
321- this . _reportBadJSDocTag ( token ) ;
322+ this . _reportBadAedocTag ( token ) ;
322323 break ;
323324 }
324325 } else if ( token . type === TokenType . Text ) {
@@ -329,7 +330,7 @@ export default class ApiDocumentation {
329330 if ( problemText . length > MAX_LENGTH ) {
330331 problemText = problemText . substr ( 0 , MAX_LENGTH - 3 ) . trim ( ) + '...' ;
331332 }
332- this . reportError ( `Unexpected text in JSDoc comment: "${ problemText } "` ) ;
333+ this . reportError ( `Unexpected text in AEDoc comment: "${ problemText } "` ) ;
333334 } else {
334335 tokenizer . getToken ( ) ;
335336 // This would be a program bug
@@ -420,31 +421,31 @@ export default class ApiDocumentation {
420421 }
421422 }
422423
423- private _reportBadJSDocTag ( token : Token ) : void {
424- const supportsRegular : boolean = ApiDocumentation . _allowedRegularJsdocTags . indexOf ( token . tag ) >= 0 ;
425- const supportsInline : boolean = ApiDocumentation . _allowedInlineJsdocTags . indexOf ( token . tag ) >= 0 ;
424+ private _reportBadAedocTag ( token : Token ) : void {
425+ const supportsRegular : boolean = ApiDocumentation . _allowedRegularAedocTags . indexOf ( token . tag ) >= 0 ;
426+ const supportsInline : boolean = ApiDocumentation . _allowedInlineAedocTags . indexOf ( token . tag ) >= 0 ;
426427
427428 if ( ! supportsRegular && ! supportsInline ) {
428- this . reportError ( `Unknown JSDoc tag \"${ token . tag } \"` ) ;
429+ this . reportError ( `Unknown AEDoc tag \"${ token . tag } \"` ) ;
429430 return ;
430431 }
431432
432433 if ( token . type === TokenType . Inline && ! supportsInline ) {
433- this . reportError ( `The JSDoc tag \"${ token . tag } \" must not use the non-inline syntax (no curly braces)` ) ;
434+ this . reportError ( `The AEDoc tag \"${ token . tag } \" must not use the non-inline syntax (no curly braces)` ) ;
434435 return ;
435436 }
436437 if ( token . type === TokenType . Tag && ! supportsRegular ) {
437- this . reportError ( `The JSDoc tag \"${ token . tag } \" must use the inline syntax (with curly braces)` ) ;
438+ this . reportError ( `The AEDoc tag \"${ token . tag } \" must use the inline syntax (with curly braces)` ) ;
438439 return ;
439440 }
440441
441- this . reportError ( `The JSDoc tag \"${ token . tag } \" is not supported in this context` ) ;
442+ this . reportError ( `The AEDoc tag \"${ token . tag } \" is not supported in this context` ) ;
442443 return ;
443444 }
444445
445446 private _checkInheritDocStatus ( ) : void {
446447 if ( this . isDocInherited ) {
447- this . reportError ( 'Cannot provide additional JSDoc tags if @inheritdoc tag is present' ) ;
448+ this . reportError ( 'Cannot provide additional AEDoc tags if @inheritdoc tag is present' ) ;
448449 }
449450 }
450451}
0 commit comments