refactor(ivy): Update @publicApi to @codeGenApi on ivy instructions (#29820)

- Removes `@publicApi` annotation from ivy instructions
- Adds new `@codeGenApi` annotation to ivy instructions
- Updates ts_api_guardian to support the new annotation properly

PR Close #29820
This commit is contained in:
Ben Lesh
2019-04-10 13:45:26 -07:00
committed by Igor Minar
parent def73a6728
commit ddadb8e22c
32 changed files with 142 additions and 127 deletions

View File

@ -17,9 +17,10 @@ const baseTsOptions: ts.CompilerOptions = {
export interface JsDocTagOptions {
/**
* An array of names of jsdoc tags that must exist.
* An array of names of jsdoc tags, one of which must exist. If no tags are provided, there are no
* required tags.
*/
required?: string[];
requireAtLeastOne?: string[];
/**
* An array of names of jsdoc tags that must not exist.
@ -316,15 +317,16 @@ class ResolvedDeclarationEmitter {
private processJsDocTags(node: ts.Node, tagOptions: JsDocTagOptions) {
const jsDocTags = getJsDocTags(node);
const missingRequiredTags =
tagOptions.required.filter(requiredTag => jsDocTags.every(tag => tag !== requiredTag));
if (missingRequiredTags.length) {
const requireAtLeastOne = tagOptions.requireAtLeastOne;
const isMissingAnyRequiredTag = requireAtLeastOne != null && requireAtLeastOne.length > 0 &&
jsDocTags.every(tag => requireAtLeastOne.indexOf(tag) === -1);
if (isMissingAnyRequiredTag) {
this.diagnostics.push({
type: 'error',
message: createErrorMessage(
node, 'Required jsdoc tags - ' +
missingRequiredTags.map(tag => `"@${tag}"`).join(', ') +
` - are missing on ${getName(node)}.`)
node, 'Required jsdoc tags - One of the tags: ' +
requireAtLeastOne.map(tag => `"@${tag}"`).join(', ') +
` - must exist on ${getName(node)}.`)
});
}
const bannedTagsFound =
@ -436,7 +438,7 @@ function hasModifier(node: ts.Node, modifierKind: ts.SyntaxKind): boolean {
}
function applyDefaultTagOptions(tagOptions: JsDocTagOptions | undefined): JsDocTagOptions {
return {required: [], banned: [], toCopy: [], ...tagOptions};
return {requireAtLeastOne: [], banned: [], toCopy: [], ...tagOptions};
}
function getName(node: any) {