@@ -10,6 +10,7 @@ import DocItemLoader from '../DocItemLoader';
1010import { IApiDefinitionReference } from '../IApiDefinitionReference' ;
1111import Token , { TokenType } from '../Token' ;
1212import Tokenizer from '../Tokenizer' ;
13+ import ApiPackage from './ApiPackage' ;
1314
1415/**
1516 * An "API Tag" is a custom JSDoc tag which indicates whether an ApiItem definition
@@ -22,27 +23,27 @@ export enum ApiTag {
2223 /**
2324 * No API Tag was specified in the JSDoc summary.
2425 */
25- None ,
26+ None = 0 ,
2627 /**
2728 * The API was documented as internal, i.e. not callable by third party developers.
2829 */
29- Internal ,
30+ Internal = 1 ,
3031 /**
3132 * The API was documented as "alpha." This status is not generally used. See the
3233 * ApiPrinciplesAndProcess.md for details.
3334 */
34- Alpha ,
35+ Alpha = 2 ,
3536 /**
3637 * The API was documented as callable by third party developers, but at their own risk.
3738 * Web parts that call beta APIs should only be used for experimentation, because the Web Part
3839 * will break if Microsoft changes the API signature later.
3940 */
40- Beta ,
41+ Beta = 3 ,
4142 /**
4243 * The API was documented as callable by third party developers, with a guarantee that Microsoft will
4344 * never make any breaking changes once the API is published.
4445 */
45- Public
46+ Public = 4
4647}
4748
4849/**
@@ -253,8 +254,10 @@ export default class ApiDocumentation {
253254 }
254255
255256 protected _getJsDocs ( apiItem : ApiItem ) : string {
256- const sourceFile : ts . SourceFile = apiItem . getDeclaration ( ) . getSourceFile ( ) ;
257- const jsDoc : string = TypeScriptHelpers . getJsDocComments ( apiItem . getDeclaration ( ) , this . reportError ) ;
257+ if ( ! apiItem . jsdocNode ) {
258+ return '' ;
259+ }
260+ const jsDoc : string = TypeScriptHelpers . getJsDocComments ( apiItem . jsdocNode , this . reportError ) ;
258261
259262 // Eliminate tags and then count the English letters. Are there at least 10 letters of text?
260263 // If not, we consider the definition to be "missingDocumentation".
@@ -402,6 +405,14 @@ export default class ApiDocumentation {
402405 this . reportError ( 'More than one API Tag was specified' ) ;
403406 }
404407
408+ if ( this . apiItem instanceof ApiPackage ) {
409+ if ( apiTagCount > 0 ) {
410+ const tag : string = '@' + ApiTag [ this . apiTag ] . toLowerCase ( ) ;
411+ this . reportError ( `The ${ tag } tag is not allowed on the package, which is always public` ) ;
412+ }
413+ this . apiTag = ApiTag . Public ;
414+ }
415+
405416 if ( this . preapproved ) {
406417 if ( this . apiTag !== ApiTag . Internal ) {
407418 this . reportError ( 'The @preapproved tag may only be applied to @internal defintions' ) ;
0 commit comments