Skip to content

Commit 504b75b

Browse files
committed
Standardize usage of "AEDoc" and "JSDoc" terminology
1 parent 4bbde5a commit 504b75b

23 files changed

Lines changed: 135 additions & 131 deletions

‎libraries/api-extractor/CHANGELOG.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@
338338
"comments": {
339339
"patch": [
340340
{
341-
"comment": "Check for missing JsDoc sequences changed."
341+
"comment": "Check for missing JSDoc sequences changed."
342342
},
343343
{
344344
"comment": "Improved error messages"

‎libraries/api-extractor/CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Thu, 19 Jan 2017 20:04:40 GMT
196196

197197
### Patches
198198

199-
- Check for missing JsDoc sequences changed.
199+
- Check for missing JSDoc sequences changed.
200200
- Improved error messages
201201

202202
## 1.1.0

‎libraries/api-extractor/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"typescript",
77
"API",
88
"JSDoc",
9+
"AEDoc",
910
"generate",
1011
"documentation",
1112
"compiler",

‎libraries/api-extractor/src/DocElementParser.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default class DocElementParser {
9090
case '@inheritdoc':
9191
tokenizer.getToken();
9292
if (docElements.length > 0 || documentation.summary.length > 0) {
93-
documentation.reportError('Cannot provide summary in JsDoc if @inheritdoc tag is given');
93+
documentation.reportError('Cannot provide summary in AEDoc if @inheritdoc tag is given');
9494
}
9595
documentation.incompleteInheritdocs.push(token);
9696
documentation.isDocInherited = true;

‎libraries/api-extractor/src/Token.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export enum TokenType {
2525
}
2626

2727
/**
28-
* A structured object created from a doc comment string within a JSDoc comment block.
28+
* A structured object created from a doc comment string within an AEDoc comment block.
2929
*/
3030
export default class Token {
3131

‎libraries/api-extractor/src/Tokenizer.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import Token, { TokenType } from './Token';
22
import TypeScriptHelpers from './TypeScriptHelpers';
33

44
/**
5-
* Handles the tokenization of a JSDoc comment.
5+
* Handles the tokenization of an AEDoc comment.
66
*/
77
export default class Tokenizer {
88

99
/**
10-
* Match JsDoc block tags and inline tags
10+
* Match AEDoc block tags and inline tags
1111
* Example "@a @b@c d@e @f {whatever} {@link a} { @something } \@g" => ["@a", "@f", "{@link a}", "{ @something }"]
1212
*/
13-
private static _jsdocTagsRegex: RegExp = /{\s*@(\\{|\\}|[^{}])*}|(?:^|\s)(\@[a-z_]+)(?=\s|$)/gi;
13+
private static _aedocTagsRegex: RegExp = /{\s*@(\\{|\\}|[^{}])*}|(?:^|\s)(\@[a-z_]+)(?=\s|$)/gi;
1414

1515
/**
1616
* List of Tokens that have been tokenized.
@@ -27,9 +27,9 @@ export default class Tokenizer {
2727
/**
2828
* Converts a doc comment string into an array of Tokens. This processing is done so that docs
2929
* can be processed more strictly.
30-
* Example: "This is a JsDoc description with a {@link URL} and more text. \@summary example \@public"
30+
* Example: "This is an AEDoc description with a {@link URL} and more text. \@summary example \@public"
3131
* => [
32-
* {tokenType: 'text', parameter: 'This is a JsDoc description with a'},
32+
* {tokenType: 'text', parameter: 'This is an AEDoc description with a'},
3333
* {tokenType: '@link', parameter: 'URL'},
3434
* {tokenType: '\@summary', parameter: ''},
3535
* {tokenType: 'text', parameter: 'example'},
@@ -40,7 +40,7 @@ export default class Tokenizer {
4040
if (!docs) {
4141
return;
4242
}
43-
const docEntries: string[] = TypeScriptHelpers.splitStringWithRegEx(docs, Tokenizer._jsdocTagsRegex);
43+
const docEntries: string[] = TypeScriptHelpers.splitStringWithRegEx(docs, Tokenizer._aedocTagsRegex);
4444
const sanitizedTokens: string[] = this._sanitizeDocEntries(docEntries); // remove white space and empty entries
4545

4646
// process each sanitized doc string to a Token object

‎libraries/api-extractor/src/TypeScriptHelpers.ts‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ export default class TypeScriptHelpers {
1313
/**
1414
* Start sequence is '/**'.
1515
*/
16-
public static jsDocStartRegEx: RegExp = /^\s*\/\*\*\s?/g;
16+
public static jsdocStartRegEx: RegExp = /^\s*\/\*\*\s?/g;
1717

1818
/**
1919
* End sequence is '*\/'.
2020
*/
21-
public static jsDocEndRegEx: RegExp = /\s*\*\/\s*$/g;
21+
public static jsdocEndRegEx: RegExp = /\s*\*\/\s*$/g;
2222

2323
/**
2424
* Intermediate lines of JSDoc comment character.
2525
*/
26-
public static jsDocIntermediateRegEx: RegExp = /^\s*[*]\s?/g;
26+
public static jsdocIntermediateRegEx: RegExp = /^\s*[*]\s?/g;
2727

2828
/**
2929
* Returns the Symbol for the provided Declaration. This is a workaround for a missing
@@ -59,34 +59,34 @@ export default class TypeScriptHelpers {
5959
* Example:
6060
* "This \n is \n a comment" from "\/** This\r\n* is\r\n* a comment *\/
6161
*/
62-
public static getJsDocComments(node: ts.Node, errorLogger: (message: string) => void): string {
63-
let jsDoc: string = '';
62+
public static getJsdocComments(node: ts.Node, errorLogger: (message: string) => void): string {
63+
let jsdoc: string = '';
6464
// tslint:disable-next-line:no-any
65-
const nodeJsDocObjects: any = (node as any).jsDoc;
66-
if (nodeJsDocObjects && nodeJsDocObjects.length > 0) {
65+
const nodeJsdocObjects: any = (node as any).jsDoc;
66+
if (nodeJsdocObjects && nodeJsdocObjects.length > 0) {
6767
// Use the JSDoc closest to the declaration
68-
const lastJsDocIndex: number = nodeJsDocObjects.length - 1;
69-
const jsDocFullText: string = nodeJsDocObjects[lastJsDocIndex].getText();
70-
const jsDocLines: string[] = jsDocFullText.split(TypeScriptHelpers.newLineRegEx);
71-
const jsDocStartSeqExists: boolean = TypeScriptHelpers.jsDocStartRegEx.test(jsDocLines[0].toString());
68+
const lastJsdocIndex: number = nodeJsdocObjects.length - 1;
69+
const jsdocFullText: string = nodeJsdocObjects[lastJsdocIndex].getText();
70+
const jsdocLines: string[] = jsdocFullText.split(TypeScriptHelpers.newLineRegEx);
71+
const jsdocStartSeqExists: boolean = TypeScriptHelpers.jsdocStartRegEx.test(jsdocLines[0].toString());
7272

7373
// Report error for each missing sequence seperately
74-
if (!jsDocStartSeqExists) {
75-
errorLogger('JsDoc comment must begin with a \"/**\" sequence.');
74+
if (!jsdocStartSeqExists) {
75+
errorLogger('Jsdoc comment must begin with a \"/**\" sequence.');
7676
return '';
7777
}
78-
const jsDocEndSeqExists: boolean = TypeScriptHelpers.jsDocEndRegEx.test(
79-
jsDocLines[jsDocLines.length - 1].toString()
78+
const jsdocEndSeqExists: boolean = TypeScriptHelpers.jsdocEndRegEx.test(
79+
jsdocLines[jsdocLines.length - 1].toString()
8080
);
81-
if (!jsDocEndSeqExists) {
82-
errorLogger('JsDoc comment must end with a \"*/\" sequence.');
81+
if (!jsdocEndSeqExists) {
82+
errorLogger('Jsdoc comment must end with a \"*/\" sequence.');
8383
return '';
8484
}
8585

86-
jsDoc = TypeScriptHelpers.removeJsDocSequences(jsDocLines);
86+
jsdoc = TypeScriptHelpers.removeJsdocSequences(jsdocLines);
8787
}
8888

89-
return jsDoc;
89+
return jsdoc;
9090
}
9191

9292
/**
@@ -95,15 +95,15 @@ export default class TypeScriptHelpers {
9595
* Example:
9696
* ["\/**", "*This \n", "*is \n", "*a comment", "*\/"] to "This \n is \n a comment"
9797
*/
98-
public static removeJsDocSequences(textLines: string[]): string {
98+
public static removeJsdocSequences(textLines: string[]): string {
9999
// Remove '/**'
100-
textLines[0] = textLines[0].replace(TypeScriptHelpers.jsDocStartRegEx, '');
100+
textLines[0] = textLines[0].replace(TypeScriptHelpers.jsdocStartRegEx, '');
101101
if (textLines[0] === '') {
102102
textLines.shift();
103103
}
104104
// Remove '*/'
105105
textLines[textLines.length - 1] = textLines[textLines.length - 1].replace(
106-
TypeScriptHelpers.jsDocEndRegEx,
106+
TypeScriptHelpers.jsdocEndRegEx,
107107
'');
108108
if (textLines[textLines.length - 1] === '') {
109109
textLines.pop();
@@ -112,7 +112,7 @@ export default class TypeScriptHelpers {
112112
// Remove the leading '*' from any intermediate lines
113113
if (textLines.length > 0) {
114114
for (let i: number = 0; i < textLines.length; i++) {
115-
textLines[i] = textLines[i].replace(TypeScriptHelpers.jsDocIntermediateRegEx, '');
115+
textLines[i] = textLines[i].replace(TypeScriptHelpers.jsdocIntermediateRegEx, '');
116116
}
117117
}
118118

‎libraries/api-extractor/src/definitions/ApiDocumentation.ts‎

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,37 @@ import Extractor from '../Extractor';
1212
import 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
*/
2121
export 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

6668
export 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

Comments
 (0)