This commit is contained in:
2024-02-07 01:33:07 -05:00
commit c1af19d441
4088 changed files with 1260170 additions and 0 deletions

View File

@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModifierTagSet = void 0;
var TSDocTagDefinition_1 = require("../configuration/TSDocTagDefinition");
/**
* Represents a set of modifier tags that were extracted from a doc comment.
*
* @remarks
* TSDoc modifier tags are block tags that do not have any associated rich text content.
* Instead, their presence or absence acts as an on/off switch, indicating some aspect
* of the underlying API item. For example, the `@internal` modifier indicates that a
* signature is internal (i.e. not part of the public API contract).
*/
var ModifierTagSet = /** @class */ (function () {
function ModifierTagSet() {
this._nodes = [];
// NOTE: To implement case insensitivity, the keys in this set are always upper-case.
// This convention makes the normalization more obvious (and as a general practice handles
// the Turkish "i" character correctly).
this._nodesByName = new Map();
}
Object.defineProperty(ModifierTagSet.prototype, "nodes", {
/**
* The original block tag nodes that defined the modifiers in this set, excluding duplicates.
*/
get: function () {
return this._nodes;
},
enumerable: false,
configurable: true
});
/**
* Returns true if the set contains a DocBlockTag with the specified tag name.
* Note that synonyms are not considered. The comparison is case-insensitive.
* @param modifierTagName - The name of the tag, including the `@` prefix For example, `@internal`
*/
ModifierTagSet.prototype.hasTagName = function (modifierTagName) {
return this._nodesByName.has(modifierTagName.toUpperCase());
};
/**
* Returns true if the set contains a DocBlockTag matching the specified tag definition.
* Note that synonyms are not considered. The comparison is case-insensitive.
* The TSDocTagDefinition must be a modifier tag.
* @param tagName - The name of the tag, including the `@` prefix For example, `@internal`
*/
ModifierTagSet.prototype.hasTag = function (modifierTagDefinition) {
return !!this.tryGetTag(modifierTagDefinition);
};
/**
* Returns a DocBlockTag matching the specified tag definition, or undefined if no such
* tag was added to the set. If there were multiple instances, returned object will be
* the first one to be added.
*/
ModifierTagSet.prototype.tryGetTag = function (modifierTagDefinition) {
if (modifierTagDefinition.syntaxKind !== TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag) {
throw new Error('The tag definition is not a modifier tag');
}
return this._nodesByName.get(modifierTagDefinition.tagNameWithUpperCase);
};
/**
* Adds a new modifier tag to the set. If a tag already exists with the same name,
* then no change is made, and the return value is false.
*/
ModifierTagSet.prototype.addTag = function (blockTag) {
if (this._nodesByName.has(blockTag.tagNameWithUpperCase)) {
return false;
}
this._nodesByName.set(blockTag.tagNameWithUpperCase, blockTag);
this._nodes.push(blockTag);
return true;
};
return ModifierTagSet;
}());
exports.ModifierTagSet = ModifierTagSet;
//# sourceMappingURL=ModifierTagSet.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ModifierTagSet.js","sourceRoot":"","sources":["../../src/details/ModifierTagSet.ts"],"names":[],"mappings":";;;AACA,0EAA6F;AAE7F;;;;;;;;GAQG;AACH;IAAA;QACmB,WAAM,GAAkB,EAAE,CAAC;QAE5C,qFAAqF;QACrF,0FAA0F;QAC1F,wCAAwC;QACvB,iBAAY,GAA6B,IAAI,GAAG,EAAuB,CAAC;IAsD3F,CAAC;IAjDC,sBAAW,iCAAK;QAHhB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAED;;;;OAIG;IACI,mCAAU,GAAjB,UAAkB,eAAuB;QACvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACI,+BAAM,GAAb,UAAc,qBAAyC;QACrD,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,kCAAS,GAAhB,UAAiB,qBAAyC;QACxD,IAAI,qBAAqB,CAAC,UAAU,KAAK,uCAAkB,CAAC,WAAW,EAAE;YACvE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;IAC3E,CAAC;IAED;;;OAGG;IACI,+BAAM,GAAb,UAAc,QAAqB;QACjC,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;YACxD,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE3B,OAAO,IAAI,CAAC;IACd,CAAC;IACH,qBAAC;AAAD,CAAC,AA5DD,IA4DC;AA5DY,wCAAc","sourcesContent":["import { DocBlockTag } from '../nodes/DocBlockTag';\r\nimport { TSDocTagDefinition, TSDocTagSyntaxKind } from '../configuration/TSDocTagDefinition';\r\n\r\n/**\r\n * Represents a set of modifier tags that were extracted from a doc comment.\r\n *\r\n * @remarks\r\n * TSDoc modifier tags are block tags that do not have any associated rich text content.\r\n * Instead, their presence or absence acts as an on/off switch, indicating some aspect\r\n * of the underlying API item. For example, the `@internal` modifier indicates that a\r\n * signature is internal (i.e. not part of the public API contract).\r\n */\r\nexport class ModifierTagSet {\r\n private readonly _nodes: DocBlockTag[] = [];\r\n\r\n // NOTE: To implement case insensitivity, the keys in this set are always upper-case.\r\n // This convention makes the normalization more obvious (and as a general practice handles\r\n // the Turkish \"i\" character correctly).\r\n private readonly _nodesByName: Map<string, DocBlockTag> = new Map<string, DocBlockTag>();\r\n\r\n /**\r\n * The original block tag nodes that defined the modifiers in this set, excluding duplicates.\r\n */\r\n public get nodes(): ReadonlyArray<DocBlockTag> {\r\n return this._nodes;\r\n }\r\n\r\n /**\r\n * Returns true if the set contains a DocBlockTag with the specified tag name.\r\n * Note that synonyms are not considered. The comparison is case-insensitive.\r\n * @param modifierTagName - The name of the tag, including the `@` prefix For example, `@internal`\r\n */\r\n public hasTagName(modifierTagName: string): boolean {\r\n return this._nodesByName.has(modifierTagName.toUpperCase());\r\n }\r\n\r\n /**\r\n * Returns true if the set contains a DocBlockTag matching the specified tag definition.\r\n * Note that synonyms are not considered. The comparison is case-insensitive.\r\n * The TSDocTagDefinition must be a modifier tag.\r\n * @param tagName - The name of the tag, including the `@` prefix For example, `@internal`\r\n */\r\n public hasTag(modifierTagDefinition: TSDocTagDefinition): boolean {\r\n return !!this.tryGetTag(modifierTagDefinition);\r\n }\r\n\r\n /**\r\n * Returns a DocBlockTag matching the specified tag definition, or undefined if no such\r\n * tag was added to the set. If there were multiple instances, returned object will be\r\n * the first one to be added.\r\n */\r\n public tryGetTag(modifierTagDefinition: TSDocTagDefinition): DocBlockTag | undefined {\r\n if (modifierTagDefinition.syntaxKind !== TSDocTagSyntaxKind.ModifierTag) {\r\n throw new Error('The tag definition is not a modifier tag');\r\n }\r\n return this._nodesByName.get(modifierTagDefinition.tagNameWithUpperCase);\r\n }\r\n\r\n /**\r\n * Adds a new modifier tag to the set. If a tag already exists with the same name,\r\n * then no change is made, and the return value is false.\r\n */\r\n public addTag(blockTag: DocBlockTag): boolean {\r\n if (this._nodesByName.has(blockTag.tagNameWithUpperCase)) {\r\n return false;\r\n }\r\n\r\n this._nodesByName.set(blockTag.tagNameWithUpperCase, blockTag);\r\n this._nodes.push(blockTag);\r\n\r\n return true;\r\n }\r\n}\r\n"]}

View File

@ -0,0 +1,97 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandardModifierTagSet = void 0;
var ModifierTagSet_1 = require("./ModifierTagSet");
var StandardTags_1 = require("./StandardTags");
/**
* Extends the ModifierTagSet base class with getters for modifiers that
* are part of the standardized core tags for TSDoc.
*/
var StandardModifierTagSet = /** @class */ (function (_super) {
__extends(StandardModifierTagSet, _super);
function StandardModifierTagSet() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Returns true if the `@alpha` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isAlpha = function () {
return this.hasTag(StandardTags_1.StandardTags.alpha);
};
/**
* Returns true if the `@beta` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isBeta = function () {
return this.hasTag(StandardTags_1.StandardTags.beta);
};
/**
* Returns true if the `@eventProperty` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isEventProperty = function () {
return this.hasTag(StandardTags_1.StandardTags.eventProperty);
};
/**
* Returns true if the `@experimental` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isExperimental = function () {
return this.hasTag(StandardTags_1.StandardTags.experimental);
};
/**
* Returns true if the `@internal` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isInternal = function () {
return this.hasTag(StandardTags_1.StandardTags.internal);
};
/**
* Returns true if the `@override` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isOverride = function () {
return this.hasTag(StandardTags_1.StandardTags.override);
};
/**
* Returns true if the `@packageDocumentation` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isPackageDocumentation = function () {
return this.hasTag(StandardTags_1.StandardTags.packageDocumentation);
};
/**
* Returns true if the `@public` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isPublic = function () {
return this.hasTag(StandardTags_1.StandardTags.public);
};
/**
* Returns true if the `@readonly` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isReadonly = function () {
return this.hasTag(StandardTags_1.StandardTags.readonly);
};
/**
* Returns true if the `@sealed` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isSealed = function () {
return this.hasTag(StandardTags_1.StandardTags.sealed);
};
/**
* Returns true if the `@virtual` modifier tag was specified.
*/
StandardModifierTagSet.prototype.isVirtual = function () {
return this.hasTag(StandardTags_1.StandardTags.virtual);
};
return StandardModifierTagSet;
}(ModifierTagSet_1.ModifierTagSet));
exports.StandardModifierTagSet = StandardModifierTagSet;
//# sourceMappingURL=StandardModifierTagSet.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"StandardModifierTagSet.js","sourceRoot":"","sources":["../../src/details/StandardModifierTagSet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAkD;AAClD,+CAA8C;AAE9C;;;GAGG;AACH;IAA4C,0CAAc;IAA1D;;IA6EA,CAAC;IA5EC;;OAEG;IACI,wCAAO,GAAd;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,uCAAM,GAAb;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACI,gDAAe,GAAtB;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACI,+CAAc,GAArB;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,2CAAU,GAAjB;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,2CAAU,GAAjB;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,uDAAsB,GAA7B;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,oBAAoB,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACI,yCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,2CAAU,GAAjB;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,yCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,0CAAS,GAAhB;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,2BAAY,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IACH,6BAAC;AAAD,CAAC,AA7ED,CAA4C,+BAAc,GA6EzD;AA7EY,wDAAsB","sourcesContent":["import { ModifierTagSet } from './ModifierTagSet';\r\nimport { StandardTags } from './StandardTags';\r\n\r\n/**\r\n * Extends the ModifierTagSet base class with getters for modifiers that\r\n * are part of the standardized core tags for TSDoc.\r\n */\r\nexport class StandardModifierTagSet extends ModifierTagSet {\r\n /**\r\n * Returns true if the `@alpha` modifier tag was specified.\r\n */\r\n public isAlpha(): boolean {\r\n return this.hasTag(StandardTags.alpha);\r\n }\r\n\r\n /**\r\n * Returns true if the `@beta` modifier tag was specified.\r\n */\r\n public isBeta(): boolean {\r\n return this.hasTag(StandardTags.beta);\r\n }\r\n\r\n /**\r\n * Returns true if the `@eventProperty` modifier tag was specified.\r\n */\r\n public isEventProperty(): boolean {\r\n return this.hasTag(StandardTags.eventProperty);\r\n }\r\n\r\n /**\r\n * Returns true if the `@experimental` modifier tag was specified.\r\n */\r\n public isExperimental(): boolean {\r\n return this.hasTag(StandardTags.experimental);\r\n }\r\n\r\n /**\r\n * Returns true if the `@internal` modifier tag was specified.\r\n */\r\n public isInternal(): boolean {\r\n return this.hasTag(StandardTags.internal);\r\n }\r\n\r\n /**\r\n * Returns true if the `@override` modifier tag was specified.\r\n */\r\n public isOverride(): boolean {\r\n return this.hasTag(StandardTags.override);\r\n }\r\n\r\n /**\r\n * Returns true if the `@packageDocumentation` modifier tag was specified.\r\n */\r\n public isPackageDocumentation(): boolean {\r\n return this.hasTag(StandardTags.packageDocumentation);\r\n }\r\n\r\n /**\r\n * Returns true if the `@public` modifier tag was specified.\r\n */\r\n public isPublic(): boolean {\r\n return this.hasTag(StandardTags.public);\r\n }\r\n\r\n /**\r\n * Returns true if the `@readonly` modifier tag was specified.\r\n */\r\n public isReadonly(): boolean {\r\n return this.hasTag(StandardTags.readonly);\r\n }\r\n\r\n /**\r\n * Returns true if the `@sealed` modifier tag was specified.\r\n */\r\n public isSealed(): boolean {\r\n return this.hasTag(StandardTags.sealed);\r\n }\r\n\r\n /**\r\n * Returns true if the `@virtual` modifier tag was specified.\r\n */\r\n public isVirtual(): boolean {\r\n return this.hasTag(StandardTags.virtual);\r\n }\r\n}\r\n"]}

View File

@ -0,0 +1,498 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandardTags = void 0;
var TSDocTagDefinition_1 = require("../configuration/TSDocTagDefinition");
var Standardization_1 = require("./Standardization");
/**
* Tags whose meaning is defined by the TSDoc standard.
*/
var StandardTags = /** @class */ (function () {
function StandardTags() {
}
StandardTags._defineTag = function (parameters) {
return new TSDocTagDefinition_1.TSDocTagDefinition(parameters);
};
/**
* (Discretionary)
*
* Suggested meaning: Designates that an API item's release stage is "alpha".
* It is intended to be used by third-party developers eventually, but has not
* yet been released. The tooling may trim the declaration from a public release.
*
* @remarks
* Example implementations: API Extractor
*/
StandardTags.alpha = StandardTags._defineTag({
tagName: '@alpha',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Discretionary
});
/**
* (Discretionary)
*
* Suggested meaning: Designates that an API item's release stage is "beta".
* It has been released to third-party developers experimentally for the purpose of
* collecting feedback. The API should not be used in production, because its contract may
* change without notice. The tooling may trim the declaration from a public release,
* but may include it in a developer preview release.
*
* @remarks
* Example implementations: API Extractor
*
* Synonyms: `@experimental`
*/
StandardTags.beta = StandardTags._defineTag({
tagName: '@beta',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Discretionary
});
/**
* (Extended)
*
* ECMAScript decorators are sometimes an important part of an API contract.
* However, today the TypeScript compiler does not represent decorators in the
* .d.ts output files used by API consumers. The `@decorator` tag provides a workaround,
* enabling a decorator expressions to be quoted in a doc comment.
*
* @example
* ```ts
* class Book {
* /**
* * The title of the book.
* * @decorator `@jsonSerialized`
* * @decorator `@jsonFormat(JsonFormats.Url)`
* *
*+/
* @jsonSerialized
* @jsonFormat(JsonFormats.Url)
* public website: string;
* }
* ```
*/
StandardTags.decorator = StandardTags._defineTag({
tagName: '@decorator',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
allowMultiple: true,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Extended)
*
* This block tag is used to document the default value for a field or property,
* if a value is not assigned explicitly.
*
* @remarks
* This tag should only be used with fields or properties that are members of a class or interface.
*/
StandardTags.defaultValue = StandardTags._defineTag({
tagName: '@defaultValue',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Core)
*
* This block tag communicates that an API item is no longer supported and may be removed
* in a future release. The `@deprecated` tag is followed by a sentence describing
* the recommended alternative. It recursively applies to members of the container.
* For example, if a class is deprecated, then so are all of its members.
*/
StandardTags.deprecated = StandardTags._defineTag({
tagName: '@deprecated',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
standardization: Standardization_1.Standardization.Core
});
/**
* (Extended)
*
* When applied to a class or interface property, this indicates that the property
* returns an event object that event handlers can be attached to. The event-handling
* API is implementation-defined, but typically the property return type would be a class
* with members such as `addHandler()` and `removeHandler()`. A documentation tool can
* display such properties under an "Events" heading instead of the usual "Properties" heading.
*/
StandardTags.eventProperty = StandardTags._defineTag({
tagName: '@eventProperty',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Extended)
*
* Indicates a documentation section that should be presented as an example
* illustrating how to use the API. It may include a code sample.
*/
StandardTags.example = StandardTags._defineTag({
tagName: '@example',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
allowMultiple: true,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Discretionary)
*
* Suggested meaning: Same semantics as `@beta`, but used by tools that don't support
* an `@alpha` release stage.
*
* @remarks
* Example implementations: Angular API documenter
*
* Synonyms: `@beta`
*/
StandardTags.experimental = StandardTags._defineTag({
tagName: '@experimental',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Discretionary
});
/**
* (Extended)
*
* This inline tag is used to automatically generate an API item's documentation by
* copying it from another API item. The inline tag parameter contains a reference
* to the other item, which may be an unrelated class, or even an import from a
* separate NPM package.
*
* @remarks
* What gets copied
*
* The `@inheritDoc` tag does not copy the entire comment body. Only the following
* components are copied:
* - summary section
* - `@remarks` block
* - `@params` blocks
* - `@typeParam` blocks
* - `@returns` block
* Other tags such as `@defaultValue` or `@example` are not copied, and need to be
* explicitly included after the `@inheritDoc` tag.
*
* TODO: The notation for API item references is still being standardized. See this issue:
* https://github.com/microsoft/tsdoc/issues/9
*/
StandardTags.inheritDoc = StandardTags._defineTag({
tagName: '@inheritDoc',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.InlineTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Discretionary)
*
* Suggested meaning: Designates that an API item is not planned to be used by
* third-party developers. The tooling may trim the declaration from a public release.
* In some implementations, certain designated packages may be allowed to consume
* internal API items, e.g. because the packages are components of the same product.
*
* @remarks
* Example implementations: API Extractor
*/
StandardTags.internal = StandardTags._defineTag({
tagName: '@internal',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Discretionary
});
/**
* (Core)
*
* The `{@label}` inline tag is used to label a declaration, so that it can be referenced
* using a selector in the TSDoc declaration reference notation.
*
* @remarks
* TODO: The `{@label}` notation is still being standardized. See this issue:
* https://github.com/microsoft/tsdoc/issues/9
*/
StandardTags.label = StandardTags._defineTag({
tagName: '@label',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.InlineTag,
standardization: Standardization_1.Standardization.Core
});
/**
* (Core)
*
* The `{@link}` inline tag is used to create hyperlinks to other pages in a
* documentation system or general internet URLs. In particular, it supports
* expressions for referencing API items.
*
* @remarks
* TODO: The `{@link}` notation is still being standardized. See this issue:
* https://github.com/microsoft/tsdoc/issues/9
*/
StandardTags.link = StandardTags._defineTag({
tagName: '@link',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.InlineTag,
allowMultiple: true,
standardization: Standardization_1.Standardization.Core
});
/**
* (Extended)
*
* This modifier has similar semantics to the `override` keyword in C# or Java.
* For a member function or property, explicitly indicates that this definition
* is overriding (i.e. redefining) the definition inherited from the base class.
* The base class definition would normally be marked as `virtual`.
*
* @remarks
* A documentation tool may enforce that the `@virtual`, `@override`, and/or `@sealed`
* modifiers are consistently applied, but this is not required by the TSDoc standard.
*/
StandardTags.override = StandardTags._defineTag({
tagName: '@override',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Core)
*
* Used to indicate a doc comment that describes an entire NPM package (as opposed
* to an individual API item belonging to that package). The `@packageDocumentation` comment
* is found in the *.d.ts file that acts as the entry point for the package, and it
* should be the first `/**` comment encountered in that file. A comment containing a
* `@packageDocumentation` tag should never be used to describe an individual API item.
*/
StandardTags.packageDocumentation = StandardTags._defineTag({
tagName: '@packageDocumentation',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Core
});
/**
* (Core)
*
* Used to document a function parameter. The `@param` tag is followed by a parameter
* name, followed by a hyphen, followed by a description. The TSDoc parser recognizes
* this syntax and will extract it into a DocParamBlock node.
*/
StandardTags.param = StandardTags._defineTag({
tagName: '@param',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
allowMultiple: true,
standardization: Standardization_1.Standardization.Core
});
/**
* (Core)
*
* Starts a section of additional documentation content that is not intended for a
* public audience. A tool must omit this entire section from the API reference web site,
* generated *.d.ts file, and any other outputs incorporating the content.
*/
StandardTags.privateRemarks = StandardTags._defineTag({
tagName: '@privateRemarks',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
standardization: Standardization_1.Standardization.Core
});
/**
* (Discretionary)
*
* Suggested meaning: Designates that an API item's release stage is "public".
* It has been officially released to third-party developers, and its signature is
* guaranteed to be stable (e.g. following Semantic Versioning rules).
*
* @remarks
* Example implementations: API Extractor
*/
StandardTags.public = StandardTags._defineTag({
tagName: '@public',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Discretionary
});
/**
* (Extended)
*
* This modifier tag indicates that an API item should be documented as being read-only,
* even if the TypeScript type system may indicate otherwise. For example, suppose a
* class property has a setter function that always throws an exception explaining that
* the property cannot be assigned; in this situation, the `@readonly` modifier can be
* added so that the property is shown as read-only in the documentation.
*
* @remarks
* Example implementations: API Extractor
*/
StandardTags.readonly = StandardTags._defineTag({
tagName: '@readonly',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Core)
*
* The main documentation for an API item is separated into a brief "summary" section,
* optionally followed by a more detailed "remarks" section. On a documentation web site,
* index pages (e.g. showing members of a class) will show only the brief summaries,
* whereas a detail pages (e.g. describing a single member) will show the summary followed
* by the remarks. The `@remarks` block tag ends the summary section, and begins the
* remarks section for a doc comment.
*/
StandardTags.remarks = StandardTags._defineTag({
tagName: '@remarks',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
standardization: Standardization_1.Standardization.Core
});
/**
* (Core)
*
* Used to document the return value for a function.
*/
StandardTags.returns = StandardTags._defineTag({
tagName: '@returns',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
standardization: Standardization_1.Standardization.Core
});
/**
* (Extended)
*
* This modifier has similar semantics to the `sealed` keyword in C# or Java.
* For a class, indicates that subclasses must not inherit from the class.
* For a member function or property, indicates that subclasses must not override
* (i.e. redefine) the member.
*
* @remarks
* A documentation tool may enforce that the `@virtual`, `@override`, and/or `@sealed`
* modifiers are consistently applied, but this is not required by the TSDoc standard.
*/
StandardTags.sealed = StandardTags._defineTag({
tagName: '@sealed',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Extended)
*
* Used to build a list of references to an API item or other resource that may be related to the
* current item.
*
* @remarks
*
* For example:
*
* ```ts
* /**
* * Parses a string containing a Uniform Resource Locator (URL).
* * @see {@link ParsedUrl} for the returned data structure
* * @see {@link https://tools.ietf.org/html/rfc1738|RFC 1738}
* * for syntax
* * @see your developer SDK for code samples
* * @param url - the string to be parsed
* * @returns the parsed result
* &#42;/
* function parseURL(url: string): ParsedUrl;
* ```
*
* `@see` is a block tag. Each block becomes an item in the list of references. For example, a documentation
* system might render the above blocks as follows:
*
* ```markdown
* `function parseURL(url: string): ParsedUrl;`
*
* Parses a string containing a Uniform Resource Locator (URL).
*
* ## See Also
* - ParsedUrl for the returned data structure
* - RFC 1738 for syntax
* - your developer SDK for code samples
* ```
*
* NOTE: JSDoc attempts to automatically hyperlink the text immediately after `@see`. Because this is ambiguous
* with plain text, TSDoc instead requires an explicit `{@link}` tag to make hyperlinks.
*/
StandardTags.see = StandardTags._defineTag({
tagName: '@see',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Extended)
*
* Used to document an exception type that may be thrown by a function or property.
*
* @remarks
*
* A separate `@throws` block should be used to document each exception type. This tag is for informational
* purposes only, and does not restrict other types from being thrown. It is suggested, but not required,
* for the `@throws` block to start with a line containing only the name of the exception.
*
* For example:
*
* ```ts
* /**
* * Retrieves metadata about a book from the catalog.
* *
* * @param isbnCode - the ISBN number for the book
* * @returns the retrieved book object
* *
* * @throws {@link IsbnSyntaxError}
* * This exception is thrown if the input is not a valid ISBN number.
* *
* * @throws {@link book-lib#BookNotFoundError}
* * Thrown if the ISBN number is valid, but no such book exists in the catalog.
* *
* * @public
* &#42;/
* function fetchBookByIsbn(isbnCode: string): Book;
* ```
*/
StandardTags.throws = StandardTags._defineTag({
tagName: '@throws',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
allowMultiple: true,
standardization: Standardization_1.Standardization.Extended
});
/**
* (Core)
*
* Used to document a generic parameter. The `@typeParam` tag is followed by a parameter
* name, followed by a hyphen, followed by a description. The TSDoc parser recognizes
* this syntax and will extract it into a DocParamBlock node.
*/
StandardTags.typeParam = StandardTags._defineTag({
tagName: '@typeParam',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.BlockTag,
allowMultiple: true,
standardization: Standardization_1.Standardization.Core
});
/**
* (Extended)
*
* This modifier has similar semantics to the `virtual` keyword in C# or Java.
* For a member function or property, explicitly indicates that subclasses may override
* (i.e. redefine) the member.
*
* @remarks
* A documentation tool may enforce that the `@virtual`, `@override`, and/or `@sealed`
* modifiers are consistently applied, but this is not required by the TSDoc standard.
*/
StandardTags.virtual = StandardTags._defineTag({
tagName: '@virtual',
syntaxKind: TSDocTagDefinition_1.TSDocTagSyntaxKind.ModifierTag,
standardization: Standardization_1.Standardization.Extended
});
/**
* Returns the full list of all core tags.
*/
StandardTags.allDefinitions = [
StandardTags.alpha,
StandardTags.beta,
StandardTags.defaultValue,
StandardTags.decorator,
StandardTags.deprecated,
StandardTags.eventProperty,
StandardTags.example,
StandardTags.experimental,
StandardTags.inheritDoc,
StandardTags.internal,
StandardTags.label,
StandardTags.link,
StandardTags.override,
StandardTags.packageDocumentation,
StandardTags.param,
StandardTags.privateRemarks,
StandardTags.public,
StandardTags.readonly,
StandardTags.remarks,
StandardTags.returns,
StandardTags.sealed,
StandardTags.see,
StandardTags.throws,
StandardTags.typeParam,
StandardTags.virtual
];
return StandardTags;
}());
exports.StandardTags = StandardTags;
//# sourceMappingURL=StandardTags.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Standardization = void 0;
/**
* Used to group the {@link StandardTags} definitions according to the level of support
* expected from documentation tools that implement the standard.
*/
var Standardization;
(function (Standardization) {
/**
* TSDoc tags in the "Core" standardization group are considered essential.
* Their meaning is standardized, and every documentation tool is expected
* to recognize them. The TSDoc parser library typically provides dedicated APIs
* for accessing these tags.
*/
Standardization["Core"] = "Core";
/**
* TSDoc tags in the "Extended" standardization group are optional. Documentation tools
* may or may not support them. If they do, the syntax and semantics should conform to
* the TSDoc standard definitions.
*/
Standardization["Extended"] = "Extended";
/**
* TSDoc tags in the "Discretionary" standardization group are optional. Although the
* syntax is specified, the semantics for these tags are implementation-specific
* (and sometimes difficult to describe completely without referring to a specific
* implementation). Discretionary tags are included in the TSDoc standard to ensure that
* if two different popular tools use the same tag name, developers can expect the syntax
* to be the same, and the semantics to be somewhat similar.
*/
Standardization["Discretionary"] = "Discretionary";
/**
* The tag is not part of the TSDoc standard. All used-defined tags are assigned to this group.
*/
Standardization["None"] = "None";
})(Standardization = exports.Standardization || (exports.Standardization = {}));
//# sourceMappingURL=Standardization.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Standardization.js","sourceRoot":"","sources":["../../src/details/Standardization.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,eA8BX;AA9BD,WAAY,eAAe;IACzB;;;;;OAKG;IACH,gCAAa,CAAA;IAEb;;;;OAIG;IACH,wCAAqB,CAAA;IAErB;;;;;;;OAOG;IACH,kDAA+B,CAAA;IAE/B;;OAEG;IACH,gCAAa,CAAA;AACf,CAAC,EA9BW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA8B1B","sourcesContent":["/**\r\n * Used to group the {@link StandardTags} definitions according to the level of support\r\n * expected from documentation tools that implement the standard.\r\n */\r\nexport enum Standardization {\r\n /**\r\n * TSDoc tags in the \"Core\" standardization group are considered essential.\r\n * Their meaning is standardized, and every documentation tool is expected\r\n * to recognize them. The TSDoc parser library typically provides dedicated APIs\r\n * for accessing these tags.\r\n */\r\n Core = 'Core',\r\n\r\n /**\r\n * TSDoc tags in the \"Extended\" standardization group are optional. Documentation tools\r\n * may or may not support them. If they do, the syntax and semantics should conform to\r\n * the TSDoc standard definitions.\r\n */\r\n Extended = 'Extended',\r\n\r\n /**\r\n * TSDoc tags in the \"Discretionary\" standardization group are optional. Although the\r\n * syntax is specified, the semantics for these tags are implementation-specific\r\n * (and sometimes difficult to describe completely without referring to a specific\r\n * implementation). Discretionary tags are included in the TSDoc standard to ensure that\r\n * if two different popular tools use the same tag name, developers can expect the syntax\r\n * to be the same, and the semantics to be somewhat similar.\r\n */\r\n Discretionary = 'Discretionary',\r\n\r\n /**\r\n * The tag is not part of the TSDoc standard. All used-defined tags are assigned to this group.\r\n */\r\n None = 'None'\r\n}\r\n"]}