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,13 @@
import { TSDocConfiguration, TSDocTagDefinition } from '@microsoft/tsdoc';
/**
* @internal
* @deprecated - tsdoc configuration is now constructed from tsdoc.json files associated with each package.
*/
export declare class AedocDefinitions {
static readonly betaDocumentation: TSDocTagDefinition;
static readonly internalRemarks: TSDocTagDefinition;
static readonly preapprovedTag: TSDocTagDefinition;
static get tsdocConfiguration(): TSDocConfiguration;
private static _tsdocConfiguration;
}
//# sourceMappingURL=AedocDefinitions.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"AedocDefinitions.d.ts","sourceRoot":"","sources":["../../src/aedoc/AedocDefinitions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAoC,MAAM,kBAAkB,CAAC;AAE5G;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,gBAAuB,iBAAiB,EAAE,kBAAkB,CAGzD;IAEH,gBAAuB,eAAe,EAAE,kBAAkB,CAGvD;IAEH,gBAAuB,cAAc,EAAE,kBAAkB,CAGtD;IAEH,WAAkB,kBAAkB,IAAI,kBAAkB,CA0CzD;IAED,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAiC;CACpE"}

View File

@ -0,0 +1,61 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.AedocDefinitions = void 0;
const tsdoc_1 = require("@microsoft/tsdoc");
/**
* @internal
* @deprecated - tsdoc configuration is now constructed from tsdoc.json files associated with each package.
*/
class AedocDefinitions {
static get tsdocConfiguration() {
if (!AedocDefinitions._tsdocConfiguration) {
const configuration = new tsdoc_1.TSDocConfiguration();
configuration.addTagDefinitions([
AedocDefinitions.betaDocumentation,
AedocDefinitions.internalRemarks,
AedocDefinitions.preapprovedTag
], true);
configuration.setSupportForTags([
tsdoc_1.StandardTags.alpha,
tsdoc_1.StandardTags.beta,
tsdoc_1.StandardTags.decorator,
tsdoc_1.StandardTags.defaultValue,
tsdoc_1.StandardTags.deprecated,
tsdoc_1.StandardTags.eventProperty,
tsdoc_1.StandardTags.example,
tsdoc_1.StandardTags.inheritDoc,
tsdoc_1.StandardTags.internal,
tsdoc_1.StandardTags.link,
tsdoc_1.StandardTags.override,
tsdoc_1.StandardTags.packageDocumentation,
tsdoc_1.StandardTags.param,
tsdoc_1.StandardTags.privateRemarks,
tsdoc_1.StandardTags.public,
tsdoc_1.StandardTags.readonly,
tsdoc_1.StandardTags.remarks,
tsdoc_1.StandardTags.returns,
tsdoc_1.StandardTags.sealed,
tsdoc_1.StandardTags.throws,
tsdoc_1.StandardTags.virtual
], true);
AedocDefinitions._tsdocConfiguration = configuration;
}
return AedocDefinitions._tsdocConfiguration;
}
}
AedocDefinitions.betaDocumentation = new tsdoc_1.TSDocTagDefinition({
tagName: '@betaDocumentation',
syntaxKind: tsdoc_1.TSDocTagSyntaxKind.ModifierTag
});
AedocDefinitions.internalRemarks = new tsdoc_1.TSDocTagDefinition({
tagName: '@internalRemarks',
syntaxKind: tsdoc_1.TSDocTagSyntaxKind.BlockTag
});
AedocDefinitions.preapprovedTag = new tsdoc_1.TSDocTagDefinition({
tagName: '@preapproved',
syntaxKind: tsdoc_1.TSDocTagSyntaxKind.ModifierTag
});
exports.AedocDefinitions = AedocDefinitions;
//# sourceMappingURL=AedocDefinitions.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"AedocDefinitions.js","sourceRoot":"","sources":["../../src/aedoc/AedocDefinitions.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,4CAA4G;AAE5G;;;GAGG;AACH,MAAa,gBAAgB;IAgBpB,MAAM,KAAK,kBAAkB;QAClC,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE;YACzC,MAAM,aAAa,GAAuB,IAAI,0BAAkB,EAAE,CAAC;YACnE,aAAa,CAAC,iBAAiB,CAC7B;gBACE,gBAAgB,CAAC,iBAAiB;gBAClC,gBAAgB,CAAC,eAAe;gBAChC,gBAAgB,CAAC,cAAc;aAChC,EACD,IAAI,CACL,CAAC;YAEF,aAAa,CAAC,iBAAiB,CAC7B;gBACE,oBAAY,CAAC,KAAK;gBAClB,oBAAY,CAAC,IAAI;gBACjB,oBAAY,CAAC,SAAS;gBACtB,oBAAY,CAAC,YAAY;gBACzB,oBAAY,CAAC,UAAU;gBACvB,oBAAY,CAAC,aAAa;gBAC1B,oBAAY,CAAC,OAAO;gBACpB,oBAAY,CAAC,UAAU;gBACvB,oBAAY,CAAC,QAAQ;gBACrB,oBAAY,CAAC,IAAI;gBACjB,oBAAY,CAAC,QAAQ;gBACrB,oBAAY,CAAC,oBAAoB;gBACjC,oBAAY,CAAC,KAAK;gBAClB,oBAAY,CAAC,cAAc;gBAC3B,oBAAY,CAAC,MAAM;gBACnB,oBAAY,CAAC,QAAQ;gBACrB,oBAAY,CAAC,OAAO;gBACpB,oBAAY,CAAC,OAAO;gBACpB,oBAAY,CAAC,MAAM;gBACnB,oBAAY,CAAC,MAAM;gBACnB,oBAAY,CAAC,OAAO;aACrB,EACD,IAAI,CACL,CAAC;YAEF,gBAAgB,CAAC,mBAAmB,GAAG,aAAa,CAAC;SACtD;QACD,OAAO,gBAAgB,CAAC,mBAAmB,CAAC;IAC9C,CAAC;;AAzDsB,kCAAiB,GAAuB,IAAI,0BAAkB,CAAC;IACpF,OAAO,EAAE,oBAAoB;IAC7B,UAAU,EAAE,0BAAkB,CAAC,WAAW;CAC3C,CAAC,CAAC;AAEoB,gCAAe,GAAuB,IAAI,0BAAkB,CAAC;IAClF,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,0BAAkB,CAAC,QAAQ;CACxC,CAAC,CAAC;AAEoB,+BAAc,GAAuB,IAAI,0BAAkB,CAAC;IACjF,OAAO,EAAE,cAAc;IACvB,UAAU,EAAE,0BAAkB,CAAC,WAAW;CAC3C,CAAC,CAAC;AAdQ,4CAAgB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { TSDocConfiguration, TSDocTagDefinition, TSDocTagSyntaxKind, StandardTags } from '@microsoft/tsdoc';\n\n/**\n * @internal\n * @deprecated - tsdoc configuration is now constructed from tsdoc.json files associated with each package.\n */\nexport class AedocDefinitions {\n public static readonly betaDocumentation: TSDocTagDefinition = new TSDocTagDefinition({\n tagName: '@betaDocumentation',\n syntaxKind: TSDocTagSyntaxKind.ModifierTag\n });\n\n public static readonly internalRemarks: TSDocTagDefinition = new TSDocTagDefinition({\n tagName: '@internalRemarks',\n syntaxKind: TSDocTagSyntaxKind.BlockTag\n });\n\n public static readonly preapprovedTag: TSDocTagDefinition = new TSDocTagDefinition({\n tagName: '@preapproved',\n syntaxKind: TSDocTagSyntaxKind.ModifierTag\n });\n\n public static get tsdocConfiguration(): TSDocConfiguration {\n if (!AedocDefinitions._tsdocConfiguration) {\n const configuration: TSDocConfiguration = new TSDocConfiguration();\n configuration.addTagDefinitions(\n [\n AedocDefinitions.betaDocumentation,\n AedocDefinitions.internalRemarks,\n AedocDefinitions.preapprovedTag\n ],\n true\n );\n\n configuration.setSupportForTags(\n [\n StandardTags.alpha,\n StandardTags.beta,\n StandardTags.decorator,\n StandardTags.defaultValue,\n StandardTags.deprecated,\n StandardTags.eventProperty,\n StandardTags.example,\n StandardTags.inheritDoc,\n StandardTags.internal,\n StandardTags.link,\n StandardTags.override,\n StandardTags.packageDocumentation,\n StandardTags.param,\n StandardTags.privateRemarks,\n StandardTags.public,\n StandardTags.readonly,\n StandardTags.remarks,\n StandardTags.returns,\n StandardTags.sealed,\n StandardTags.throws,\n StandardTags.virtual\n ],\n true\n );\n\n AedocDefinitions._tsdocConfiguration = configuration;\n }\n return AedocDefinitions._tsdocConfiguration;\n }\n\n private static _tsdocConfiguration: TSDocConfiguration | undefined;\n}\n"]}

View File

@ -0,0 +1,65 @@
/**
* A "release tag" is a custom TSDoc tag that is applied to an API to communicate the level of support
* provided for third-party developers.
*
* @remarks
*
* The four release tags are: `@internal`, `@alpha`, `@beta`, and `@public`. They are applied to API items such
* as classes, member functions, enums, etc. The release tag applies recursively to members of a container
* (e.g. class or interface). For example, if a class is marked as `@beta`, then all of its members automatically
* have this status; you DON'T need add the `@beta` tag to each member function. However, you could add
* `@internal` to a member function to give it a different release status.
*
* @public
*/
export declare enum ReleaseTag {
/**
* No release tag was specified in the AEDoc summary.
*/
None = 0,
/**
* Indicates that an API item is meant only for usage by other NPM packages from the same
* maintainer. Third parties should never use "internal" APIs. (To emphasize this, their
* names are prefixed by underscores.)
*/
Internal = 1,
/**
* Indicates that an API item is eventually intended to be public, but currently is in an
* early stage of development. Third parties should not use "alpha" APIs.
*/
Alpha = 2,
/**
* Indicates that an API item has been released in an experimental state. Third parties are
* encouraged to try it and provide feedback. However, a "beta" API should NOT be used
* in production.
*/
Beta = 3,
/**
* Indicates that an API item has been officially released. It is part of the supported
* contract (e.g. SemVer) for a package.
*/
Public = 4
}
/**
* Helper functions for working with the `ReleaseTag` enum.
* @public
*/
export declare namespace ReleaseTag {
/**
* Returns the TSDoc tag name for a `ReleaseTag` value.
*
* @remarks
* For example, `getTagName(ReleaseTag.Internal)` would return the string `@internal`.
*/
function getTagName(releaseTag: ReleaseTag): string;
/**
* Compares two `ReleaseTag` values. Their values must not be `ReleaseTag.None`.
* @returns 0 if `a` and `b` are equal, a positive number if `a` is more public than `b`,
* and a negative number if `a` is less public than `b`.
* @remarks
* For example, `compareReleaseTag(ReleaseTag.Beta, ReleaseTag.Alpha)` will return a positive
* number because beta is more public than alpha.
*/
function compare(a: ReleaseTag, b: ReleaseTag): number;
}
//# sourceMappingURL=ReleaseTag.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ReleaseTag.d.ts","sourceRoot":"","sources":["../../src/aedoc/ReleaseTag.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,IAAI,IAAI;IACR;;;;OAIG;IACH,QAAQ,IAAI;IACZ;;;OAGG;IACH,KAAK,IAAI;IACT;;;;OAIG;IACH,IAAI,IAAI;IACR;;;OAGG;IACH,MAAM,IAAI;CACX;AAED;;;GAGG;AACH,yBAAiB,UAAU,CAAC;IAC1B;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAezD;IAED;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAE5D;CACF"}

View File

@ -0,0 +1,90 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReleaseTag = void 0;
/**
* A "release tag" is a custom TSDoc tag that is applied to an API to communicate the level of support
* provided for third-party developers.
*
* @remarks
*
* The four release tags are: `@internal`, `@alpha`, `@beta`, and `@public`. They are applied to API items such
* as classes, member functions, enums, etc. The release tag applies recursively to members of a container
* (e.g. class or interface). For example, if a class is marked as `@beta`, then all of its members automatically
* have this status; you DON'T need add the `@beta` tag to each member function. However, you could add
* `@internal` to a member function to give it a different release status.
*
* @public
*/
var ReleaseTag;
(function (ReleaseTag) {
/**
* No release tag was specified in the AEDoc summary.
*/
ReleaseTag[ReleaseTag["None"] = 0] = "None";
/**
* Indicates that an API item is meant only for usage by other NPM packages from the same
* maintainer. Third parties should never use "internal" APIs. (To emphasize this, their
* names are prefixed by underscores.)
*/
ReleaseTag[ReleaseTag["Internal"] = 1] = "Internal";
/**
* Indicates that an API item is eventually intended to be public, but currently is in an
* early stage of development. Third parties should not use "alpha" APIs.
*/
ReleaseTag[ReleaseTag["Alpha"] = 2] = "Alpha";
/**
* Indicates that an API item has been released in an experimental state. Third parties are
* encouraged to try it and provide feedback. However, a "beta" API should NOT be used
* in production.
*/
ReleaseTag[ReleaseTag["Beta"] = 3] = "Beta";
/**
* Indicates that an API item has been officially released. It is part of the supported
* contract (e.g. SemVer) for a package.
*/
ReleaseTag[ReleaseTag["Public"] = 4] = "Public";
})(ReleaseTag = exports.ReleaseTag || (exports.ReleaseTag = {}));
/**
* Helper functions for working with the `ReleaseTag` enum.
* @public
*/
(function (ReleaseTag) {
/**
* Returns the TSDoc tag name for a `ReleaseTag` value.
*
* @remarks
* For example, `getTagName(ReleaseTag.Internal)` would return the string `@internal`.
*/
function getTagName(releaseTag) {
switch (releaseTag) {
case ReleaseTag.None:
return '(none)';
case ReleaseTag.Internal:
return '@internal';
case ReleaseTag.Alpha:
return '@alpha';
case ReleaseTag.Beta:
return '@beta';
case ReleaseTag.Public:
return '@public';
default:
throw new Error('Unsupported release tag');
}
}
ReleaseTag.getTagName = getTagName;
/**
* Compares two `ReleaseTag` values. Their values must not be `ReleaseTag.None`.
* @returns 0 if `a` and `b` are equal, a positive number if `a` is more public than `b`,
* and a negative number if `a` is less public than `b`.
* @remarks
* For example, `compareReleaseTag(ReleaseTag.Beta, ReleaseTag.Alpha)` will return a positive
* number because beta is more public than alpha.
*/
function compare(a, b) {
return a - b;
}
ReleaseTag.compare = compare;
})(ReleaseTag = exports.ReleaseTag || (exports.ReleaseTag = {}));
//# sourceMappingURL=ReleaseTag.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ReleaseTag.js","sourceRoot":"","sources":["../../src/aedoc/ReleaseTag.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;;;;;GAaG;AACH,IAAY,UA2BX;AA3BD,WAAY,UAAU;IACpB;;OAEG;IACH,2CAAQ,CAAA;IACR;;;;OAIG;IACH,mDAAY,CAAA;IACZ;;;OAGG;IACH,6CAAS,CAAA;IACT;;;;OAIG;IACH,2CAAQ,CAAA;IACR;;;OAGG;IACH,+CAAU,CAAA;AACZ,CAAC,EA3BW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA2BrB;AAED;;;GAGG;AACH,WAAiB,UAAU;IACzB;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,UAAsB;QAC/C,QAAQ,UAAU,EAAE;YAClB,KAAK,UAAU,CAAC,IAAI;gBAClB,OAAO,QAAQ,CAAC;YAClB,KAAK,UAAU,CAAC,QAAQ;gBACtB,OAAO,WAAW,CAAC;YACrB,KAAK,UAAU,CAAC,KAAK;gBACnB,OAAO,QAAQ,CAAC;YAClB,KAAK,UAAU,CAAC,IAAI;gBAClB,OAAO,OAAO,CAAC;YACjB,KAAK,UAAU,CAAC,MAAM;gBACpB,OAAO,SAAS,CAAC;YACnB;gBACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC9C;IACH,CAAC;IAfe,qBAAU,aAezB,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,CAAa,EAAE,CAAa;QAClD,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAFe,kBAAO,UAEtB,CAAA;AACH,CAAC,EAnCgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAmC1B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * A \"release tag\" is a custom TSDoc tag that is applied to an API to communicate the level of support\n * provided for third-party developers.\n *\n * @remarks\n *\n * The four release tags are: `@internal`, `@alpha`, `@beta`, and `@public`. They are applied to API items such\n * as classes, member functions, enums, etc. The release tag applies recursively to members of a container\n * (e.g. class or interface). For example, if a class is marked as `@beta`, then all of its members automatically\n * have this status; you DON'T need add the `@beta` tag to each member function. However, you could add\n * `@internal` to a member function to give it a different release status.\n *\n * @public\n */\nexport enum ReleaseTag {\n /**\n * No release tag was specified in the AEDoc summary.\n */\n None = 0,\n /**\n * Indicates that an API item is meant only for usage by other NPM packages from the same\n * maintainer. Third parties should never use \"internal\" APIs. (To emphasize this, their\n * names are prefixed by underscores.)\n */\n Internal = 1,\n /**\n * Indicates that an API item is eventually intended to be public, but currently is in an\n * early stage of development. Third parties should not use \"alpha\" APIs.\n */\n Alpha = 2,\n /**\n * Indicates that an API item has been released in an experimental state. Third parties are\n * encouraged to try it and provide feedback. However, a \"beta\" API should NOT be used\n * in production.\n */\n Beta = 3,\n /**\n * Indicates that an API item has been officially released. It is part of the supported\n * contract (e.g. SemVer) for a package.\n */\n Public = 4\n}\n\n/**\n * Helper functions for working with the `ReleaseTag` enum.\n * @public\n */\nexport namespace ReleaseTag {\n /**\n * Returns the TSDoc tag name for a `ReleaseTag` value.\n *\n * @remarks\n * For example, `getTagName(ReleaseTag.Internal)` would return the string `@internal`.\n */\n export function getTagName(releaseTag: ReleaseTag): string {\n switch (releaseTag) {\n case ReleaseTag.None:\n return '(none)';\n case ReleaseTag.Internal:\n return '@internal';\n case ReleaseTag.Alpha:\n return '@alpha';\n case ReleaseTag.Beta:\n return '@beta';\n case ReleaseTag.Public:\n return '@public';\n default:\n throw new Error('Unsupported release tag');\n }\n }\n\n /**\n * Compares two `ReleaseTag` values. Their values must not be `ReleaseTag.None`.\n * @returns 0 if `a` and `b` are equal, a positive number if `a` is more public than `b`,\n * and a negative number if `a` is less public than `b`.\n * @remarks\n * For example, `compareReleaseTag(ReleaseTag.Beta, ReleaseTag.Alpha)` will return a positive\n * number because beta is more public than alpha.\n */\n export function compare(a: ReleaseTag, b: ReleaseTag): number {\n return a - b;\n }\n}\n"]}

View File

@ -0,0 +1,55 @@
/**
* Use this library to read and write *.api.json files as defined by the
* {@link https://api-extractor.com/ | API Extractor} tool. These files are used to generate a documentation
* website for your TypeScript package. The files store the API signatures and doc comments that were extracted
* from your package.
*
* @packageDocumentation
*/
export { AedocDefinitions } from './aedoc/AedocDefinitions';
export { ReleaseTag } from './aedoc/ReleaseTag';
export { IApiDeclaredItemOptions, ApiDeclaredItem } from './items/ApiDeclaredItem';
export { IApiDocumentedItemOptions, ApiDocumentedItem } from './items/ApiDocumentedItem';
export { ApiItemKind, IApiItemOptions, ApiItem, IApiItemConstructor } from './items/ApiItem';
export { IApiPropertyItemOptions, ApiPropertyItem } from './items/ApiPropertyItem';
export { IApiParameterListMixinOptions, IApiParameterOptions, ApiParameterListMixin } from './mixins/ApiParameterListMixin';
export { IApiTypeParameterOptions, IApiTypeParameterListMixinOptions, ApiTypeParameterListMixin } from './mixins/ApiTypeParameterListMixin';
export { IApiAbstractMixinOptions, ApiAbstractMixin } from './mixins/ApiAbstractMixin';
export { IApiItemContainerMixinOptions, ApiItemContainerMixin } from './mixins/ApiItemContainerMixin';
export { IApiProtectedMixinOptions, ApiProtectedMixin } from './mixins/ApiProtectedMixin';
export { IApiReleaseTagMixinOptions, ApiReleaseTagMixin } from './mixins/ApiReleaseTagMixin';
export { IApiReturnTypeMixinOptions, ApiReturnTypeMixin } from './mixins/ApiReturnTypeMixin';
export { IApiStaticMixinOptions, ApiStaticMixin } from './mixins/ApiStaticMixin';
export { IApiNameMixinOptions, ApiNameMixin } from './mixins/ApiNameMixin';
export { IApiOptionalMixinOptions, ApiOptionalMixin } from './mixins/ApiOptionalMixin';
export { IApiReadonlyMixinOptions, ApiReadonlyMixin } from './mixins/ApiReadonlyMixin';
export { IApiInitializerMixinOptions, ApiInitializerMixin } from './mixins/ApiInitializerMixin';
export { IApiExportedMixinOptions, ApiExportedMixin } from './mixins/ApiExportedMixin';
export { IFindApiItemsResult, IFindApiItemsMessage, FindApiItemsMessageId } from './mixins/IFindApiItemsResult';
export { ExcerptTokenKind, IExcerptTokenRange, IExcerptToken, ExcerptToken, Excerpt } from './mixins/Excerpt';
export { Constructor, PropertiesOf } from './mixins/Mixin';
export { IApiCallSignatureOptions, ApiCallSignature } from './model/ApiCallSignature';
export { IApiClassOptions, ApiClass } from './model/ApiClass';
export { IApiConstructorOptions, ApiConstructor } from './model/ApiConstructor';
export { IApiConstructSignatureOptions, ApiConstructSignature } from './model/ApiConstructSignature';
export { IApiEntryPointOptions, ApiEntryPoint } from './model/ApiEntryPoint';
export { IApiEnumOptions, ApiEnum } from './model/ApiEnum';
export { IApiEnumMemberOptions, ApiEnumMember, EnumMemberOrder } from './model/ApiEnumMember';
export { IApiFunctionOptions, ApiFunction } from './model/ApiFunction';
export { IApiIndexSignatureOptions, ApiIndexSignature } from './model/ApiIndexSignature';
export { IApiInterfaceOptions, ApiInterface } from './model/ApiInterface';
export { IApiMethodOptions, ApiMethod } from './model/ApiMethod';
export { IApiMethodSignatureOptions, ApiMethodSignature } from './model/ApiMethodSignature';
export { ApiModel } from './model/ApiModel';
export { IApiNamespaceOptions, ApiNamespace } from './model/ApiNamespace';
export { IApiPackageOptions, ApiPackage, IApiPackageSaveOptions } from './model/ApiPackage';
export { IParameterOptions, Parameter } from './model/Parameter';
export { IApiPropertyOptions, ApiProperty } from './model/ApiProperty';
export { IApiPropertySignatureOptions, ApiPropertySignature } from './model/ApiPropertySignature';
export { IApiTypeAliasOptions, ApiTypeAlias } from './model/ApiTypeAlias';
export { ITypeParameterOptions, TypeParameter } from './model/TypeParameter';
export { IApiVariableOptions, ApiVariable } from './model/ApiVariable';
export { IResolveDeclarationReferenceResult } from './model/ModelReferenceResolver';
export { HeritageType } from './model/HeritageType';
export { ISourceLocationOptions, SourceLocation } from './model/SourceLocation';
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGnF,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,yBAAyB,EAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACtG,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,kCAAkC,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}

View File

@ -0,0 +1,109 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.SourceLocation = exports.HeritageType = exports.ApiVariable = exports.TypeParameter = exports.ApiTypeAlias = exports.ApiPropertySignature = exports.ApiProperty = exports.Parameter = exports.ApiPackage = exports.ApiNamespace = exports.ApiModel = exports.ApiMethodSignature = exports.ApiMethod = exports.ApiInterface = exports.ApiIndexSignature = exports.ApiFunction = exports.EnumMemberOrder = exports.ApiEnumMember = exports.ApiEnum = exports.ApiEntryPoint = exports.ApiConstructSignature = exports.ApiConstructor = exports.ApiClass = exports.ApiCallSignature = exports.Excerpt = exports.ExcerptToken = exports.ExcerptTokenKind = exports.FindApiItemsMessageId = exports.ApiExportedMixin = exports.ApiInitializerMixin = exports.ApiReadonlyMixin = exports.ApiOptionalMixin = exports.ApiNameMixin = exports.ApiStaticMixin = exports.ApiReturnTypeMixin = exports.ApiReleaseTagMixin = exports.ApiProtectedMixin = exports.ApiItemContainerMixin = exports.ApiAbstractMixin = exports.ApiTypeParameterListMixin = exports.ApiParameterListMixin = exports.ApiPropertyItem = exports.ApiItem = exports.ApiItemKind = exports.ApiDocumentedItem = exports.ApiDeclaredItem = exports.ReleaseTag = exports.AedocDefinitions = void 0;
/**
* Use this library to read and write *.api.json files as defined by the
* {@link https://api-extractor.com/ | API Extractor} tool. These files are used to generate a documentation
* website for your TypeScript package. The files store the API signatures and doc comments that were extracted
* from your package.
*
* @packageDocumentation
*/
var AedocDefinitions_1 = require("./aedoc/AedocDefinitions");
Object.defineProperty(exports, "AedocDefinitions", { enumerable: true, get: function () { return AedocDefinitions_1.AedocDefinitions; } });
var ReleaseTag_1 = require("./aedoc/ReleaseTag");
Object.defineProperty(exports, "ReleaseTag", { enumerable: true, get: function () { return ReleaseTag_1.ReleaseTag; } });
// items
var ApiDeclaredItem_1 = require("./items/ApiDeclaredItem");
Object.defineProperty(exports, "ApiDeclaredItem", { enumerable: true, get: function () { return ApiDeclaredItem_1.ApiDeclaredItem; } });
var ApiDocumentedItem_1 = require("./items/ApiDocumentedItem");
Object.defineProperty(exports, "ApiDocumentedItem", { enumerable: true, get: function () { return ApiDocumentedItem_1.ApiDocumentedItem; } });
var ApiItem_1 = require("./items/ApiItem");
Object.defineProperty(exports, "ApiItemKind", { enumerable: true, get: function () { return ApiItem_1.ApiItemKind; } });
Object.defineProperty(exports, "ApiItem", { enumerable: true, get: function () { return ApiItem_1.ApiItem; } });
var ApiPropertyItem_1 = require("./items/ApiPropertyItem");
Object.defineProperty(exports, "ApiPropertyItem", { enumerable: true, get: function () { return ApiPropertyItem_1.ApiPropertyItem; } });
// mixins
var ApiParameterListMixin_1 = require("./mixins/ApiParameterListMixin");
Object.defineProperty(exports, "ApiParameterListMixin", { enumerable: true, get: function () { return ApiParameterListMixin_1.ApiParameterListMixin; } });
var ApiTypeParameterListMixin_1 = require("./mixins/ApiTypeParameterListMixin");
Object.defineProperty(exports, "ApiTypeParameterListMixin", { enumerable: true, get: function () { return ApiTypeParameterListMixin_1.ApiTypeParameterListMixin; } });
var ApiAbstractMixin_1 = require("./mixins/ApiAbstractMixin");
Object.defineProperty(exports, "ApiAbstractMixin", { enumerable: true, get: function () { return ApiAbstractMixin_1.ApiAbstractMixin; } });
var ApiItemContainerMixin_1 = require("./mixins/ApiItemContainerMixin");
Object.defineProperty(exports, "ApiItemContainerMixin", { enumerable: true, get: function () { return ApiItemContainerMixin_1.ApiItemContainerMixin; } });
var ApiProtectedMixin_1 = require("./mixins/ApiProtectedMixin");
Object.defineProperty(exports, "ApiProtectedMixin", { enumerable: true, get: function () { return ApiProtectedMixin_1.ApiProtectedMixin; } });
var ApiReleaseTagMixin_1 = require("./mixins/ApiReleaseTagMixin");
Object.defineProperty(exports, "ApiReleaseTagMixin", { enumerable: true, get: function () { return ApiReleaseTagMixin_1.ApiReleaseTagMixin; } });
var ApiReturnTypeMixin_1 = require("./mixins/ApiReturnTypeMixin");
Object.defineProperty(exports, "ApiReturnTypeMixin", { enumerable: true, get: function () { return ApiReturnTypeMixin_1.ApiReturnTypeMixin; } });
var ApiStaticMixin_1 = require("./mixins/ApiStaticMixin");
Object.defineProperty(exports, "ApiStaticMixin", { enumerable: true, get: function () { return ApiStaticMixin_1.ApiStaticMixin; } });
var ApiNameMixin_1 = require("./mixins/ApiNameMixin");
Object.defineProperty(exports, "ApiNameMixin", { enumerable: true, get: function () { return ApiNameMixin_1.ApiNameMixin; } });
var ApiOptionalMixin_1 = require("./mixins/ApiOptionalMixin");
Object.defineProperty(exports, "ApiOptionalMixin", { enumerable: true, get: function () { return ApiOptionalMixin_1.ApiOptionalMixin; } });
var ApiReadonlyMixin_1 = require("./mixins/ApiReadonlyMixin");
Object.defineProperty(exports, "ApiReadonlyMixin", { enumerable: true, get: function () { return ApiReadonlyMixin_1.ApiReadonlyMixin; } });
var ApiInitializerMixin_1 = require("./mixins/ApiInitializerMixin");
Object.defineProperty(exports, "ApiInitializerMixin", { enumerable: true, get: function () { return ApiInitializerMixin_1.ApiInitializerMixin; } });
var ApiExportedMixin_1 = require("./mixins/ApiExportedMixin");
Object.defineProperty(exports, "ApiExportedMixin", { enumerable: true, get: function () { return ApiExportedMixin_1.ApiExportedMixin; } });
var IFindApiItemsResult_1 = require("./mixins/IFindApiItemsResult");
Object.defineProperty(exports, "FindApiItemsMessageId", { enumerable: true, get: function () { return IFindApiItemsResult_1.FindApiItemsMessageId; } });
var Excerpt_1 = require("./mixins/Excerpt");
Object.defineProperty(exports, "ExcerptTokenKind", { enumerable: true, get: function () { return Excerpt_1.ExcerptTokenKind; } });
Object.defineProperty(exports, "ExcerptToken", { enumerable: true, get: function () { return Excerpt_1.ExcerptToken; } });
Object.defineProperty(exports, "Excerpt", { enumerable: true, get: function () { return Excerpt_1.Excerpt; } });
// model
var ApiCallSignature_1 = require("./model/ApiCallSignature");
Object.defineProperty(exports, "ApiCallSignature", { enumerable: true, get: function () { return ApiCallSignature_1.ApiCallSignature; } });
var ApiClass_1 = require("./model/ApiClass");
Object.defineProperty(exports, "ApiClass", { enumerable: true, get: function () { return ApiClass_1.ApiClass; } });
var ApiConstructor_1 = require("./model/ApiConstructor");
Object.defineProperty(exports, "ApiConstructor", { enumerable: true, get: function () { return ApiConstructor_1.ApiConstructor; } });
var ApiConstructSignature_1 = require("./model/ApiConstructSignature");
Object.defineProperty(exports, "ApiConstructSignature", { enumerable: true, get: function () { return ApiConstructSignature_1.ApiConstructSignature; } });
var ApiEntryPoint_1 = require("./model/ApiEntryPoint");
Object.defineProperty(exports, "ApiEntryPoint", { enumerable: true, get: function () { return ApiEntryPoint_1.ApiEntryPoint; } });
var ApiEnum_1 = require("./model/ApiEnum");
Object.defineProperty(exports, "ApiEnum", { enumerable: true, get: function () { return ApiEnum_1.ApiEnum; } });
var ApiEnumMember_1 = require("./model/ApiEnumMember");
Object.defineProperty(exports, "ApiEnumMember", { enumerable: true, get: function () { return ApiEnumMember_1.ApiEnumMember; } });
Object.defineProperty(exports, "EnumMemberOrder", { enumerable: true, get: function () { return ApiEnumMember_1.EnumMemberOrder; } });
var ApiFunction_1 = require("./model/ApiFunction");
Object.defineProperty(exports, "ApiFunction", { enumerable: true, get: function () { return ApiFunction_1.ApiFunction; } });
var ApiIndexSignature_1 = require("./model/ApiIndexSignature");
Object.defineProperty(exports, "ApiIndexSignature", { enumerable: true, get: function () { return ApiIndexSignature_1.ApiIndexSignature; } });
var ApiInterface_1 = require("./model/ApiInterface");
Object.defineProperty(exports, "ApiInterface", { enumerable: true, get: function () { return ApiInterface_1.ApiInterface; } });
var ApiMethod_1 = require("./model/ApiMethod");
Object.defineProperty(exports, "ApiMethod", { enumerable: true, get: function () { return ApiMethod_1.ApiMethod; } });
var ApiMethodSignature_1 = require("./model/ApiMethodSignature");
Object.defineProperty(exports, "ApiMethodSignature", { enumerable: true, get: function () { return ApiMethodSignature_1.ApiMethodSignature; } });
var ApiModel_1 = require("./model/ApiModel");
Object.defineProperty(exports, "ApiModel", { enumerable: true, get: function () { return ApiModel_1.ApiModel; } });
var ApiNamespace_1 = require("./model/ApiNamespace");
Object.defineProperty(exports, "ApiNamespace", { enumerable: true, get: function () { return ApiNamespace_1.ApiNamespace; } });
var ApiPackage_1 = require("./model/ApiPackage");
Object.defineProperty(exports, "ApiPackage", { enumerable: true, get: function () { return ApiPackage_1.ApiPackage; } });
var Parameter_1 = require("./model/Parameter");
Object.defineProperty(exports, "Parameter", { enumerable: true, get: function () { return Parameter_1.Parameter; } });
var ApiProperty_1 = require("./model/ApiProperty");
Object.defineProperty(exports, "ApiProperty", { enumerable: true, get: function () { return ApiProperty_1.ApiProperty; } });
var ApiPropertySignature_1 = require("./model/ApiPropertySignature");
Object.defineProperty(exports, "ApiPropertySignature", { enumerable: true, get: function () { return ApiPropertySignature_1.ApiPropertySignature; } });
var ApiTypeAlias_1 = require("./model/ApiTypeAlias");
Object.defineProperty(exports, "ApiTypeAlias", { enumerable: true, get: function () { return ApiTypeAlias_1.ApiTypeAlias; } });
var TypeParameter_1 = require("./model/TypeParameter");
Object.defineProperty(exports, "TypeParameter", { enumerable: true, get: function () { return TypeParameter_1.TypeParameter; } });
var ApiVariable_1 = require("./model/ApiVariable");
Object.defineProperty(exports, "ApiVariable", { enumerable: true, get: function () { return ApiVariable_1.ApiVariable; } });
var HeritageType_1 = require("./model/HeritageType");
Object.defineProperty(exports, "HeritageType", { enumerable: true, get: function () { return HeritageType_1.HeritageType; } });
var SourceLocation_1 = require("./model/SourceLocation");
Object.defineProperty(exports, "SourceLocation", { enumerable: true, get: function () { return SourceLocation_1.SourceLocation; } });
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,72 @@
import { ApiDocumentedItem, type IApiDocumentedItemJson, type IApiDocumentedItemOptions } from './ApiDocumentedItem';
import { Excerpt, ExcerptToken, type IExcerptTokenRange, type IExcerptToken } from '../mixins/Excerpt';
import type { DeserializerContext } from '../model/DeserializerContext';
import { SourceLocation } from '../model/SourceLocation';
/**
* Constructor options for {@link ApiDeclaredItem}.
* @public
*/
export interface IApiDeclaredItemOptions extends IApiDocumentedItemOptions {
excerptTokens: IExcerptToken[];
fileUrlPath?: string;
}
export interface IApiDeclaredItemJson extends IApiDocumentedItemJson {
excerptTokens: IExcerptToken[];
fileUrlPath?: string;
}
/**
* The base class for API items that have an associated source code excerpt containing a TypeScript declaration.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* Most `ApiItem` subclasses have declarations and thus extend `ApiDeclaredItem`. Counterexamples include
* `ApiModel` and `ApiPackage`, which do not have any corresponding TypeScript source code.
*
* @public
*/
export declare class ApiDeclaredItem extends ApiDocumentedItem {
private _excerptTokens;
private _excerpt;
private _fileUrlPath?;
private _sourceLocation?;
constructor(options: IApiDeclaredItemOptions);
/** @override */
static onDeserializeInto(options: Partial<IApiDeclaredItemOptions>, context: DeserializerContext, jsonObject: IApiDeclaredItemJson): void;
/**
* The source code excerpt where the API item is declared.
*/
get excerpt(): Excerpt;
/**
* The individual source code tokens that comprise the main excerpt.
*/
get excerptTokens(): ReadonlyArray<ExcerptToken>;
/**
* The file URL path relative to the `projectFolder` and `projectFolderURL` fields
* as defined in the `api-extractor.json` config. Is `undefined` if the path is
* the same as the parent API item's.
*/
get fileUrlPath(): string | undefined;
/**
* Returns the source location where the API item is declared.
*/
get sourceLocation(): SourceLocation;
/**
* If the API item has certain important modifier tags such as `@sealed`, `@virtual`, or `@override`,
* this prepends them as a doc comment above the excerpt.
*/
getExcerptWithModifiers(): string;
/** @override */
serializeInto(jsonObject: Partial<IApiDeclaredItemJson>): void;
/**
* Constructs a new {@link Excerpt} corresponding to the provided token range.
*/
buildExcerpt(tokenRange: IExcerptTokenRange): Excerpt;
/**
* Builds the cached object used by the `sourceLocation` property.
*/
private _buildSourceLocation;
}
//# sourceMappingURL=ApiDeclaredItem.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiDeclaredItem.d.ts","sourceRoot":"","sources":["../../src/items/ApiDeclaredItem.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,yBAAyB;IACxE,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AAEH,qBAAa,eAAgB,SAAQ,iBAAiB;IACpD,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAEtB,OAAO,EAAE,uBAAuB;IAcnD,gBAAgB;WACF,iBAAiB,CAC7B,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,EACzC,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,oBAAoB,GAC/B,IAAI;IAOP;;OAEG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,aAAa,CAAC,YAAY,CAAC,CAEtD;IAED;;;;OAIG;IACH,IAAW,WAAW,IAAI,MAAM,GAAG,SAAS,CAE3C;IAED;;OAEG;IACH,IAAW,cAAc,IAAI,cAAc,CAK1C;IAED;;;OAGG;IACI,uBAAuB,IAAI,MAAM;IA0BxC,gBAAgB;IACT,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI;IAmBrE;;OAEG;IACI,YAAY,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO;IAI5D;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAgB7B"}

View File

@ -0,0 +1,142 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiDeclaredItem = void 0;
const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
const ApiDocumentedItem_1 = require("./ApiDocumentedItem");
const Excerpt_1 = require("../mixins/Excerpt");
const SourceLocation_1 = require("../model/SourceLocation");
/**
* The base class for API items that have an associated source code excerpt containing a TypeScript declaration.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* Most `ApiItem` subclasses have declarations and thus extend `ApiDeclaredItem`. Counterexamples include
* `ApiModel` and `ApiPackage`, which do not have any corresponding TypeScript source code.
*
* @public
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
class ApiDeclaredItem extends ApiDocumentedItem_1.ApiDocumentedItem {
constructor(options) {
super(options);
this._excerptTokens = options.excerptTokens.map((token) => {
const canonicalReference = token.canonicalReference === undefined
? undefined
: DeclarationReference_1.DeclarationReference.parse(token.canonicalReference);
return new Excerpt_1.ExcerptToken(token.kind, token.text, canonicalReference);
});
this._excerpt = new Excerpt_1.Excerpt(this.excerptTokens, { startIndex: 0, endIndex: this.excerptTokens.length });
this._fileUrlPath = options.fileUrlPath;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
super.onDeserializeInto(options, context, jsonObject);
options.excerptTokens = jsonObject.excerptTokens;
options.fileUrlPath = jsonObject.fileUrlPath;
}
/**
* The source code excerpt where the API item is declared.
*/
get excerpt() {
return this._excerpt;
}
/**
* The individual source code tokens that comprise the main excerpt.
*/
get excerptTokens() {
return this._excerptTokens;
}
/**
* The file URL path relative to the `projectFolder` and `projectFolderURL` fields
* as defined in the `api-extractor.json` config. Is `undefined` if the path is
* the same as the parent API item's.
*/
get fileUrlPath() {
return this._fileUrlPath;
}
/**
* Returns the source location where the API item is declared.
*/
get sourceLocation() {
if (!this._sourceLocation) {
this._sourceLocation = this._buildSourceLocation();
}
return this._sourceLocation;
}
/**
* If the API item has certain important modifier tags such as `@sealed`, `@virtual`, or `@override`,
* this prepends them as a doc comment above the excerpt.
*/
getExcerptWithModifiers() {
const excerpt = this.excerpt.text;
const modifierTags = [];
if (excerpt.length > 0) {
if (this instanceof ApiDocumentedItem_1.ApiDocumentedItem) {
if (this.tsdocComment) {
if (this.tsdocComment.modifierTagSet.isSealed()) {
modifierTags.push('@sealed');
}
if (this.tsdocComment.modifierTagSet.isVirtual()) {
modifierTags.push('@virtual');
}
if (this.tsdocComment.modifierTagSet.isOverride()) {
modifierTags.push('@override');
}
}
if (modifierTags.length > 0) {
return '/** ' + modifierTags.join(' ') + ' */\n' + excerpt;
}
}
}
return excerpt;
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.excerptTokens = this.excerptTokens.map((x) => {
const excerptToken = { kind: x.kind, text: x.text };
if (x.canonicalReference !== undefined) {
excerptToken.canonicalReference = x.canonicalReference.toString();
}
return excerptToken;
});
// Only serialize this API item's file URL path if it exists and it's different from its parent's
// (a little optimization to keep the doc model succinct).
if (this.fileUrlPath) {
if (!(this.parent instanceof ApiDeclaredItem) || this.fileUrlPath !== this.parent.fileUrlPath) {
jsonObject.fileUrlPath = this.fileUrlPath;
}
}
}
/**
* Constructs a new {@link Excerpt} corresponding to the provided token range.
*/
buildExcerpt(tokenRange) {
return new Excerpt_1.Excerpt(this.excerptTokens, tokenRange);
}
/**
* Builds the cached object used by the `sourceLocation` property.
*/
_buildSourceLocation() {
var _a;
const projectFolderUrl = (_a = this.getAssociatedPackage()) === null || _a === void 0 ? void 0 : _a.projectFolderUrl;
let fileUrlPath;
for (let current = this; current !== undefined; current = current.parent) {
if (current instanceof ApiDeclaredItem && current.fileUrlPath) {
fileUrlPath = current.fileUrlPath;
break;
}
}
return new SourceLocation_1.SourceLocation({
projectFolderUrl: projectFolderUrl,
fileUrlPath: fileUrlPath
});
}
}
exports.ApiDeclaredItem = ApiDeclaredItem;
//# sourceMappingURL=ApiDeclaredItem.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,33 @@
import * as tsdoc from '@microsoft/tsdoc';
import { ApiItem, type IApiItemOptions, type IApiItemJson } from './ApiItem';
import type { DeserializerContext } from '../model/DeserializerContext';
/**
* Constructor options for {@link ApiDocumentedItem}.
* @public
*/
export interface IApiDocumentedItemOptions extends IApiItemOptions {
docComment: tsdoc.DocComment | undefined;
}
export interface IApiDocumentedItemJson extends IApiItemJson {
docComment: string;
}
/**
* An abstract base class for API declarations that can have an associated TSDoc comment.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* @public
*/
export declare class ApiDocumentedItem extends ApiItem {
private _tsdocComment;
constructor(options: IApiDocumentedItemOptions);
/** @override */
static onDeserializeInto(options: Partial<IApiDocumentedItemOptions>, context: DeserializerContext, jsonObject: IApiItemJson): void;
get tsdocComment(): tsdoc.DocComment | undefined;
/** @override */
serializeInto(jsonObject: Partial<IApiDocumentedItemJson>): void;
}
//# sourceMappingURL=ApiDocumentedItem.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiDocumentedItem.d.ts","sourceRoot":"","sources":["../../src/items/ApiDocumentedItem.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC;CAC1C;AAED,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAO,CAAC,aAAa,CAA+B;gBAEjC,OAAO,EAAE,yBAAyB;IAKrD,gBAAgB;WACF,iBAAiB,CAC7B,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,EAC3C,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,YAAY,GACvB,IAAI;IAkBP,IAAW,YAAY,IAAI,KAAK,CAAC,UAAU,GAAG,SAAS,CAEtD;IAED,gBAAgB;IACT,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,IAAI;CAQxE"}

View File

@ -0,0 +1,75 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiDocumentedItem = void 0;
const tsdoc = __importStar(require("@microsoft/tsdoc"));
const ApiItem_1 = require("./ApiItem");
/**
* An abstract base class for API declarations that can have an associated TSDoc comment.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* @public
*/
class ApiDocumentedItem extends ApiItem_1.ApiItem {
constructor(options) {
super(options);
this._tsdocComment = options.docComment;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
super.onDeserializeInto(options, context, jsonObject);
const documentedJson = jsonObject;
if (documentedJson.docComment) {
const tsdocParser = new tsdoc.TSDocParser(context.tsdocConfiguration);
// NOTE: For now, we ignore TSDoc errors found in a serialized .api.json file.
// Normally these errors would have already been reported by API Extractor during analysis.
// However, they could also arise if the JSON file was edited manually, or if the file was saved
// using a different release of the software that used an incompatible syntax.
const parserContext = tsdocParser.parseString(documentedJson.docComment);
options.docComment = parserContext.docComment;
}
}
get tsdocComment() {
return this._tsdocComment;
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
if (this.tsdocComment !== undefined) {
jsonObject.docComment = this.tsdocComment.emitAsTsdoc();
}
else {
jsonObject.docComment = '';
}
}
}
exports.ApiDocumentedItem = ApiDocumentedItem;
//# sourceMappingURL=ApiDocumentedItem.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiDocumentedItem.js","sourceRoot":"","sources":["../../src/items/ApiDocumentedItem.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,wDAA0C;AAC1C,uCAA6E;AAe7E;;;;;;;;;GASG;AACH,MAAa,iBAAkB,SAAQ,iBAAO;IAG5C,YAAmB,OAAkC;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAC1C,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,iBAAiB,CAC7B,OAA2C,EAC3C,OAA4B,EAC5B,UAAwB;QAExB,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAEtD,MAAM,cAAc,GAA2B,UAAoC,CAAC;QAEpF,IAAI,cAAc,CAAC,UAAU,EAAE;YAC7B,MAAM,WAAW,GAAsB,IAAI,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;YAEzF,8EAA8E;YAC9E,2FAA2F;YAC3F,gGAAgG;YAChG,8EAA8E;YAC9E,MAAM,aAAa,GAAwB,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YAE9F,OAAO,CAAC,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;SAC/C;IACH,CAAC;IAED,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,gBAAgB;IACT,aAAa,CAAC,UAA2C;QAC9D,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE;YACnC,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACzD;aAAM;YACL,UAAU,CAAC,UAAU,GAAG,EAAE,CAAC;SAC5B;IACH,CAAC;CACF;AA5CD,8CA4CC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as tsdoc from '@microsoft/tsdoc';\nimport { ApiItem, type IApiItemOptions, type IApiItemJson } from './ApiItem';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Constructor options for {@link ApiDocumentedItem}.\n * @public\n */\nexport interface IApiDocumentedItemOptions extends IApiItemOptions {\n docComment: tsdoc.DocComment | undefined;\n}\n\nexport interface IApiDocumentedItemJson extends IApiItemJson {\n docComment: string;\n}\n\n/**\n * An abstract base class for API declarations that can have an associated TSDoc comment.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations.\n *\n * @public\n */\nexport class ApiDocumentedItem extends ApiItem {\n private _tsdocComment: tsdoc.DocComment | undefined;\n\n public constructor(options: IApiDocumentedItemOptions) {\n super(options);\n this._tsdocComment = options.docComment;\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiDocumentedItemOptions>,\n context: DeserializerContext,\n jsonObject: IApiItemJson\n ): void {\n super.onDeserializeInto(options, context, jsonObject);\n\n const documentedJson: IApiDocumentedItemJson = jsonObject as IApiDocumentedItemJson;\n\n if (documentedJson.docComment) {\n const tsdocParser: tsdoc.TSDocParser = new tsdoc.TSDocParser(context.tsdocConfiguration);\n\n // NOTE: For now, we ignore TSDoc errors found in a serialized .api.json file.\n // Normally these errors would have already been reported by API Extractor during analysis.\n // However, they could also arise if the JSON file was edited manually, or if the file was saved\n // using a different release of the software that used an incompatible syntax.\n const parserContext: tsdoc.ParserContext = tsdocParser.parseString(documentedJson.docComment);\n\n options.docComment = parserContext.docComment;\n }\n }\n\n public get tsdocComment(): tsdoc.DocComment | undefined {\n return this._tsdocComment;\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiDocumentedItemJson>): void {\n super.serializeInto(jsonObject);\n if (this.tsdocComment !== undefined) {\n jsonObject.docComment = this.tsdocComment.emitAsTsdoc();\n } else {\n jsonObject.docComment = '';\n }\n }\n}\n"]}

View File

@ -0,0 +1,180 @@
import type { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
import type { Constructor, PropertiesOf } from '../mixins/Mixin';
import type { ApiPackage } from '../model/ApiPackage';
import type { DeserializerContext } from '../model/DeserializerContext';
import type { ApiModel } from '../model/ApiModel';
/**
* The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of
* {@link ApiItem}.
*
* @public
*/
export declare enum ApiItemKind {
CallSignature = "CallSignature",
Class = "Class",
Constructor = "Constructor",
ConstructSignature = "ConstructSignature",
EntryPoint = "EntryPoint",
Enum = "Enum",
EnumMember = "EnumMember",
Function = "Function",
IndexSignature = "IndexSignature",
Interface = "Interface",
Method = "Method",
MethodSignature = "MethodSignature",
Model = "Model",
Namespace = "Namespace",
Package = "Package",
Property = "Property",
PropertySignature = "PropertySignature",
TypeAlias = "TypeAlias",
Variable = "Variable",
None = "None"
}
/**
* Constructor options for {@link ApiItem}.
* @public
*/
export interface IApiItemOptions {
}
export interface IApiItemJson {
kind: ApiItemKind;
canonicalReference: string;
}
export declare const apiItem_onParentChanged: unique symbol;
/**
* The abstract base class for all members of an `ApiModel` object.
*
* @remarks
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
* @public
*/
export declare class ApiItem {
private _canonicalReference;
private _parent;
constructor(options: IApiItemOptions);
static deserialize(jsonObject: IApiItemJson, context: DeserializerContext): ApiItem;
/** @virtual */
static onDeserializeInto(options: Partial<IApiItemOptions>, context: DeserializerContext, jsonObject: IApiItemJson): void;
/** @virtual */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
/**
* Identifies the subclass of the `ApiItem` base class.
* @virtual
*/
get kind(): ApiItemKind;
/**
* Warning: This API is used internally by API extractor but is not yet ready for general usage.
*
* @remarks
*
* Returns a `DeclarationReference` object using the experimental new declaration reference notation.
*
* @beta
*/
get canonicalReference(): DeclarationReference;
/**
* Returns a string key that can be used to efficiently retrieve an `ApiItem` from an `ApiItemContainerMixin`.
* The key is unique within the container. Its format is undocumented and may change at any time.
*
* @remarks
* Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation
* of this function, according to the aspects that are important for identifying it.
*
* @virtual
*/
get containerKey(): string;
/**
* Returns a name for this object that can be used in diagnostic messages, for example.
*
* @remarks
* For an object that inherits ApiNameMixin, this will return the declared name (e.g. the name of a TypeScript
* function). Otherwise, it will return a string such as "(call signature)" or "(model)".
*
* @virtual
*/
get displayName(): string;
/**
* If this item was added to a ApiItemContainerMixin item, then this returns the container item.
* If this is an Parameter that was added to a method or function, then this returns the function item.
* Otherwise, it returns undefined.
* @virtual
*/
get parent(): ApiItem | undefined;
/**
* This property supports a visitor pattern for walking the tree.
* For items with ApiItemContainerMixin, it returns the contained items, sorted alphabetically.
* Otherwise it returns an empty array.
* @virtual
*/
get members(): ReadonlyArray<ApiItem>;
/**
* If this item has a name (i.e. extends `ApiNameMixin`), then return all items that have the same parent
* and the same name. Otherwise, return all items that have the same parent and the same `ApiItemKind`.
*
* @remarks
* Examples: For a function, this would return all overloads for the function. For a constructor, this would
* return all overloads for the constructor. For a merged declaration (e.g. a `namespace` and `enum` with the
* same name), this would return both declarations. If this item does not have a parent, or if it is the only
* item of its name/kind, then the result is an array containing only this item.
*/
getMergedSiblings(): ReadonlyArray<ApiItem>;
/**
* Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.
*/
getHierarchy(): ReadonlyArray<ApiItem>;
/**
* This returns a scoped name such as `"Namespace1.Namespace2.MyClass.myMember()"`. It does not include the
* package name or entry point.
*
* @remarks
* If called on an ApiEntrypoint, ApiPackage, or ApiModel item, the result is an empty string.
*/
getScopedNameWithinPackage(): string;
/**
* If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned.
* Otherwise undefined is returned.
*/
getAssociatedPackage(): ApiPackage | undefined;
/**
* If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.
* Otherwise undefined is returned.
*/
getAssociatedModel(): ApiModel | undefined;
/**
* A text string whose value determines the sort order that is automatically applied by the
* {@link (ApiItemContainerMixin:interface)} class.
*
* @remarks
* The value of this string is undocumented and may change at any time.
* If {@link (ApiItemContainerMixin:interface).preserveMemberOrder} is enabled for the `ApiItem`'s parent,
* then no sorting is performed, and this key is not used.
*
* @virtual
*/
getSortKey(): string;
/**
* PRIVATE
*
* @privateRemarks
* Allows ApiItemContainerMixin to assign the parent when the item is added to a container.
*
* @internal
*/
[apiItem_onParentChanged](parent: ApiItem | undefined): void;
/**
* Builds the cached object used by the `canonicalReference` property.
* @virtual
*/
protected buildCanonicalReference(): DeclarationReference;
}
/**
* This abstraction is used by the mixin pattern.
* It describes a class type that inherits from {@link ApiItem}.
*
* @public
*/
export interface IApiItemConstructor extends Constructor<ApiItem>, PropertiesOf<typeof ApiItem> {
}
//# sourceMappingURL=ApiItem.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiItem.d.ts","sourceRoot":"","sources":["../../src/items/ApiItem.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,oBAAY,WAAW;IACrB,aAAa,kBAAkB;IAC/B,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,cAAc,mBAAmB;IACjC,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,eAAe,oBAAoB;IACnC,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,iBAAiB,sBAAsB;IACvC,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;CAAG;AAEnC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAID,eAAO,MAAM,uBAAuB,EAAE,OAAO,MAA4C,CAAC;AAE1F;;;;;;;GAOG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,mBAAmB,CAAmC;IAC9D,OAAO,CAAC,OAAO,CAAsB;gBAElB,OAAO,EAAE,eAAe;WAI7B,WAAW,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO;IAO1F,eAAe;WACD,iBAAiB,CAC7B,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,YAAY,GACvB,IAAI;IAIP,eAAe;IACR,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;IAK7D;;;OAGG;IACH,IAAW,IAAI,IAAI,WAAW,CAE7B;IAED;;;;;;;;OAQG;IACH,IAAW,kBAAkB,IAAI,oBAAoB,CAUpD;IAED;;;;;;;;;OASG;IACH,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED;;;;;;;;OAQG;IACH,IAAW,WAAW,IAAI,MAAM,CAc/B;IAED;;;;;OAKG;IACH,IAAW,MAAM,IAAI,OAAO,GAAG,SAAS,CAEvC;IAED;;;;;OAKG;IACH,IAAW,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAE3C;IAED;;;;;;;;;OASG;IACI,iBAAiB,IAAI,aAAa,CAAC,OAAO,CAAC;IAQlD;;OAEG;IACI,YAAY,IAAI,aAAa,CAAC,OAAO,CAAC;IAS7C;;;;;;OAMG;IACI,0BAA0B,IAAI,MAAM;IAiC3C;;;OAGG;IACI,oBAAoB,IAAI,UAAU,GAAG,SAAS;IASrD;;;OAGG;IACI,kBAAkB,IAAI,QAAQ,GAAG,SAAS;IASjD;;;;;;;;;;OAUG;IACI,UAAU,IAAI,MAAM;IAI3B;;;;;;;OAOG;IACI,CAAC,uBAAuB,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAKnE;;;OAGG;IACH,SAAS,CAAC,uBAAuB,IAAI,oBAAoB;CAG1D;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,OAAO,CAAC;CAAG"}

View File

@ -0,0 +1,274 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiItem = exports.apiItem_onParentChanged = exports.ApiItemKind = void 0;
const ApiParameterListMixin_1 = require("../mixins/ApiParameterListMixin");
const node_core_library_1 = require("@rushstack/node-core-library");
const ApiItemContainerMixin_1 = require("../mixins/ApiItemContainerMixin");
/**
* The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of
* {@link ApiItem}.
*
* @public
*/
var ApiItemKind;
(function (ApiItemKind) {
ApiItemKind["CallSignature"] = "CallSignature";
ApiItemKind["Class"] = "Class";
ApiItemKind["Constructor"] = "Constructor";
ApiItemKind["ConstructSignature"] = "ConstructSignature";
ApiItemKind["EntryPoint"] = "EntryPoint";
ApiItemKind["Enum"] = "Enum";
ApiItemKind["EnumMember"] = "EnumMember";
ApiItemKind["Function"] = "Function";
ApiItemKind["IndexSignature"] = "IndexSignature";
ApiItemKind["Interface"] = "Interface";
ApiItemKind["Method"] = "Method";
ApiItemKind["MethodSignature"] = "MethodSignature";
ApiItemKind["Model"] = "Model";
ApiItemKind["Namespace"] = "Namespace";
ApiItemKind["Package"] = "Package";
ApiItemKind["Property"] = "Property";
ApiItemKind["PropertySignature"] = "PropertySignature";
ApiItemKind["TypeAlias"] = "TypeAlias";
ApiItemKind["Variable"] = "Variable";
ApiItemKind["None"] = "None";
})(ApiItemKind = exports.ApiItemKind || (exports.ApiItemKind = {}));
// PRIVATE - Allows ApiItemContainerMixin to assign the parent.
//
exports.apiItem_onParentChanged = Symbol('ApiItem._onAddToContainer');
/**
* The abstract base class for all members of an `ApiModel` object.
*
* @remarks
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
* @public
*/
class ApiItem {
constructor(options) {
// ("options" is not used here, but part of the inheritance pattern)
}
static deserialize(jsonObject, context) {
// The Deserializer class is coupled with a ton of other classes, so we delay loading it
// to avoid ES5 circular imports.
const deserializerModule = require('../model/Deserializer');
return deserializerModule.Deserializer.deserialize(context, jsonObject);
}
/** @virtual */
static onDeserializeInto(options, context, jsonObject) {
// (implemented by subclasses)
}
/** @virtual */
serializeInto(jsonObject) {
jsonObject.kind = this.kind;
jsonObject.canonicalReference = this.canonicalReference.toString();
}
/**
* Identifies the subclass of the `ApiItem` base class.
* @virtual
*/
get kind() {
throw new Error('ApiItem.kind was not implemented by the child class');
}
/**
* Warning: This API is used internally by API extractor but is not yet ready for general usage.
*
* @remarks
*
* Returns a `DeclarationReference` object using the experimental new declaration reference notation.
*
* @beta
*/
get canonicalReference() {
if (!this._canonicalReference) {
try {
this._canonicalReference = this.buildCanonicalReference();
}
catch (e) {
const name = this.getScopedNameWithinPackage() || this.displayName;
throw new node_core_library_1.InternalError(`Error building canonical reference for ${name}:\n` + e.message);
}
}
return this._canonicalReference;
}
/**
* Returns a string key that can be used to efficiently retrieve an `ApiItem` from an `ApiItemContainerMixin`.
* The key is unique within the container. Its format is undocumented and may change at any time.
*
* @remarks
* Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation
* of this function, according to the aspects that are important for identifying it.
*
* @virtual
*/
get containerKey() {
throw new node_core_library_1.InternalError('ApiItem.containerKey was not implemented by the child class');
}
/**
* Returns a name for this object that can be used in diagnostic messages, for example.
*
* @remarks
* For an object that inherits ApiNameMixin, this will return the declared name (e.g. the name of a TypeScript
* function). Otherwise, it will return a string such as "(call signature)" or "(model)".
*
* @virtual
*/
get displayName() {
switch (this.kind) {
case ApiItemKind.CallSignature:
return '(call)';
case ApiItemKind.Constructor:
return '(constructor)';
case ApiItemKind.ConstructSignature:
return '(new)';
case ApiItemKind.IndexSignature:
return '(indexer)';
case ApiItemKind.Model:
return '(model)';
}
return '(???)'; // All other types should inherit ApiNameMixin which will override this property
}
/**
* If this item was added to a ApiItemContainerMixin item, then this returns the container item.
* If this is an Parameter that was added to a method or function, then this returns the function item.
* Otherwise, it returns undefined.
* @virtual
*/
get parent() {
return this._parent;
}
/**
* This property supports a visitor pattern for walking the tree.
* For items with ApiItemContainerMixin, it returns the contained items, sorted alphabetically.
* Otherwise it returns an empty array.
* @virtual
*/
get members() {
return [];
}
/**
* If this item has a name (i.e. extends `ApiNameMixin`), then return all items that have the same parent
* and the same name. Otherwise, return all items that have the same parent and the same `ApiItemKind`.
*
* @remarks
* Examples: For a function, this would return all overloads for the function. For a constructor, this would
* return all overloads for the constructor. For a merged declaration (e.g. a `namespace` and `enum` with the
* same name), this would return both declarations. If this item does not have a parent, or if it is the only
* item of its name/kind, then the result is an array containing only this item.
*/
getMergedSiblings() {
const parent = this._parent;
if (parent && ApiItemContainerMixin_1.ApiItemContainerMixin.isBaseClassOf(parent)) {
return parent._getMergedSiblingsForMember(this);
}
return [];
}
/**
* Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.
*/
getHierarchy() {
const hierarchy = [];
for (let current = this; current !== undefined; current = current.parent) {
hierarchy.push(current);
}
hierarchy.reverse();
return hierarchy;
}
/**
* This returns a scoped name such as `"Namespace1.Namespace2.MyClass.myMember()"`. It does not include the
* package name or entry point.
*
* @remarks
* If called on an ApiEntrypoint, ApiPackage, or ApiModel item, the result is an empty string.
*/
getScopedNameWithinPackage() {
const reversedParts = [];
for (let current = this; current !== undefined; current = current.parent) {
if (current.kind === ApiItemKind.Model ||
current.kind === ApiItemKind.Package ||
current.kind === ApiItemKind.EntryPoint) {
break;
}
if (reversedParts.length !== 0) {
reversedParts.push('.');
}
else {
switch (current.kind) {
case ApiItemKind.CallSignature:
case ApiItemKind.ConstructSignature:
case ApiItemKind.Constructor:
case ApiItemKind.IndexSignature:
// These functional forms don't have a proper name, so we don't append the "()" suffix
break;
default:
if (ApiParameterListMixin_1.ApiParameterListMixin.isBaseClassOf(current)) {
reversedParts.push('()');
}
}
}
reversedParts.push(current.displayName);
}
return reversedParts.reverse().join('');
}
/**
* If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned.
* Otherwise undefined is returned.
*/
getAssociatedPackage() {
for (let current = this; current !== undefined; current = current.parent) {
if (current.kind === ApiItemKind.Package) {
return current;
}
}
return undefined;
}
/**
* If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.
* Otherwise undefined is returned.
*/
getAssociatedModel() {
for (let current = this; current !== undefined; current = current.parent) {
if (current.kind === ApiItemKind.Model) {
return current;
}
}
return undefined;
}
/**
* A text string whose value determines the sort order that is automatically applied by the
* {@link (ApiItemContainerMixin:interface)} class.
*
* @remarks
* The value of this string is undocumented and may change at any time.
* If {@link (ApiItemContainerMixin:interface).preserveMemberOrder} is enabled for the `ApiItem`'s parent,
* then no sorting is performed, and this key is not used.
*
* @virtual
*/
getSortKey() {
return this.containerKey;
}
/**
* PRIVATE
*
* @privateRemarks
* Allows ApiItemContainerMixin to assign the parent when the item is added to a container.
*
* @internal
*/
[exports.apiItem_onParentChanged](parent) {
this._parent = parent;
this._canonicalReference = undefined;
}
/**
* Builds the cached object used by the `canonicalReference` property.
* @virtual
*/
buildCanonicalReference() {
throw new node_core_library_1.InternalError('ApiItem.canonicalReference was not implemented by the child class');
}
}
exports.ApiItem = ApiItem;
//# sourceMappingURL=ApiItem.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,47 @@
import type { Excerpt, IExcerptTokenRange } from '../mixins/Excerpt';
import { type IApiDeclaredItemOptions, ApiDeclaredItem, type IApiDeclaredItemJson } from '../items/ApiDeclaredItem';
import { ApiReleaseTagMixin, type IApiReleaseTagMixinOptions } from '../mixins/ApiReleaseTagMixin';
import { type IApiNameMixinOptions, ApiNameMixin } from '../mixins/ApiNameMixin';
import type { DeserializerContext } from '../model/DeserializerContext';
import { ApiOptionalMixin, type IApiOptionalMixinOptions } from '../mixins/ApiOptionalMixin';
import { ApiReadonlyMixin, type IApiReadonlyMixinOptions } from '../mixins/ApiReadonlyMixin';
/**
* Constructor options for {@link ApiPropertyItem}.
* @public
*/
export interface IApiPropertyItemOptions extends IApiNameMixinOptions, IApiReleaseTagMixinOptions, IApiOptionalMixinOptions, IApiReadonlyMixinOptions, IApiDeclaredItemOptions {
propertyTypeTokenRange: IExcerptTokenRange;
}
export interface IApiPropertyItemJson extends IApiDeclaredItemJson {
propertyTypeTokenRange: IExcerptTokenRange;
}
declare const ApiPropertyItem_base: typeof ApiDeclaredItem & (new (...args: any[]) => ApiReadonlyMixin) & (new (...args: any[]) => ApiOptionalMixin) & (new (...args: any[]) => ApiReleaseTagMixin) & (new (...args: any[]) => ApiNameMixin);
/**
* The abstract base class for {@link ApiProperty} and {@link ApiPropertySignature}.
*
* @public
*/
export declare class ApiPropertyItem extends ApiPropertyItem_base {
/**
* An {@link Excerpt} that describes the type of the property.
*/
readonly propertyTypeExcerpt: Excerpt;
constructor(options: IApiPropertyItemOptions);
/** @override */
static onDeserializeInto(options: Partial<IApiPropertyItemOptions>, context: DeserializerContext, jsonObject: IApiPropertyItemJson): void;
/**
* Returns true if this property should be documented as an event.
*
* @remarks
* The `@eventProperty` TSDoc modifier can be added to readonly properties to indicate that they return an
* event object that event handlers can be attached to. The event-handling API is implementation-defined, but
* typically the return type would be a class with members such as `addHandler()` and `removeHandler()`.
* The documentation should display such properties under an "Events" heading instead of the
* usual "Properties" heading.
*/
get isEventProperty(): boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiPropertyItemJson>): void;
}
export {};
//# sourceMappingURL=ApiPropertyItem.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiPropertyItem.d.ts","sourceRoot":"","sources":["../../src/items/ApiPropertyItem.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EACL,KAAK,uBAAuB,EAC5B,eAAe,EACf,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,KAAK,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAAE,KAAK,oBAAoB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE7F;;;GAGG;AACH,MAAM,WAAW,uBACf,SAAQ,oBAAoB,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB;IACzB,sBAAsB,EAAE,kBAAkB,CAAC;CAC5C;AAED,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,sBAAsB,EAAE,kBAAkB,CAAC;CAC5C;;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,oBAEpC;IACC;;OAEG;IACH,SAAgB,mBAAmB,EAAE,OAAO,CAAC;gBAE1B,OAAO,EAAE,uBAAuB;IAMnD,gBAAgB;WACF,iBAAiB,CAC7B,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,EACzC,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,oBAAoB,GAC/B,IAAI;IAMP;;;;;;;;;OASG;IACH,IAAW,eAAe,IAAI,OAAO,CAKpC;IAED,gBAAgB;IACT,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI;CAKtE"}

View File

@ -0,0 +1,49 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiPropertyItem = void 0;
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const ApiReleaseTagMixin_1 = require("../mixins/ApiReleaseTagMixin");
const ApiNameMixin_1 = require("../mixins/ApiNameMixin");
const ApiOptionalMixin_1 = require("../mixins/ApiOptionalMixin");
const ApiReadonlyMixin_1 = require("../mixins/ApiReadonlyMixin");
/**
* The abstract base class for {@link ApiProperty} and {@link ApiPropertySignature}.
*
* @public
*/
class ApiPropertyItem extends (0, ApiNameMixin_1.ApiNameMixin)((0, ApiReleaseTagMixin_1.ApiReleaseTagMixin)((0, ApiOptionalMixin_1.ApiOptionalMixin)((0, ApiReadonlyMixin_1.ApiReadonlyMixin)(ApiDeclaredItem_1.ApiDeclaredItem)))) {
constructor(options) {
super(options);
this.propertyTypeExcerpt = this.buildExcerpt(options.propertyTypeTokenRange);
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
super.onDeserializeInto(options, context, jsonObject);
options.propertyTypeTokenRange = jsonObject.propertyTypeTokenRange;
}
/**
* Returns true if this property should be documented as an event.
*
* @remarks
* The `@eventProperty` TSDoc modifier can be added to readonly properties to indicate that they return an
* event object that event handlers can be attached to. The event-handling API is implementation-defined, but
* typically the return type would be a class with members such as `addHandler()` and `removeHandler()`.
* The documentation should display such properties under an "Events" heading instead of the
* usual "Properties" heading.
*/
get isEventProperty() {
if (this.tsdocComment) {
return this.tsdocComment.modifierTagSet.isEventProperty();
}
return false;
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.propertyTypeTokenRange = this.propertyTypeExcerpt.tokenRange;
}
}
exports.ApiPropertyItem = ApiPropertyItem;
//# sourceMappingURL=ApiPropertyItem.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiPropertyItem.js","sourceRoot":"","sources":["../../src/items/ApiPropertyItem.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,8DAIkC;AAClC,qEAAmG;AACnG,yDAAiF;AAEjF,iEAA6F;AAC7F,iEAA6F;AAmB7F;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,IAAA,2BAAY,EAC/C,IAAA,uCAAkB,EAAC,IAAA,mCAAgB,EAAC,IAAA,mCAAgB,EAAC,iCAAe,CAAC,CAAC,CAAC,CACxE;IAMC,YAAmB,OAAgC;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/E,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,iBAAiB,CAC7B,OAAyC,EACzC,OAA4B,EAC5B,UAAgC;QAEhC,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAEtD,OAAO,CAAC,sBAAsB,GAAG,UAAU,CAAC,sBAAsB,CAAC;IACrE,CAAC;IAED;;;;;;;;;OASG;IACH,IAAW,eAAe;QACxB,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;SAC3D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IACT,aAAa,CAAC,UAAyC;QAC5D,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAEhC,UAAU,CAAC,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC;IAC1E,CAAC;CACF;AAhDD,0CAgDC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { Excerpt, IExcerptTokenRange } from '../mixins/Excerpt';\nimport {\n type IApiDeclaredItemOptions,\n ApiDeclaredItem,\n type IApiDeclaredItemJson\n} from '../items/ApiDeclaredItem';\nimport { ApiReleaseTagMixin, type IApiReleaseTagMixinOptions } from '../mixins/ApiReleaseTagMixin';\nimport { type IApiNameMixinOptions, ApiNameMixin } from '../mixins/ApiNameMixin';\nimport type { DeserializerContext } from '../model/DeserializerContext';\nimport { ApiOptionalMixin, type IApiOptionalMixinOptions } from '../mixins/ApiOptionalMixin';\nimport { ApiReadonlyMixin, type IApiReadonlyMixinOptions } from '../mixins/ApiReadonlyMixin';\n\n/**\n * Constructor options for {@link ApiPropertyItem}.\n * @public\n */\nexport interface IApiPropertyItemOptions\n extends IApiNameMixinOptions,\n IApiReleaseTagMixinOptions,\n IApiOptionalMixinOptions,\n IApiReadonlyMixinOptions,\n IApiDeclaredItemOptions {\n propertyTypeTokenRange: IExcerptTokenRange;\n}\n\nexport interface IApiPropertyItemJson extends IApiDeclaredItemJson {\n propertyTypeTokenRange: IExcerptTokenRange;\n}\n\n/**\n * The abstract base class for {@link ApiProperty} and {@link ApiPropertySignature}.\n *\n * @public\n */\nexport class ApiPropertyItem extends ApiNameMixin(\n ApiReleaseTagMixin(ApiOptionalMixin(ApiReadonlyMixin(ApiDeclaredItem)))\n) {\n /**\n * An {@link Excerpt} that describes the type of the property.\n */\n public readonly propertyTypeExcerpt: Excerpt;\n\n public constructor(options: IApiPropertyItemOptions) {\n super(options);\n\n this.propertyTypeExcerpt = this.buildExcerpt(options.propertyTypeTokenRange);\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiPropertyItemOptions>,\n context: DeserializerContext,\n jsonObject: IApiPropertyItemJson\n ): void {\n super.onDeserializeInto(options, context, jsonObject);\n\n options.propertyTypeTokenRange = jsonObject.propertyTypeTokenRange;\n }\n\n /**\n * Returns true if this property should be documented as an event.\n *\n * @remarks\n * The `@eventProperty` TSDoc modifier can be added to readonly properties to indicate that they return an\n * event object that event handlers can be attached to. The event-handling API is implementation-defined, but\n * typically the return type would be a class with members such as `addHandler()` and `removeHandler()`.\n * The documentation should display such properties under an \"Events\" heading instead of the\n * usual \"Properties\" heading.\n */\n public get isEventProperty(): boolean {\n if (this.tsdocComment) {\n return this.tsdocComment.modifierTagSet.isEventProperty();\n }\n return false;\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiPropertyItemJson>): void {\n super.serializeInto(jsonObject);\n\n jsonObject.propertyTypeTokenRange = this.propertyTypeExcerpt.tokenRange;\n }\n}\n"]}

View File

@ -0,0 +1,60 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (ApiAbstractMixin:interface)}.
* @public
*/
export interface IApiAbstractMixinOptions extends IApiItemOptions {
isAbstract: boolean;
}
export interface IApiAbstractMixinJson extends IApiItemJson {
isAbstract: boolean;
}
/**
* The mixin base class for API items that have an abstract modifier.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiAbstractMixin extends ApiItem {
/**
* Indicates that the API item's value has an 'abstract' modifier.
*/
readonly isAbstract: boolean;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiAbstractMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiAbstractMixin:interface)}
* functionality.
*
* @public
*/
export declare function ApiAbstractMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiAbstractMixin);
/**
* Static members for {@link (ApiAbstractMixin:interface)}.
* @public
*/
export declare namespace ApiAbstractMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiAbstractMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiAbstractMixin;
}
//# sourceMappingURL=ApiAbstractMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiAbstractMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiAbstractMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAoCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,62 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiAbstractMixin = void 0;
const _isAbstract = Symbol('ApiAbstractMixin._isAbstract');
/**
* Mixin function for {@link (ApiAbstractMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiAbstractMixin:interface)}
* functionality.
*
* @public
*/
function ApiAbstractMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isAbstract] = options.isAbstract;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isAbstract = jsonObject.isAbstract || false;
}
get isAbstract() {
return this[_isAbstract];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isAbstract = this.isAbstract;
}
}
return MixedClass;
}
exports.ApiAbstractMixin = ApiAbstractMixin;
/**
* Static members for {@link (ApiAbstractMixin:interface)}.
* @public
*/
(function (ApiAbstractMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiAbstractMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isAbstract);
}
ApiAbstractMixin.isBaseClassOf = isBaseClassOf;
})(ApiAbstractMixin = exports.ApiAbstractMixin || (exports.ApiAbstractMixin = {}));
//# sourceMappingURL=ApiAbstractMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,83 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiExportedMixinOptions:interface)}.
* @public
*/
export interface IApiExportedMixinOptions extends IApiItemOptions {
isExported: boolean;
}
export interface IApiExportedMixinJson extends IApiItemJson {
isExported: boolean;
}
/**
* The mixin base class for API items that can be exported.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiExportedMixin extends ApiItem {
/**
* Whether the declaration is exported from its parent item container (i.e. either an `ApiEntryPoint` or an
* `ApiNamespace`).
*
* @remarks
* Suppose `index.ts` is your entry point:
*
* ```ts
* // index.ts
*
* export class A {}
* class B {}
*
* namespace n {
* export class C {}
* class D {}
* }
*
* // file.ts
* export class E {}
* ```
*
* Classes `A` and `C` are both exported, while classes `B`, `D`, and `E` are not. `E` is exported from its
* local file, but not from its parent item container (i.e. the entry point).
*
*/
readonly isExported: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiExportedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiExportedMixin:interface)} functionality.
*
* @public
*/
export declare function ApiExportedMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiExportedMixin);
/**
* Static members for {@link (ApiExportedMixin:interface)}.
* @public
*/
export declare namespace ApiExportedMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiExportedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiExportedMixin;
}
//# sourceMappingURL=ApiExportedMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiExportedMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiExportedMixin.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAyCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,67 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiExportedMixin = void 0;
/* eslint-disable @typescript-eslint/no-redeclare */
const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
const _isExported = Symbol('ApiExportedMixin._isExported');
/**
* Mixin function for {@link (ApiExportedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiExportedMixin:interface)} functionality.
*
* @public
*/
function ApiExportedMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isExported] = options.isExported;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
const declarationReference = DeclarationReference_1.DeclarationReference.parse(jsonObject.canonicalReference);
options.isExported = declarationReference.navigation === "." /* Navigation.Exports */;
}
get isExported() {
return this[_isExported];
}
/**
* The `isExported` property is intentionally not serialized because the information is already present
* in the item's `canonicalReference`.
* @override
*/
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
}
}
return MixedClass;
}
exports.ApiExportedMixin = ApiExportedMixin;
/**
* Static members for {@link (ApiExportedMixin:interface)}.
* @public
*/
(function (ApiExportedMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiExportedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isExported);
}
ApiExportedMixin.isBaseClassOf = isBaseClassOf;
})(ApiExportedMixin = exports.ApiExportedMixin || (exports.ApiExportedMixin = {}));
//# sourceMappingURL=ApiExportedMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import type { IExcerptTokenRange, Excerpt } from './Excerpt';
/**
* Constructor options for {@link (IApiInitializerMixinOptions:interface)}.
* @public
*/
export interface IApiInitializerMixinOptions extends IApiItemOptions {
initializerTokenRange?: IExcerptTokenRange;
}
export interface IApiInitializerMixinJson extends IApiItemJson {
initializerTokenRange?: IExcerptTokenRange;
}
/**
* The mixin base class for API items that can have an initializer.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiInitializerMixin extends ApiItem {
/**
* An {@link Excerpt} that describes the item's initializer.
*/
readonly initializerExcerpt?: Excerpt;
/** @override */
serializeInto(jsonObject: Partial<IApiInitializerMixinJson>): void;
}
/**
* Mixin function for {@link (ApiInitializerMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiInitializerMixin:interface)} functionality.
*
* @public
*/
export declare function ApiInitializerMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiInitializerMixin);
/**
* Static members for {@link (ApiInitializerMixin:interface)}.
* @public
*/
export declare namespace ApiInitializerMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiInitializerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiInitializerMixin;
}
//# sourceMappingURL=ApiInitializerMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiInitializerMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiInitializerMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAK7D;;;GAGG;AACH,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,qBAAqB,CAAC,EAAE,kBAAkB,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAyB,SAAQ,YAAY;IAC5D,qBAAqB,CAAC,EAAE,kBAAkB,CAAC;CAC5C;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,OAAO;IAClD;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAEtC,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC;CACpE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,SAAS,mBAAmB,EACxE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,mBAAmB,CAAC,CAgD5D;AAED;;;GAGG;AACH,yBAAiB,mBAAmB,CAAC;IACnC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAE9E;CACF"}

View File

@ -0,0 +1,73 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiInitializerMixin = void 0;
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const node_core_library_1 = require("@rushstack/node-core-library");
const _initializerExcerpt = Symbol('ApiInitializerMixin._initializerExcerpt');
/**
* Mixin function for {@link (ApiInitializerMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiInitializerMixin:interface)} functionality.
*
* @public
*/
function ApiInitializerMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
if (options.initializerTokenRange) {
this[_initializerExcerpt] = this.buildExcerpt(options.initializerTokenRange);
}
}
else {
throw new node_core_library_1.InternalError('ApiInitializerMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.initializerTokenRange = jsonObject.initializerTokenRange;
}
get initializerExcerpt() {
return this[_initializerExcerpt];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
// Note that JSON does not support the "undefined" value, so we simply omit the field entirely if it is undefined
if (this.initializerExcerpt) {
jsonObject.initializerTokenRange = this.initializerExcerpt.tokenRange;
}
}
}
return MixedClass;
}
exports.ApiInitializerMixin = ApiInitializerMixin;
/**
* Static members for {@link (ApiInitializerMixin:interface)}.
* @public
*/
(function (ApiInitializerMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiInitializerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_initializerExcerpt);
}
ApiInitializerMixin.isBaseClassOf = isBaseClassOf;
})(ApiInitializerMixin = exports.ApiInitializerMixin || (exports.ApiInitializerMixin = {}));
//# sourceMappingURL=ApiInitializerMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,161 @@
import { ApiItem, type IApiItemJson, type IApiItemOptions, type IApiItemConstructor } from '../items/ApiItem';
import { type IFindApiItemsResult } from './IFindApiItemsResult';
/**
* Constructor options for {@link (ApiItemContainerMixin:interface)}.
* @public
*/
export interface IApiItemContainerMixinOptions extends IApiItemOptions {
preserveMemberOrder?: boolean;
members?: ApiItem[];
}
export interface IApiItemContainerJson extends IApiItemJson {
preserveMemberOrder?: boolean;
members: IApiItemJson[];
}
/**
* The mixin base class for API items that act as containers for other child items.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* Examples of `ApiItemContainerMixin` child classes include `ApiModel`, `ApiPackage`, `ApiEntryPoint`,
* and `ApiEnum`. But note that `Parameter` is not considered a "member" of an `ApiMethod`; this relationship
* is modeled using {@link (ApiParameterListMixin:interface).parameters} instead
* of {@link ApiItem.members}.
*
* @public
*/
export interface ApiItemContainerMixin extends ApiItem {
/**
* Disables automatic sorting of {@link ApiItem.members}.
*
* @remarks
* By default `ApiItemContainerMixin` will automatically sort its members according to their
* {@link ApiItem.getSortKey} string, which provides a standardized mostly alphabetical ordering
* that is appropriate for most API items. When loading older .api.json files the automatic sorting
* is reapplied and may update the ordering.
*
* Set `preserveMemberOrder` to true to disable automatic sorting for this container; instead, the
* members will retain whatever ordering appeared in the {@link IApiItemContainerMixinOptions.members} array.
* The `preserveMemberOrder` option is saved in the .api.json file.
*/
readonly preserveMemberOrder: boolean;
/**
* Adds a new member to the container.
*
* @remarks
* An ApiItem cannot be added to more than one container.
*/
addMember(member: ApiItem): void;
/**
* Attempts to retrieve a member using its containerKey, or returns `undefined` if no matching member was found.
*
* @remarks
* Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation
* of this function, according to the aspects that are important for identifying it.
*
* See {@link ApiItem.containerKey} for more information.
*/
tryGetMemberByKey(containerKey: string): ApiItem | undefined;
/**
* Returns a list of members with the specified name.
*/
findMembersByName(name: string): ReadonlyArray<ApiItem>;
/**
* Finds all of the ApiItem's immediate and inherited members by walking up the inheritance tree.
*
* @remarks
*
* Given the following class heritage:
*
* ```
* export class A {
* public a: number|boolean;
* }
*
* export class B extends A {
* public a: number;
* public b: string;
* }
*
* export class C extends B {
* public c: boolean;
* }
* ```
*
* Calling `findMembersWithInheritance` on `C` will return `B.a`, `B.b`, and `C.c`. Calling the
* method on `B` will return `B.a` and `B.b`. And calling the method on `A` will return just
* `A.a`.
*
* The inherited members returned by this method may be incomplete. If so, there will be a flag
* on the result object indicating this as well as messages explaining the errors in more detail.
* Some scenarios include:
*
* - Interface extending from a type alias.
*
* - Class extending from a variable.
*
* - Extending from a declaration not present in the model (e.g. external package).
*
* - Extending from an unexported declaration (e.g. ae-forgotten-export). Common in mixin
* patterns.
*
* - Unexpected runtime errors...
*
* Lastly, be aware that the types of inherited members are returned with respect to their
* defining class as opposed to with respect to the inheriting class. For example, consider
* the following:
*
* ```
* export class A<T> {
* public a: T;
* }
*
* export class B extends A<number> {}
* ```
*
* When called on `B`, this method will return `B.a` with type `T` as opposed to type
* `number`, although the latter is more accurate.
*/
findMembersWithInheritance(): IFindApiItemsResult;
/**
* For a given member of this container, return its `ApiItem.getMergedSiblings()` list.
* @internal
*/
_getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem>;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link ApiDeclaredItem}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.
*
* @public
*/
export declare function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiItemContainerMixin);
/**
* Static members for {@link (ApiItemContainerMixin:interface)}.
* @public
*/
export declare namespace ApiItemContainerMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiItemContainerMixin;
}
//# sourceMappingURL=ApiItemContainerMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiItemContainerMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiItemContainerMixin.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,OAAO,EAEP,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,uBAAuB,CAAC;AAM/B;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,eAAe;IACpE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AASD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IAEtC;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAEjC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAE7D;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;IACH,0BAA0B,IAAI,mBAAmB,CAAC;IAElD;;;OAGG;IACH,2BAA2B,CAAC,aAAa,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAE5E,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,mBAAmB,EAC1E,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,qBAAqB,CAAC,CAkV9D;AAED;;;GAGG;AACH,yBAAiB,qBAAqB,CAAC;IACrC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAEhF;CACF"}

View File

@ -0,0 +1,323 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiItemContainerMixin = void 0;
/* eslint-disable @typescript-eslint/no-redeclare */
const ApiItem_1 = require("../items/ApiItem");
const ApiNameMixin_1 = require("./ApiNameMixin");
const Excerpt_1 = require("./Excerpt");
const IFindApiItemsResult_1 = require("./IFindApiItemsResult");
const node_core_library_1 = require("@rushstack/node-core-library");
const _members = Symbol('ApiItemContainerMixin._members');
const _membersSorted = Symbol('ApiItemContainerMixin._membersSorted');
const _membersByContainerKey = Symbol('ApiItemContainerMixin._membersByContainerKey');
const _membersByName = Symbol('ApiItemContainerMixin._membersByName');
const _membersByKind = Symbol('ApiItemContainerMixin._membersByKind');
const _preserveMemberOrder = Symbol('ApiItemContainerMixin._preserveMemberOrder');
/**
* Mixin function for {@link ApiDeclaredItem}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.
*
* @public
*/
function ApiItemContainerMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
var _a;
super(...args);
const options = args[0];
this[_members] = [];
this[_membersSorted] = false;
this[_membersByContainerKey] = new Map();
this[_preserveMemberOrder] = (_a = options.preserveMemberOrder) !== null && _a !== void 0 ? _a : false;
if (options.members) {
for (const member of options.members) {
this.addMember(member);
}
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.preserveMemberOrder = jsonObject.preserveMemberOrder;
options.members = [];
for (const memberObject of jsonObject.members) {
options.members.push(ApiItem_1.ApiItem.deserialize(memberObject, context));
}
}
/** @override */
get members() {
if (!this[_membersSorted] && !this[_preserveMemberOrder]) {
this[_members].sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
this[_membersSorted] = true;
}
return this[_members];
}
get preserveMemberOrder() {
return this[_preserveMemberOrder];
}
addMember(member) {
if (this[_membersByContainerKey].has(member.containerKey)) {
throw new Error(`Another member has already been added with the same name (${member.displayName})` +
` and containerKey (${member.containerKey})`);
}
const existingParent = member.parent;
if (existingParent !== undefined) {
throw new Error(`This item has already been added to another container: "${existingParent.displayName}"`);
}
this[_members].push(member);
this[_membersByName] = undefined; // invalidate the lookup
this[_membersByKind] = undefined; // invalidate the lookup
this[_membersSorted] = false;
this[_membersByContainerKey].set(member.containerKey, member);
member[ApiItem_1.apiItem_onParentChanged](this);
}
tryGetMemberByKey(containerKey) {
return this[_membersByContainerKey].get(containerKey);
}
findMembersByName(name) {
this._ensureMemberMaps();
return this[_membersByName].get(name) || [];
}
findMembersWithInheritance() {
const messages = [];
let maybeIncompleteResult = false;
// For API items that don't support inheritance, this method just returns the item's
// immediate members.
switch (this.kind) {
case ApiItem_1.ApiItemKind.Class:
case ApiItem_1.ApiItemKind.Interface:
break;
default: {
return {
items: this.members.concat(),
messages,
maybeIncompleteResult
};
}
}
const membersByName = new Map();
const membersByKind = new Map();
const toVisit = [];
let next = this;
while (next) {
const membersToAdd = [];
// For each member, check to see if we've already seen a member with the same name
// previously in the inheritance tree. If so, we know we won't inherit it, and thus
// do not add it to our `membersToAdd` array.
for (const member of next.members) {
// We add the to-be-added members to an intermediate array instead of immediately
// to the maps themselves to support method overloads with the same name.
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
if (!membersByName.has(member.name)) {
membersToAdd.push(member);
}
}
else {
if (!membersByKind.has(member.kind)) {
membersToAdd.push(member);
}
}
}
for (const member of membersToAdd) {
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
const members = membersByName.get(member.name) || [];
members.push(member);
membersByName.set(member.name, members);
}
else {
const members = membersByKind.get(member.kind) || [];
members.push(member);
membersByKind.set(member.kind, members);
}
}
// Interfaces can extend multiple interfaces, so iterate through all of them.
const extendedItems = [];
let extendsTypes;
switch (next.kind) {
case ApiItem_1.ApiItemKind.Class: {
const apiClass = next;
extendsTypes = apiClass.extendsType ? [apiClass.extendsType] : [];
break;
}
case ApiItem_1.ApiItemKind.Interface: {
const apiInterface = next;
extendsTypes = apiInterface.extendsTypes;
break;
}
}
if (extendsTypes === undefined) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.UnsupportedKind,
text: `Unable to analyze references of API item ${next.displayName} because it is of unsupported kind ${next.kind}`
});
maybeIncompleteResult = true;
next = toVisit.shift();
continue;
}
for (const extendsType of extendsTypes) {
// We want to find the reference token associated with the actual inherited declaration.
// In every case we support, this is the first reference token. For example:
//
// ```
// export class A extends B {}
// ^
// export class A extends B<C> {}
// ^
// export class A extends B.C {}
// ^^^
// ```
const firstReferenceToken = extendsType.excerpt.spannedTokens.find((token) => {
return token.kind === Excerpt_1.ExcerptTokenKind.Reference && token.canonicalReference;
});
if (!firstReferenceToken) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.ExtendsClauseMissingReference,
text: `Unable to analyze extends clause ${extendsType.excerpt.text} of API item ${next.displayName} because no canonical reference was found`
});
maybeIncompleteResult = true;
continue;
}
const apiModel = this.getAssociatedModel();
if (!apiModel) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.NoAssociatedApiModel,
text: `Unable to analyze references of API item ${next.displayName} because it is not associated with an ApiModel`
});
maybeIncompleteResult = true;
continue;
}
const canonicalReference = firstReferenceToken.canonicalReference;
const apiItemResult = apiModel.resolveDeclarationReference(canonicalReference, undefined);
const apiItem = apiItemResult.resolvedApiItem;
if (!apiItem) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.DeclarationResolutionFailed,
text: `Unable to resolve declaration reference within API item ${next.displayName}: ${apiItemResult.errorMessage}`
});
maybeIncompleteResult = true;
continue;
}
extendedItems.push(apiItem);
}
// For classes, this array will only have one item. For interfaces, there may be multiple items. Sort the array
// into alphabetical order before adding to our list of API items to visit. This ensures that in the case
// of multiple interface inheritance, a member inherited from multiple interfaces is attributed to the interface
// earlier in alphabetical order (as opposed to source order).
//
// For example, in the code block below, `Bar.x` is reported as the inherited item, not `Foo.x`.
//
// ```
// interface Foo {
// public x: string;
// }
//
// interface Bar {
// public x: string;
// }
//
// interface FooBar extends Foo, Bar {}
// ```
extendedItems.sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
toVisit.push(...extendedItems);
next = toVisit.shift();
}
const items = [];
for (const members of membersByName.values()) {
items.push(...members);
}
for (const members of membersByKind.values()) {
items.push(...members);
}
items.sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
return {
items,
messages,
maybeIncompleteResult
};
}
/** @internal */
_getMergedSiblingsForMember(memberApiItem) {
this._ensureMemberMaps();
let result;
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(memberApiItem)) {
result = this[_membersByName].get(memberApiItem.name);
}
else {
result = this[_membersByKind].get(memberApiItem.kind);
}
if (!result) {
throw new node_core_library_1.InternalError('Item was not found in the _membersByName/_membersByKind lookup');
}
return result;
}
/** @internal */
_ensureMemberMaps() {
// Build the _membersByName and _membersByKind tables if they don't already exist
if (this[_membersByName] === undefined) {
const membersByName = new Map();
const membersByKind = new Map();
for (const member of this[_members]) {
let map;
let key;
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
map = membersByName;
key = member.name;
}
else {
map = membersByKind;
key = member.kind;
}
let list = map.get(key);
if (list === undefined) {
list = [];
map.set(key, list);
}
list.push(member);
}
this[_membersByName] = membersByName;
this[_membersByKind] = membersByKind;
}
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
const memberObjects = [];
for (const member of this.members) {
const memberJsonObject = {};
member.serializeInto(memberJsonObject);
memberObjects.push(memberJsonObject);
}
jsonObject.preserveMemberOrder = this.preserveMemberOrder;
jsonObject.members = memberObjects;
}
}
return MixedClass;
}
exports.ApiItemContainerMixin = ApiItemContainerMixin;
/**
* Static members for {@link (ApiItemContainerMixin:interface)}.
* @public
*/
(function (ApiItemContainerMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_members);
}
ApiItemContainerMixin.isBaseClassOf = isBaseClassOf;
})(ApiItemContainerMixin = exports.ApiItemContainerMixin || (exports.ApiItemContainerMixin = {}));
//# sourceMappingURL=ApiItemContainerMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,64 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiNameMixinOptions:interface)}.
* @public
*/
export interface IApiNameMixinOptions extends IApiItemOptions {
name: string;
}
export interface IApiNameMixinJson extends IApiItemJson {
name: string;
}
/**
* The mixin base class for API items that have a name. For example, a class has a name, but a class constructor
* does not.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiNameMixin extends ApiItem {
/**
* The exported name of this API item.
*
* @remarks
* Note that due tue type aliasing, the exported name may be different from the locally declared name.
*/
readonly name: string;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiNameMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiNameMixin:interface)} functionality.
*
* @public
*/
export declare function ApiNameMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiNameMixin);
/**
* Static members for {@link (ApiNameMixin:interface)}.
* @public
*/
export declare namespace ApiNameMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiNameMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiNameMixin;
}
//# sourceMappingURL=ApiNameMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiNameMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiNameMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,IAAI,EAAE,MAAM,CAAC;CACd;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,YAAa,SAAQ,OAAO;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,UAAU,SAAS,mBAAmB,EACjE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,CAyCrD;AAED;;;GAGG;AACH,yBAAiB,YAAY,CAAC;IAC5B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,YAAY,CAEvE;CACF"}

View File

@ -0,0 +1,65 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiNameMixin = void 0;
const _name = Symbol('ApiNameMixin._name');
/**
* Mixin function for {@link (ApiNameMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiNameMixin:interface)} functionality.
*
* @public
*/
function ApiNameMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_name] = options.name;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.name = jsonObject.name;
}
get name() {
return this[_name];
}
/** @override */
get displayName() {
return this[_name];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.name = this.name;
}
}
return MixedClass;
}
exports.ApiNameMixin = ApiNameMixin;
/**
* Static members for {@link (ApiNameMixin:interface)}.
* @public
*/
(function (ApiNameMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiNameMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_name);
}
ApiNameMixin.isBaseClassOf = isBaseClassOf;
})(ApiNameMixin = exports.ApiNameMixin || (exports.ApiNameMixin = {}));
//# sourceMappingURL=ApiNameMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,69 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiOptionalMixinOptions:interface)}.
* @public
*/
export interface IApiOptionalMixinOptions extends IApiItemOptions {
isOptional: boolean;
}
export interface IApiOptionalMixinJson extends IApiItemJson {
isOptional: boolean;
}
/**
* The mixin base class for API items that can be marked as optional by appending a `?` to them.
* For example, a property of an interface can be optional.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiOptionalMixin extends ApiItem {
/**
* True if this is an optional property.
* @remarks
* For example:
* ```ts
* interface X {
* y: string; // not optional
* z?: string; // optional
* }
* ```
*/
readonly isOptional: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiOptionalMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiOptionalMixin:interface)} functionality.
*
* @public
*/
export declare function ApiOptionalMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiOptionalMixin);
/**
* Optional members for {@link (ApiOptionalMixin:interface)}.
* @public
*/
export declare namespace ApiOptionalMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiOptionalMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiOptionalMixin;
}
//# sourceMappingURL=ApiOptionalMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiOptionalMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiOptionalMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAoCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,61 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiOptionalMixin = void 0;
const _isOptional = Symbol('ApiOptionalMixin._isOptional');
/**
* Mixin function for {@link (ApiOptionalMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiOptionalMixin:interface)} functionality.
*
* @public
*/
function ApiOptionalMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isOptional] = !!options.isOptional;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isOptional = !!jsonObject.isOptional;
}
get isOptional() {
return this[_isOptional];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isOptional = this.isOptional;
}
}
return MixedClass;
}
exports.ApiOptionalMixin = ApiOptionalMixin;
/**
* Optional members for {@link (ApiOptionalMixin:interface)}.
* @public
*/
(function (ApiOptionalMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiOptionalMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isOptional);
}
ApiOptionalMixin.isBaseClassOf = isBaseClassOf;
})(ApiOptionalMixin = exports.ApiOptionalMixin || (exports.ApiOptionalMixin = {}));
//# sourceMappingURL=ApiOptionalMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,100 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import { Parameter } from '../model/Parameter';
import type { IExcerptTokenRange } from './Excerpt';
/**
* Represents parameter information that is part of {@link IApiParameterListMixinOptions}
* @public
*/
export interface IApiParameterOptions {
parameterName: string;
parameterTypeTokenRange: IExcerptTokenRange;
isOptional: boolean;
}
/**
* Constructor options for {@link (ApiParameterListMixin:interface)}.
* @public
*/
export interface IApiParameterListMixinOptions extends IApiItemOptions {
overloadIndex: number;
parameters: IApiParameterOptions[];
}
export interface IApiParameterListJson extends IApiItemJson {
overloadIndex: number;
parameters: IApiParameterOptions[];
}
/**
* The mixin base class for API items that can have function parameters (but not necessarily a return value).
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiParameterListMixin extends ApiItem {
/**
* When a function has multiple overloaded declarations, this one-based integer index can be used to uniquely
* identify them.
*
* @remarks
*
* Consider this overloaded declaration:
*
* ```ts
* export namespace Versioning {
* // TSDoc: Versioning.(addVersions:1)
* export function addVersions(x: number, y: number): number;
*
* // TSDoc: Versioning.(addVersions:2)
* export function addVersions(x: string, y: string): string;
*
* // (implementation)
* export function addVersions(x: number|string, y: number|string): number|string {
* // . . .
* }
* }
* ```
*
* In the above example, there are two overloaded declarations. The overload using numbers will have
* `overloadIndex = 1`. The overload using strings will have `overloadIndex = 2`. The third declaration that
* accepts all possible inputs is considered part of the implementation, and is not processed by API Extractor.
*/
readonly overloadIndex: number;
/**
* The function parameters.
*/
readonly parameters: ReadonlyArray<Parameter>;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.
*
* @public
*/
export declare function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiParameterListMixin);
/**
* Static members for {@link (ApiParameterListMixin:interface)}.
* @public
*/
export declare namespace ApiParameterListMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiParameterListMixin;
}
//# sourceMappingURL=ApiParameterListMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiParameterListMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiParameterListMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAIpD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,kBAAkB,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,eAAe;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,EAAE,CAAC;CACpC;AAKD;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAE9C,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,mBAAmB,EAC1E,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,qBAAqB,CAAC,CAyE9D;AAED;;;GAGG;AACH,yBAAiB,qBAAqB,CAAC;IACrC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAEhF;CACF"}

View File

@ -0,0 +1,96 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiParameterListMixin = void 0;
const Parameter_1 = require("../model/Parameter");
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const node_core_library_1 = require("@rushstack/node-core-library");
const _overloadIndex = Symbol('ApiParameterListMixin._overloadIndex');
const _parameters = Symbol('ApiParameterListMixin._parameters');
/**
* Mixin function for {@link (ApiParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.
*
* @public
*/
function ApiParameterListMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_overloadIndex] = options.overloadIndex;
this[_parameters] = [];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
if (options.parameters) {
for (const parameterOptions of options.parameters) {
const parameter = new Parameter_1.Parameter({
name: parameterOptions.parameterName,
parameterTypeExcerpt: this.buildExcerpt(parameterOptions.parameterTypeTokenRange),
// Prior to ApiJsonSchemaVersion.V_1005 this input will be undefined
isOptional: !!parameterOptions.isOptional,
parent: this
});
this[_parameters].push(parameter);
}
}
}
else {
throw new node_core_library_1.InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.overloadIndex = jsonObject.overloadIndex;
options.parameters = jsonObject.parameters || [];
}
get overloadIndex() {
return this[_overloadIndex];
}
get parameters() {
return this[_parameters];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.overloadIndex = this.overloadIndex;
const parameterObjects = [];
for (const parameter of this.parameters) {
parameterObjects.push({
parameterName: parameter.name,
parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange,
isOptional: parameter.isOptional
});
}
jsonObject.parameters = parameterObjects;
}
}
return MixedClass;
}
exports.ApiParameterListMixin = ApiParameterListMixin;
/**
* Static members for {@link (ApiParameterListMixin:interface)}.
* @public
*/
(function (ApiParameterListMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_parameters);
}
ApiParameterListMixin.isBaseClassOf = isBaseClassOf;
})(ApiParameterListMixin = exports.ApiParameterListMixin || (exports.ApiParameterListMixin = {}));
//# sourceMappingURL=ApiParameterListMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,60 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiProtectedMixinOptions:interface)}.
* @public
*/
export interface IApiProtectedMixinOptions extends IApiItemOptions {
isProtected: boolean;
}
export interface IApiProtectedMixinJson extends IApiItemJson {
isProtected: boolean;
}
/**
* The mixin base class for API items that can have the TypeScript `protected` keyword applied to them.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiProtectedMixin extends ApiItem {
/**
* Whether the declaration has the TypeScript `protected` keyword.
*/
readonly isProtected: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiProtectedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiProtectedMixin:interface)} functionality.
*
* @public
*/
export declare function ApiProtectedMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiProtectedMixin);
/**
* Static members for {@link (ApiProtectedMixin:interface)}.
* @public
*/
export declare namespace ApiProtectedMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiProtectedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiProtectedMixin;
}
//# sourceMappingURL=ApiProtectedMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiProtectedMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiProtectedMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,WAAW,EAAE,OAAO,CAAC;CACtB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,iBAAkB,SAAQ,OAAO;IAChD;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,SAAS,mBAAmB,EACtE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,iBAAiB,CAAC,CAoC1D;AAED;;;GAGG;AACH,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,iBAAiB,CAE5E;CACF"}

View File

@ -0,0 +1,61 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiProtectedMixin = void 0;
const _isProtected = Symbol('ApiProtectedMixin._isProtected');
/**
* Mixin function for {@link (ApiProtectedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiProtectedMixin:interface)} functionality.
*
* @public
*/
function ApiProtectedMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isProtected] = options.isProtected;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isProtected = jsonObject.isProtected;
}
get isProtected() {
return this[_isProtected];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isProtected = this.isProtected;
}
}
return MixedClass;
}
exports.ApiProtectedMixin = ApiProtectedMixin;
/**
* Static members for {@link (ApiProtectedMixin:interface)}.
* @public
*/
(function (ApiProtectedMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiProtectedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isProtected);
}
ApiProtectedMixin.isBaseClassOf = isBaseClassOf;
})(ApiProtectedMixin = exports.ApiProtectedMixin || (exports.ApiProtectedMixin = {}));
//# sourceMappingURL=ApiProtectedMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,82 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (ApiReadonlyMixin:interface)}.
* @public
*/
export interface IApiReadonlyMixinOptions extends IApiItemOptions {
isReadonly: boolean;
}
export interface IApiReadonlyMixinJson extends IApiItemJson {
isReadonly: boolean;
}
/**
* The mixin base class for API items that cannot be modified after instantiation.
* Examples such as the readonly modifier and only having a getter but no setter.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiReadonlyMixin extends ApiItem {
/**
* Indicates that the API item's value cannot be assigned by an external consumer.
*
* @remarks
* Examples of API items that would be considered "read only" by API Extractor:
*
* - A class or interface's property that has the `readonly` modifier.
*
* - A variable that has the `const` modifier.
*
* - A property or variable whose TSDoc comment includes the `@readonly` tag.
*
* - A property declaration with a getter but no setter.
*
* Note that if the `readonly` keyword appears in a type annotation, this does not
* guarantee that that the API item will be considered readonly. For example:
*
* ```ts
* declare class C {
* // isReadonly=false in this case, because C.x is assignable
* public x: readonly string[];
* }
* ```
*/
readonly isReadonly: boolean;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiReadonlyMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReadonlyMixin:interface)}
* functionality.
*
* @public
*/
export declare function ApiReadonlyMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiReadonlyMixin);
/**
* Static members for {@link (ApiReadonlyMixin:interface)}.
* @public
*/
export declare namespace ApiReadonlyMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReadonlyMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiReadonlyMixin;
}
//# sourceMappingURL=ApiReadonlyMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiReadonlyMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiReadonlyMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAoCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,62 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiReadonlyMixin = void 0;
const _isReadonly = Symbol('ApiReadonlyMixin._isReadonly');
/**
* Mixin function for {@link (ApiReadonlyMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReadonlyMixin:interface)}
* functionality.
*
* @public
*/
function ApiReadonlyMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isReadonly] = options.isReadonly;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isReadonly = jsonObject.isReadonly || false;
}
get isReadonly() {
return this[_isReadonly];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isReadonly = this.isReadonly;
}
}
return MixedClass;
}
exports.ApiReadonlyMixin = ApiReadonlyMixin;
/**
* Static members for {@link (ApiReadonlyMixin:interface)}.
* @public
*/
(function (ApiReadonlyMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReadonlyMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isReadonly);
}
ApiReadonlyMixin.isBaseClassOf = isBaseClassOf;
})(ApiReadonlyMixin = exports.ApiReadonlyMixin || (exports.ApiReadonlyMixin = {}));
//# sourceMappingURL=ApiReadonlyMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,66 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import { ReleaseTag } from '../aedoc/ReleaseTag';
/**
* Constructor options for {@link (ApiReleaseTagMixin:interface)}.
* @public
*/
export interface IApiReleaseTagMixinOptions extends IApiItemOptions {
releaseTag: ReleaseTag;
}
export interface IApiReleaseTagMixinJson extends IApiItemJson {
releaseTag: string;
}
/**
* The mixin base class for API items that can be attributed with a TSDoc tag such as `@internal`,
* `@alpha`, `@beta`, or `@public`. These "release tags" indicate the support level for an API.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiReleaseTagMixin extends ApiItem {
/**
* The effective release tag for this declaration. If it is not explicitly specified, the value may be
* inherited from a containing declaration.
*
* @remarks
* For example, an `ApiEnumMember` may inherit its release tag from the containing `ApiEnum`.
*/
readonly releaseTag: ReleaseTag;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiReleaseTagMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReleaseTagMixin:interface)} functionality.
*
* @public
*/
export declare function ApiReleaseTagMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiReleaseTagMixin);
/**
* Static members for {@link (ApiReleaseTagMixin:interface)}.
* @public
*/
export declare namespace ApiReleaseTagMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReleaseTagMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiReleaseTagMixin;
}
//# sourceMappingURL=ApiReleaseTagMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiReleaseTagMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiReleaseTagMixin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,UAAU,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAEhC,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,SAAS,mBAAmB,EACvE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,kBAAkB,CAAC,CA4C3D;AAED;;;GAGG;AACH,yBAAiB,kBAAkB,CAAC;IAClC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAE7E;CACF"}

View File

@ -0,0 +1,69 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiReleaseTagMixin = void 0;
/* eslint-disable @typescript-eslint/no-redeclare */
const node_core_library_1 = require("@rushstack/node-core-library");
const ReleaseTag_1 = require("../aedoc/ReleaseTag");
const _releaseTag = Symbol('ApiReleaseTagMixin._releaseTag');
/**
* Mixin function for {@link (ApiReleaseTagMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReleaseTagMixin:interface)} functionality.
*
* @public
*/
function ApiReleaseTagMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_releaseTag] = options.releaseTag;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
const deserializedReleaseTag = node_core_library_1.Enum.tryGetValueByKey(ReleaseTag_1.ReleaseTag, // eslint-disable-line
jsonObject.releaseTag);
if (deserializedReleaseTag === undefined) {
throw new Error(`Failed to deserialize release tag ${JSON.stringify(jsonObject.releaseTag)}`);
}
options.releaseTag = deserializedReleaseTag;
}
get releaseTag() {
return this[_releaseTag];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.releaseTag = ReleaseTag_1.ReleaseTag[this.releaseTag];
}
}
return MixedClass;
}
exports.ApiReleaseTagMixin = ApiReleaseTagMixin;
/**
* Static members for {@link (ApiReleaseTagMixin:interface)}.
* @public
*/
(function (ApiReleaseTagMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReleaseTagMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_releaseTag);
}
ApiReleaseTagMixin.isBaseClassOf = isBaseClassOf;
})(ApiReleaseTagMixin = exports.ApiReleaseTagMixin || (exports.ApiReleaseTagMixin = {}));
//# sourceMappingURL=ApiReleaseTagMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import type { IExcerptTokenRange, Excerpt } from './Excerpt';
/**
* Constructor options for {@link (ApiReturnTypeMixin:interface)}.
* @public
*/
export interface IApiReturnTypeMixinOptions extends IApiItemOptions {
returnTypeTokenRange: IExcerptTokenRange;
}
export interface IApiReturnTypeMixinJson extends IApiItemJson {
returnTypeTokenRange: IExcerptTokenRange;
}
/**
* The mixin base class for API items that are functions that return a value.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiReturnTypeMixin extends ApiItem {
/**
* An {@link Excerpt} that describes the type of the function's return value.
*/
readonly returnTypeExcerpt: Excerpt;
/** @override */
serializeInto(jsonObject: Partial<IApiReturnTypeMixinJson>): void;
}
/**
* Mixin function for {@link (ApiReturnTypeMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReturnTypeMixin:interface)} functionality.
*
* @public
*/
export declare function ApiReturnTypeMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiReturnTypeMixin);
/**
* Static members for {@link (ApiReturnTypeMixin:interface)}.
* @public
*/
export declare namespace ApiReturnTypeMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReturnTypeMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiReturnTypeMixin;
}
//# sourceMappingURL=ApiReturnTypeMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiReturnTypeMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiReturnTypeMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAK7D;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,oBAAoB,EAAE,kBAAkB,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,oBAAoB,EAAE,kBAAkB,CAAC;CAC1C;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD;;OAEG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAEpC,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;CACnE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,SAAS,mBAAmB,EACvE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,kBAAkB,CAAC,CAyC3D;AAED;;;GAGG;AACH,yBAAiB,kBAAkB,CAAC;IAClC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAE7E;CACF"}

View File

@ -0,0 +1,68 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiReturnTypeMixin = void 0;
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const node_core_library_1 = require("@rushstack/node-core-library");
const _returnTypeExcerpt = Symbol('ApiReturnTypeMixin._returnTypeExcerpt');
/**
* Mixin function for {@link (ApiReturnTypeMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReturnTypeMixin:interface)} functionality.
*
* @public
*/
function ApiReturnTypeMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
this[_returnTypeExcerpt] = this.buildExcerpt(options.returnTypeTokenRange);
}
else {
throw new node_core_library_1.InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.returnTypeTokenRange = jsonObject.returnTypeTokenRange;
}
get returnTypeExcerpt() {
return this[_returnTypeExcerpt];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.returnTypeTokenRange = this.returnTypeExcerpt.tokenRange;
}
}
return MixedClass;
}
exports.ApiReturnTypeMixin = ApiReturnTypeMixin;
/**
* Static members for {@link (ApiReturnTypeMixin:interface)}.
* @public
*/
(function (ApiReturnTypeMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReturnTypeMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_returnTypeExcerpt);
}
ApiReturnTypeMixin.isBaseClassOf = isBaseClassOf;
})(ApiReturnTypeMixin = exports.ApiReturnTypeMixin || (exports.ApiReturnTypeMixin = {}));
//# sourceMappingURL=ApiReturnTypeMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,60 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiStaticMixinOptions:interface)}.
* @public
*/
export interface IApiStaticMixinOptions extends IApiItemOptions {
isStatic: boolean;
}
export interface IApiStaticMixinJson extends IApiItemJson {
isStatic: boolean;
}
/**
* The mixin base class for API items that can have the TypeScript `static` keyword applied to them.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiStaticMixin extends ApiItem {
/**
* Whether the declaration has the TypeScript `static` keyword.
*/
readonly isStatic: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiStaticMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiStaticMixin:interface)} functionality.
*
* @public
*/
export declare function ApiStaticMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiStaticMixin);
/**
* Static members for {@link (ApiStaticMixin:interface)}.
* @public
*/
export declare namespace ApiStaticMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiStaticMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiStaticMixin;
}
//# sourceMappingURL=ApiStaticMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiStaticMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiStaticMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAS,mBAAmB,EACnE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,cAAc,CAAC,CAoCvD;AAED;;;GAGG;AACH,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,cAAc,CAEzE;CACF"}

View File

@ -0,0 +1,61 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiStaticMixin = void 0;
const _isStatic = Symbol('ApiStaticMixin._isStatic');
/**
* Mixin function for {@link (ApiStaticMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiStaticMixin:interface)} functionality.
*
* @public
*/
function ApiStaticMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isStatic] = options.isStatic;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isStatic = jsonObject.isStatic;
}
get isStatic() {
return this[_isStatic];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isStatic = this.isStatic;
}
}
return MixedClass;
}
exports.ApiStaticMixin = ApiStaticMixin;
/**
* Static members for {@link (ApiStaticMixin:interface)}.
* @public
*/
(function (ApiStaticMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiStaticMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isStatic);
}
ApiStaticMixin.isBaseClassOf = isBaseClassOf;
})(ApiStaticMixin = exports.ApiStaticMixin || (exports.ApiStaticMixin = {}));
//# sourceMappingURL=ApiStaticMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,71 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import type { IExcerptTokenRange } from './Excerpt';
import { TypeParameter } from '../model/TypeParameter';
/**
* Represents parameter information that is part of {@link IApiTypeParameterListMixinOptions}
* @public
*/
export interface IApiTypeParameterOptions {
typeParameterName: string;
constraintTokenRange: IExcerptTokenRange;
defaultTypeTokenRange: IExcerptTokenRange;
}
/**
* Constructor options for {@link (ApiTypeParameterListMixin:interface)}.
* @public
*/
export interface IApiTypeParameterListMixinOptions extends IApiItemOptions {
typeParameters: IApiTypeParameterOptions[];
}
export interface IApiTypeParameterListMixinJson extends IApiItemJson {
typeParameters: IApiTypeParameterOptions[];
}
/**
* The mixin base class for API items that can have type parameters.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiTypeParameterListMixin extends ApiItem {
/**
* The type parameters.
*/
readonly typeParameters: ReadonlyArray<TypeParameter>;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiTypeParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiTypeParameterListMixin:interface)}
* functionality.
*
* @public
*/
export declare function ApiTypeParameterListMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiTypeParameterListMixin);
/**
* Static members for {@link (ApiTypeParameterListMixin:interface)}.
* @public
*/
export declare namespace ApiTypeParameterListMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiTypeParameterListMixin;
}
//# sourceMappingURL=ApiTypeParameterListMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiTypeParameterListMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiTypeParameterListMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,kBAAkB,CAAC;IACzC,qBAAqB,EAAE,kBAAkB,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,WAAW,iCAAkC,SAAQ,eAAe;IACxE,cAAc,EAAE,wBAAwB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,8BAA+B,SAAQ,YAAY;IAClE,cAAc,EAAE,wBAAwB,EAAE,CAAC;CAC5C;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,yBAA0B,SAAQ,OAAO;IACxD;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAEtD,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,SAAS,mBAAmB,EAC9E,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,yBAAyB,CAAC,CAqElE;AAED;;;GAGG;AACH,yBAAiB,yBAAyB,CAAC;IACzC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,yBAAyB,CAEpF;CACF"}

View File

@ -0,0 +1,93 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiTypeParameterListMixin = void 0;
const TypeParameter_1 = require("../model/TypeParameter");
const node_core_library_1 = require("@rushstack/node-core-library");
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const _typeParameters = Symbol('ApiTypeParameterListMixin._typeParameters');
/**
* Mixin function for {@link (ApiTypeParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiTypeParameterListMixin:interface)}
* functionality.
*
* @public
*/
function ApiTypeParameterListMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_typeParameters] = [];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
if (options.typeParameters) {
for (const typeParameterOptions of options.typeParameters) {
const defaultTypeExcerpt = this.buildExcerpt(typeParameterOptions.defaultTypeTokenRange);
const typeParameter = new TypeParameter_1.TypeParameter({
name: typeParameterOptions.typeParameterName,
constraintExcerpt: this.buildExcerpt(typeParameterOptions.constraintTokenRange),
defaultTypeExcerpt,
isOptional: !defaultTypeExcerpt.isEmpty,
parent: this
});
this[_typeParameters].push(typeParameter);
}
}
}
else {
throw new node_core_library_1.InternalError('ApiTypeParameterListMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.typeParameters = jsonObject.typeParameters || [];
}
get typeParameters() {
return this[_typeParameters];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
const typeParameterObjects = [];
for (const typeParameter of this.typeParameters) {
typeParameterObjects.push({
typeParameterName: typeParameter.name,
constraintTokenRange: typeParameter.constraintExcerpt.tokenRange,
defaultTypeTokenRange: typeParameter.defaultTypeExcerpt.tokenRange
});
}
if (typeParameterObjects.length > 0) {
jsonObject.typeParameters = typeParameterObjects;
}
}
}
return MixedClass;
}
exports.ApiTypeParameterListMixin = ApiTypeParameterListMixin;
/**
* Static members for {@link (ApiTypeParameterListMixin:interface)}.
* @public
*/
(function (ApiTypeParameterListMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_typeParameters);
}
ApiTypeParameterListMixin.isBaseClassOf = isBaseClassOf;
})(ApiTypeParameterListMixin = exports.ApiTypeParameterListMixin || (exports.ApiTypeParameterListMixin = {}));
//# sourceMappingURL=ApiTypeParameterListMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,113 @@
import type { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
/** @public */
export declare enum ExcerptTokenKind {
/**
* Generic text without any special properties
*/
Content = "Content",
/**
* A reference to an API declaration
*/
Reference = "Reference"
}
/**
* Used by {@link Excerpt} to indicate a range of indexes within an array of `ExcerptToken` objects.
*
* @public
*/
export interface IExcerptTokenRange {
/**
* The starting index of the span.
*/
startIndex: number;
/**
* The index of the last member of the span, plus one.
*
* @remarks
*
* If `startIndex` and `endIndex` are the same number, then the span is empty.
*/
endIndex: number;
}
/** @public */
export interface IExcerptToken {
readonly kind: ExcerptTokenKind;
text: string;
canonicalReference?: string;
}
/**
* Represents a fragment of text belonging to an {@link Excerpt} object.
*
* @public
*/
export declare class ExcerptToken {
private readonly _kind;
private readonly _text;
private readonly _canonicalReference;
constructor(kind: ExcerptTokenKind, text: string, canonicalReference?: DeclarationReference);
/**
* Indicates the kind of token.
*/
get kind(): ExcerptTokenKind;
/**
* The text fragment.
*/
get text(): string;
/**
* The hyperlink target for a token whose type is `ExcerptTokenKind.Reference`. For other token types,
* this property will be `undefined`.
*/
get canonicalReference(): DeclarationReference | undefined;
}
/**
* The `Excerpt` class is used by {@link ApiDeclaredItem} to represent a TypeScript code fragment that may be
* annotated with hyperlinks to declared types (and in the future, source code locations).
*
* @remarks
* API Extractor's .api.json file format stores excerpts compactly as a start/end indexes into an array of tokens.
* Every `ApiDeclaredItem` has a "main excerpt" corresponding to the full list of tokens. The declaration may
* also have have "captured" excerpts that correspond to subranges of tokens.
*
* For example, if the main excerpt is:
*
* ```
* function parse(s: string): Vector | undefined;
* ```
*
* ...then this entire signature is the "main excerpt", whereas the function's return type `Vector | undefined` is a
* captured excerpt. The `Vector` token might be a hyperlink to that API item.
*
* An excerpt may be empty (i.e. a token range containing zero tokens). For example, if a function's return value
* is not explicitly declared, then the returnTypeExcerpt will be empty. By contrast, a class constructor cannot
* have a return value, so ApiConstructor has no returnTypeExcerpt property at all.
*
* @public
*/
export declare class Excerpt {
/**
* The complete list of tokens for the source code fragment that this excerpt is based upon.
* If this object is the main excerpt, then it will span all of the tokens; otherwise, it will correspond to
* a range within the array.
*/
readonly tokens: ReadonlyArray<ExcerptToken>;
/**
* Specifies the excerpt's range within the `tokens` array.
*/
readonly tokenRange: Readonly<IExcerptTokenRange>;
/**
* The tokens spanned by this excerpt. It is the range of the `tokens` array as specified by the `tokenRange`
* property.
*/
readonly spannedTokens: ReadonlyArray<ExcerptToken>;
private _text;
constructor(tokens: ReadonlyArray<ExcerptToken>, tokenRange: IExcerptTokenRange);
/**
* The excerpted text, formed by concatenating the text of the `spannedTokens` strings.
*/
get text(): string;
/**
* Returns true if the excerpt is an empty range.
*/
get isEmpty(): boolean;
}
//# sourceMappingURL=Excerpt.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Excerpt.d.ts","sourceRoot":"","sources":["../../src/mixins/Excerpt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAGpG,cAAc;AACd,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,SAAS,cAAc;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,cAAc;AACd,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAmC;gBAEpD,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,oBAAoB;IAUlG;;OAEG;IACH,IAAW,IAAI,IAAI,gBAAgB,CAElC;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;OAGG;IACH,IAAW,kBAAkB,IAAI,oBAAoB,GAAG,SAAS,CAEhE;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,OAAO;IAClB;;;;OAIG;IACH,SAAgB,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAEpD;;OAEG;IACH,SAAgB,UAAU,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEzD;;;OAGG;IACH,SAAgB,aAAa,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAE3D,OAAO,CAAC,KAAK,CAAqB;gBAEf,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,kBAAkB;IAetF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAKxB;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;CACF"}

View File

@ -0,0 +1,106 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Excerpt = exports.ExcerptToken = exports.ExcerptTokenKind = void 0;
const node_core_library_1 = require("@rushstack/node-core-library");
/** @public */
var ExcerptTokenKind;
(function (ExcerptTokenKind) {
/**
* Generic text without any special properties
*/
ExcerptTokenKind["Content"] = "Content";
/**
* A reference to an API declaration
*/
ExcerptTokenKind["Reference"] = "Reference";
})(ExcerptTokenKind = exports.ExcerptTokenKind || (exports.ExcerptTokenKind = {}));
/**
* Represents a fragment of text belonging to an {@link Excerpt} object.
*
* @public
*/
class ExcerptToken {
constructor(kind, text, canonicalReference) {
this._kind = kind;
// Standardize the newlines across operating systems. Even though this may deviate from the actual
// input source file that was parsed, it's useful because the newline gets serialized inside
// a string literal in .api.json, which cannot be automatically normalized by Git.
this._text = node_core_library_1.Text.convertToLf(text);
this._canonicalReference = canonicalReference;
}
/**
* Indicates the kind of token.
*/
get kind() {
return this._kind;
}
/**
* The text fragment.
*/
get text() {
return this._text;
}
/**
* The hyperlink target for a token whose type is `ExcerptTokenKind.Reference`. For other token types,
* this property will be `undefined`.
*/
get canonicalReference() {
return this._canonicalReference;
}
}
exports.ExcerptToken = ExcerptToken;
/**
* The `Excerpt` class is used by {@link ApiDeclaredItem} to represent a TypeScript code fragment that may be
* annotated with hyperlinks to declared types (and in the future, source code locations).
*
* @remarks
* API Extractor's .api.json file format stores excerpts compactly as a start/end indexes into an array of tokens.
* Every `ApiDeclaredItem` has a "main excerpt" corresponding to the full list of tokens. The declaration may
* also have have "captured" excerpts that correspond to subranges of tokens.
*
* For example, if the main excerpt is:
*
* ```
* function parse(s: string): Vector | undefined;
* ```
*
* ...then this entire signature is the "main excerpt", whereas the function's return type `Vector | undefined` is a
* captured excerpt. The `Vector` token might be a hyperlink to that API item.
*
* An excerpt may be empty (i.e. a token range containing zero tokens). For example, if a function's return value
* is not explicitly declared, then the returnTypeExcerpt will be empty. By contrast, a class constructor cannot
* have a return value, so ApiConstructor has no returnTypeExcerpt property at all.
*
* @public
*/
class Excerpt {
constructor(tokens, tokenRange) {
this.tokens = tokens;
this.tokenRange = tokenRange;
if (this.tokenRange.startIndex < 0 ||
this.tokenRange.endIndex > this.tokens.length ||
this.tokenRange.startIndex > this.tokenRange.endIndex) {
throw new Error('Invalid token range');
}
this.spannedTokens = this.tokens.slice(this.tokenRange.startIndex, this.tokenRange.endIndex);
}
/**
* The excerpted text, formed by concatenating the text of the `spannedTokens` strings.
*/
get text() {
if (this._text === undefined) {
this._text = this.spannedTokens.map((x) => x.text).join('');
}
return this._text;
}
/**
* Returns true if the excerpt is an empty range.
*/
get isEmpty() {
return this.tokenRange.startIndex === this.tokenRange.endIndex;
}
}
exports.Excerpt = Excerpt;
//# sourceMappingURL=Excerpt.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,58 @@
import type { ApiItem } from '../items/ApiItem';
/**
* Generic result object for finding API items used by different kinds of find operations.
* @public
*/
export interface IFindApiItemsResult {
/**
* The API items that were found. Not guaranteed to be complete, see `maybeIncompleteResult`.
*/
items: ApiItem[];
/**
* Diagnostic messages regarding the find operation.
*/
messages: IFindApiItemsMessage[];
/**
* Indicates whether the result is potentially incomplete due to errors during the find operation.
* If true, the `messages` explain the errors in more detail.
*/
maybeIncompleteResult: boolean;
}
/**
* This object is used for messages returned as part of `IFindApiItemsResult`.
* @public
*/
export interface IFindApiItemsMessage {
/**
* Unique identifier for the message.
* @beta
*/
messageId: FindApiItemsMessageId;
/**
* Text description of the message.
*/
text: string;
}
/**
* Unique identifiers for messages returned as part of `IFindApiItemsResult`.
* @public
*/
export declare enum FindApiItemsMessageId {
/**
* "Unable to resolve declaration reference within API item ___: ___"
*/
DeclarationResolutionFailed = "declaration-resolution-failed",
/**
* "Unable to analyze extends clause ___ of API item ___ because no canonical reference was found."
*/
ExtendsClauseMissingReference = "extends-clause-missing-reference",
/**
* "Unable to analyze references of API item ___ because it is not associated with an ApiModel"
*/
NoAssociatedApiModel = "no-associated-api-model",
/**
* "Unable to analyze references of API item ___ because it is of unsupported kind ___"
*/
UnsupportedKind = "unsupported-kind"
}
//# sourceMappingURL=IFindApiItemsResult.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"IFindApiItemsResult.d.ts","sourceRoot":"","sources":["../../src/mixins/IFindApiItemsResult.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,OAAO,EAAE,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IAEjC;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,SAAS,EAAE,qBAAqB,CAAC;IAEjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B;;OAEG;IACH,2BAA2B,kCAAkC;IAE7D;;OAEG;IACH,6BAA6B,qCAAqC;IAElE;;OAEG;IACH,oBAAoB,4BAA4B;IAEhD;;OAEG;IACH,eAAe,qBAAqB;CACrC"}

View File

@ -0,0 +1,29 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.FindApiItemsMessageId = void 0;
/**
* Unique identifiers for messages returned as part of `IFindApiItemsResult`.
* @public
*/
var FindApiItemsMessageId;
(function (FindApiItemsMessageId) {
/**
* "Unable to resolve declaration reference within API item ___: ___"
*/
FindApiItemsMessageId["DeclarationResolutionFailed"] = "declaration-resolution-failed";
/**
* "Unable to analyze extends clause ___ of API item ___ because no canonical reference was found."
*/
FindApiItemsMessageId["ExtendsClauseMissingReference"] = "extends-clause-missing-reference";
/**
* "Unable to analyze references of API item ___ because it is not associated with an ApiModel"
*/
FindApiItemsMessageId["NoAssociatedApiModel"] = "no-associated-api-model";
/**
* "Unable to analyze references of API item ___ because it is of unsupported kind ___"
*/
FindApiItemsMessageId["UnsupportedKind"] = "unsupported-kind";
})(FindApiItemsMessageId = exports.FindApiItemsMessageId || (exports.FindApiItemsMessageId = {}));
//# sourceMappingURL=IFindApiItemsResult.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"IFindApiItemsResult.js","sourceRoot":"","sources":["../../src/mixins/IFindApiItemsResult.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AA2C3D;;;GAGG;AACH,IAAY,qBAoBX;AApBD,WAAY,qBAAqB;IAC/B;;OAEG;IACH,sFAA6D,CAAA;IAE7D;;OAEG;IACH,2FAAkE,CAAA;IAElE;;OAEG;IACH,yEAAgD,CAAA;IAEhD;;OAEG;IACH,6DAAoC,CAAA;AACtC,CAAC,EApBW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAoBhC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { ApiItem } from '../items/ApiItem';\n\n/**\n * Generic result object for finding API items used by different kinds of find operations.\n * @public\n */\nexport interface IFindApiItemsResult {\n /**\n * The API items that were found. Not guaranteed to be complete, see `maybeIncompleteResult`.\n */\n items: ApiItem[];\n\n /**\n * Diagnostic messages regarding the find operation.\n */\n messages: IFindApiItemsMessage[];\n\n /**\n * Indicates whether the result is potentially incomplete due to errors during the find operation.\n * If true, the `messages` explain the errors in more detail.\n */\n maybeIncompleteResult: boolean;\n}\n\n/**\n * This object is used for messages returned as part of `IFindApiItemsResult`.\n * @public\n */\nexport interface IFindApiItemsMessage {\n /**\n * Unique identifier for the message.\n * @beta\n */\n messageId: FindApiItemsMessageId;\n\n /**\n * Text description of the message.\n */\n text: string;\n}\n\n/**\n * Unique identifiers for messages returned as part of `IFindApiItemsResult`.\n * @public\n */\nexport enum FindApiItemsMessageId {\n /**\n * \"Unable to resolve declaration reference within API item ___: ___\"\n */\n DeclarationResolutionFailed = 'declaration-resolution-failed',\n\n /**\n * \"Unable to analyze extends clause ___ of API item ___ because no canonical reference was found.\"\n */\n ExtendsClauseMissingReference = 'extends-clause-missing-reference',\n\n /**\n * \"Unable to analyze references of API item ___ because it is not associated with an ApiModel\"\n */\n NoAssociatedApiModel = 'no-associated-api-model',\n\n /**\n * \"Unable to analyze references of API item ___ because it is of unsupported kind ___\"\n */\n UnsupportedKind = 'unsupported-kind'\n}\n"]}

View File

@ -0,0 +1,16 @@
/**
* This abstraction is used by the mixin pattern.
* It describes a class constructor.
* @public
*/
export type Constructor<T = {}> = new (...args: any[]) => T;
/**
* This abstraction is used by the mixin pattern.
* It describes the "static side" of a class.
*
* @public
*/
export type PropertiesOf<T> = {
[K in keyof T]: T[K];
};
//# sourceMappingURL=Mixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/Mixin.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}

View File

@ -0,0 +1,5 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Mixin.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Mixin.js","sourceRoot":"","sources":["../../src/mixins/Mixin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * This abstraction is used by the mixin pattern.\n * It describes a class constructor.\n * @public\n */\nexport type Constructor<T = {}> = new (...args: any[]) => T; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n/**\n * This abstraction is used by the mixin pattern.\n * It describes the \"static side\" of a class.\n *\n * @public\n */\nexport type PropertiesOf<T> = { [K in keyof T]: T[K] };\n"]}

View File

@ -0,0 +1,55 @@
import { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
import { ApiItemKind } from '../items/ApiItem';
import { type IApiDeclaredItemOptions, ApiDeclaredItem } from '../items/ApiDeclaredItem';
import { type IApiParameterListMixinOptions, ApiParameterListMixin } from '../mixins/ApiParameterListMixin';
import { type IApiReleaseTagMixinOptions, ApiReleaseTagMixin } from '../mixins/ApiReleaseTagMixin';
import { type IApiReturnTypeMixinOptions, ApiReturnTypeMixin } from '../mixins/ApiReturnTypeMixin';
import { type IApiTypeParameterListMixinOptions, ApiTypeParameterListMixin } from '../mixins/ApiTypeParameterListMixin';
/**
* Constructor options for {@link ApiCallSignature}.
* @public
*/
export interface IApiCallSignatureOptions extends IApiTypeParameterListMixinOptions, IApiParameterListMixinOptions, IApiReleaseTagMixinOptions, IApiReturnTypeMixinOptions, IApiDeclaredItemOptions {
}
declare const ApiCallSignature_base: typeof ApiDeclaredItem & (new (...args: any[]) => ApiReturnTypeMixin) & (new (...args: any[]) => ApiReleaseTagMixin) & (new (...args: any[]) => ApiParameterListMixin) & (new (...args: any[]) => ApiTypeParameterListMixin);
/**
* Represents a TypeScript function call signature.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* `ApiCallSignature` represents a TypeScript declaration such as `(x: number, y: number): number`
* in this example:
*
* ```ts
* export interface IChooser {
* // A call signature:
* (x: number, y: number): number;
*
* // Another overload for this call signature:
* (x: string, y: string): string;
* }
*
* function chooseFirst<T>(x: T, y: T): T {
* return x;
* }
*
* let chooser: IChooser = chooseFirst;
* ```
*
* @public
*/
export declare class ApiCallSignature extends ApiCallSignature_base {
constructor(options: IApiCallSignatureOptions);
static getContainerKey(overloadIndex: number): string;
/** @override */
get kind(): ApiItemKind;
/** @override */
get containerKey(): string;
/** @beta @override */
buildCanonicalReference(): DeclarationReference;
}
export {};
//# sourceMappingURL=ApiCallSignature.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiCallSignature.d.ts","sourceRoot":"","sources":["../../src/model/ApiCallSignature.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EAGrB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,uBAAuB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,KAAK,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC5G,OAAO,EAAE,KAAK,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAAE,KAAK,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,EACL,KAAK,iCAAiC,EACtC,yBAAyB,EAC1B,MAAM,qCAAqC,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,wBACf,SAAQ,iCAAiC,EACvC,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB;CAAG;;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,gBAAiB,SAAQ,qBAErC;gBACoB,OAAO,EAAE,wBAAwB;WAItC,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IAI5D,gBAAgB;IAChB,IAAW,IAAI,IAAI,WAAW,CAE7B;IAED,gBAAgB;IAChB,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED,sBAAsB;IACf,uBAAuB,IAAI,oBAAoB;CAOvD"}

View File

@ -0,0 +1,67 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiCallSignature = void 0;
const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
const ApiItem_1 = require("../items/ApiItem");
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const ApiParameterListMixin_1 = require("../mixins/ApiParameterListMixin");
const ApiReleaseTagMixin_1 = require("../mixins/ApiReleaseTagMixin");
const ApiReturnTypeMixin_1 = require("../mixins/ApiReturnTypeMixin");
const ApiTypeParameterListMixin_1 = require("../mixins/ApiTypeParameterListMixin");
/**
* Represents a TypeScript function call signature.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* `ApiCallSignature` represents a TypeScript declaration such as `(x: number, y: number): number`
* in this example:
*
* ```ts
* export interface IChooser {
* // A call signature:
* (x: number, y: number): number;
*
* // Another overload for this call signature:
* (x: string, y: string): string;
* }
*
* function chooseFirst<T>(x: T, y: T): T {
* return x;
* }
*
* let chooser: IChooser = chooseFirst;
* ```
*
* @public
*/
class ApiCallSignature extends (0, ApiTypeParameterListMixin_1.ApiTypeParameterListMixin)((0, ApiParameterListMixin_1.ApiParameterListMixin)((0, ApiReleaseTagMixin_1.ApiReleaseTagMixin)((0, ApiReturnTypeMixin_1.ApiReturnTypeMixin)(ApiDeclaredItem_1.ApiDeclaredItem)))) {
constructor(options) {
super(options);
}
static getContainerKey(overloadIndex) {
return `|${ApiItem_1.ApiItemKind.CallSignature}|${overloadIndex}`;
}
/** @override */
get kind() {
return ApiItem_1.ApiItemKind.CallSignature;
}
/** @override */
get containerKey() {
return ApiCallSignature.getContainerKey(this.overloadIndex);
}
/** @beta @override */
buildCanonicalReference() {
const parent = this.parent
? this.parent.canonicalReference
: // .withMeaning() requires some kind of component
DeclarationReference_1.DeclarationReference.empty().addNavigationStep("#" /* Navigation.Members */, '(parent)');
return parent.withMeaning("call" /* Meaning.CallSignature */).withOverloadIndex(this.overloadIndex);
}
}
exports.ApiCallSignature = ApiCallSignature;
//# sourceMappingURL=ApiCallSignature.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiCallSignature.js","sourceRoot":"","sources":["../../src/model/ApiCallSignature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAIiE;AACjE,8CAA+C;AAC/C,8DAAyF;AACzF,2EAA4G;AAC5G,qEAAmG;AACnG,qEAAmG;AACnG,mFAG6C;AAa7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,gBAAiB,SAAQ,IAAA,qDAAyB,EAC7D,IAAA,6CAAqB,EAAC,IAAA,uCAAkB,EAAC,IAAA,uCAAkB,EAAC,iCAAe,CAAC,CAAC,CAAC,CAC/E;IACC,YAAmB,OAAiC;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,aAAqB;QACjD,OAAO,IAAI,qBAAW,CAAC,aAAa,IAAI,aAAa,EAAE,CAAC;IAC1D,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,OAAO,qBAAW,CAAC,aAAa,CAAC;IACnC,CAAC;IAED,gBAAgB;IAChB,IAAW,YAAY;QACrB,OAAO,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9D,CAAC;IAED,sBAAsB;IACf,uBAAuB;QAC5B,MAAM,MAAM,GAAyB,IAAI,CAAC,MAAM;YAC9C,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB;YAChC,CAAC,CAAC,iDAAiD;gBACjD,2CAAoB,CAAC,KAAK,EAAE,CAAC,iBAAiB,+BAAqB,UAAU,CAAC,CAAC;QACnF,OAAO,MAAM,CAAC,WAAW,oCAAuB,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACzF,CAAC;CACF;AA7BD,4CA6BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport {\n DeclarationReference,\n Meaning,\n Navigation\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport { ApiItemKind } from '../items/ApiItem';\nimport { type IApiDeclaredItemOptions, ApiDeclaredItem } from '../items/ApiDeclaredItem';\nimport { type IApiParameterListMixinOptions, ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\nimport { type IApiReleaseTagMixinOptions, ApiReleaseTagMixin } from '../mixins/ApiReleaseTagMixin';\nimport { type IApiReturnTypeMixinOptions, ApiReturnTypeMixin } from '../mixins/ApiReturnTypeMixin';\nimport {\n type IApiTypeParameterListMixinOptions,\n ApiTypeParameterListMixin\n} from '../mixins/ApiTypeParameterListMixin';\n\n/**\n * Constructor options for {@link ApiCallSignature}.\n * @public\n */\nexport interface IApiCallSignatureOptions\n extends IApiTypeParameterListMixinOptions,\n IApiParameterListMixinOptions,\n IApiReleaseTagMixinOptions,\n IApiReturnTypeMixinOptions,\n IApiDeclaredItemOptions {}\n\n/**\n * Represents a TypeScript function call signature.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations.\n *\n * `ApiCallSignature` represents a TypeScript declaration such as `(x: number, y: number): number`\n * in this example:\n *\n * ```ts\n * export interface IChooser {\n * // A call signature:\n * (x: number, y: number): number;\n *\n * // Another overload for this call signature:\n * (x: string, y: string): string;\n * }\n *\n * function chooseFirst<T>(x: T, y: T): T {\n * return x;\n * }\n *\n * let chooser: IChooser = chooseFirst;\n * ```\n *\n * @public\n */\nexport class ApiCallSignature extends ApiTypeParameterListMixin(\n ApiParameterListMixin(ApiReleaseTagMixin(ApiReturnTypeMixin(ApiDeclaredItem)))\n) {\n public constructor(options: IApiCallSignatureOptions) {\n super(options);\n }\n\n public static getContainerKey(overloadIndex: number): string {\n return `|${ApiItemKind.CallSignature}|${overloadIndex}`;\n }\n\n /** @override */\n public get kind(): ApiItemKind {\n return ApiItemKind.CallSignature;\n }\n\n /** @override */\n public get containerKey(): string {\n return ApiCallSignature.getContainerKey(this.overloadIndex);\n }\n\n /** @beta @override */\n public buildCanonicalReference(): DeclarationReference {\n const parent: DeclarationReference = this.parent\n ? this.parent.canonicalReference\n : // .withMeaning() requires some kind of component\n DeclarationReference.empty().addNavigationStep(Navigation.Members, '(parent)');\n return parent.withMeaning(Meaning.CallSignature).withOverloadIndex(this.overloadIndex);\n }\n}\n"]}

View File

@ -0,0 +1,66 @@
import { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
import { ApiItemKind } from '../items/ApiItem';
import { ApiDeclaredItem, type IApiDeclaredItemOptions, type IApiDeclaredItemJson } from '../items/ApiDeclaredItem';
import { ApiItemContainerMixin, type IApiItemContainerMixinOptions } from '../mixins/ApiItemContainerMixin';
import { ApiReleaseTagMixin, type IApiReleaseTagMixinOptions } from '../mixins/ApiReleaseTagMixin';
import type { IExcerptTokenRange } from '../mixins/Excerpt';
import { HeritageType } from './HeritageType';
import { type IApiNameMixinOptions, ApiNameMixin } from '../mixins/ApiNameMixin';
import { ApiTypeParameterListMixin, type IApiTypeParameterListMixinOptions, type IApiTypeParameterListMixinJson } from '../mixins/ApiTypeParameterListMixin';
import type { DeserializerContext } from './DeserializerContext';
import { type IApiExportedMixinJson, type IApiExportedMixinOptions, ApiExportedMixin } from '../mixins/ApiExportedMixin';
import { ApiAbstractMixin, type IApiAbstractMixinJson, type IApiAbstractMixinOptions } from '../mixins/ApiAbstractMixin';
/**
* Constructor options for {@link ApiClass}.
* @public
*/
export interface IApiClassOptions extends IApiItemContainerMixinOptions, IApiNameMixinOptions, IApiAbstractMixinOptions, IApiReleaseTagMixinOptions, IApiDeclaredItemOptions, IApiTypeParameterListMixinOptions, IApiExportedMixinOptions {
extendsTokenRange: IExcerptTokenRange | undefined;
implementsTokenRanges: IExcerptTokenRange[];
}
export interface IApiClassJson extends IApiDeclaredItemJson, IApiAbstractMixinJson, IApiTypeParameterListMixinJson, IApiExportedMixinJson {
extendsTokenRange?: IExcerptTokenRange;
implementsTokenRanges: IExcerptTokenRange[];
}
declare const ApiClass_base: typeof ApiDeclaredItem & (new (...args: any[]) => ApiExportedMixin) & (new (...args: any[]) => ApiReleaseTagMixin) & (new (...args: any[]) => ApiTypeParameterListMixin) & (new (...args: any[]) => ApiAbstractMixin) & (new (...args: any[]) => ApiNameMixin) & (new (...args: any[]) => ApiItemContainerMixin);
/**
* Represents a TypeScript class declaration.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* `ApiClass` represents a TypeScript declaration such as this:
*
* ```ts
* export class X { }
* ```
*
* @public
*/
export declare class ApiClass extends ApiClass_base {
/**
* The base class that this class inherits from (using the `extends` keyword), or undefined if there is no base class.
*/
readonly extendsType: HeritageType | undefined;
private readonly _implementsTypes;
constructor(options: IApiClassOptions);
static getContainerKey(name: string): string;
/** @override */
static onDeserializeInto(options: Partial<IApiClassOptions>, context: DeserializerContext, jsonObject: IApiClassJson): void;
/** @override */
get kind(): ApiItemKind;
/** @override */
get containerKey(): string;
/**
* The list of interfaces that this class implements using the `implements` keyword.
*/
get implementsTypes(): ReadonlyArray<HeritageType>;
/** @override */
serializeInto(jsonObject: Partial<IApiClassJson>): void;
/** @beta @override */
buildCanonicalReference(): DeclarationReference;
}
export {};
//# sourceMappingURL=ApiClass.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiClass.d.ts","sourceRoot":"","sources":["../../src/model/ApiClass.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EAIrB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,KAAK,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC5G,OAAO,EAAE,kBAAkB,EAAE,KAAK,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,oBAAoB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EACL,yBAAyB,EACzB,KAAK,iCAAiC,EACtC,KAAK,8BAA8B,EACpC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC9B,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,gBACf,SAAQ,6BAA6B,EACnC,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,iCAAiC,EACjC,wBAAwB;IAC1B,iBAAiB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAClD,qBAAqB,EAAE,kBAAkB,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,aACf,SAAQ,oBAAoB,EAC1B,qBAAqB,EACrB,8BAA8B,EAC9B,qBAAqB;IACvB,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IACvC,qBAAqB,EAAE,kBAAkB,EAAE,CAAC;CAC7C;;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAS,SAAQ,aAI7B;IACC;;OAEG;IACH,SAAgB,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IAEtD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsB;gBAEpC,OAAO,EAAE,gBAAgB;WAc9B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAInD,gBAAgB;WACF,iBAAiB,CAC7B,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAClC,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,aAAa,GACxB,IAAI;IAOP,gBAAgB;IAChB,IAAW,IAAI,IAAI,WAAW,CAE7B;IAED,gBAAgB;IAChB,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED;;OAEG;IACH,IAAW,eAAe,IAAI,aAAa,CAAC,YAAY,CAAC,CAExD;IAED,gBAAgB;IACT,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI;IAW9D,sBAAsB;IACf,uBAAuB,IAAI,oBAAoB;CAOvD"}

View File

@ -0,0 +1,88 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiClass = void 0;
const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
const ApiItem_1 = require("../items/ApiItem");
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const ApiItemContainerMixin_1 = require("../mixins/ApiItemContainerMixin");
const ApiReleaseTagMixin_1 = require("../mixins/ApiReleaseTagMixin");
const HeritageType_1 = require("./HeritageType");
const ApiNameMixin_1 = require("../mixins/ApiNameMixin");
const ApiTypeParameterListMixin_1 = require("../mixins/ApiTypeParameterListMixin");
const ApiExportedMixin_1 = require("../mixins/ApiExportedMixin");
const ApiAbstractMixin_1 = require("../mixins/ApiAbstractMixin");
/**
* Represents a TypeScript class declaration.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* `ApiClass` represents a TypeScript declaration such as this:
*
* ```ts
* export class X { }
* ```
*
* @public
*/
class ApiClass extends (0, ApiItemContainerMixin_1.ApiItemContainerMixin)((0, ApiNameMixin_1.ApiNameMixin)((0, ApiAbstractMixin_1.ApiAbstractMixin)((0, ApiTypeParameterListMixin_1.ApiTypeParameterListMixin)((0, ApiReleaseTagMixin_1.ApiReleaseTagMixin)((0, ApiExportedMixin_1.ApiExportedMixin)(ApiDeclaredItem_1.ApiDeclaredItem)))))) {
constructor(options) {
super(options);
this._implementsTypes = [];
if (options.extendsTokenRange) {
this.extendsType = new HeritageType_1.HeritageType(this.buildExcerpt(options.extendsTokenRange));
}
else {
this.extendsType = undefined;
}
for (const implementsTokenRange of options.implementsTokenRanges) {
this._implementsTypes.push(new HeritageType_1.HeritageType(this.buildExcerpt(implementsTokenRange)));
}
}
static getContainerKey(name) {
return `${name}|${ApiItem_1.ApiItemKind.Class}`;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
super.onDeserializeInto(options, context, jsonObject);
options.extendsTokenRange = jsonObject.extendsTokenRange;
options.implementsTokenRanges = jsonObject.implementsTokenRanges;
}
/** @override */
get kind() {
return ApiItem_1.ApiItemKind.Class;
}
/** @override */
get containerKey() {
return ApiClass.getContainerKey(this.name);
}
/**
* The list of interfaces that this class implements using the `implements` keyword.
*/
get implementsTypes() {
return this._implementsTypes;
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
// Note that JSON does not support the "undefined" value, so we simply omit the field entirely if it is undefined
if (this.extendsType) {
jsonObject.extendsTokenRange = this.extendsType.excerpt.tokenRange;
}
jsonObject.implementsTokenRanges = this.implementsTypes.map((x) => x.excerpt.tokenRange);
}
/** @beta @override */
buildCanonicalReference() {
const nameComponent = DeclarationReference_1.DeclarationReference.parseComponent(this.name);
const navigation = this.isExported ? "." /* Navigation.Exports */ : "~" /* Navigation.Locals */;
return (this.parent ? this.parent.canonicalReference : DeclarationReference_1.DeclarationReference.empty())
.addNavigationStep(navigation, nameComponent)
.withMeaning("class" /* Meaning.Class */);
}
}
exports.ApiClass = ApiClass;
//# sourceMappingURL=ApiClass.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More