@microsoft/api-extractor-model 7.32.1 → 7.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +29 -0
- package/CHANGELOG.md +13 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-esm/aedoc/AedocDefinitions.js +57 -0
- package/lib-esm/aedoc/AedocDefinitions.js.map +1 -0
- package/lib-esm/aedoc/ReleaseTag.js +87 -0
- package/lib-esm/aedoc/ReleaseTag.js.map +1 -0
- package/lib-esm/index.js +58 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/items/ApiDeclaredItem.js +137 -0
- package/lib-esm/items/ApiDeclaredItem.js.map +1 -0
- package/lib-esm/items/ApiDocumentedItem.js +48 -0
- package/lib-esm/items/ApiDocumentedItem.js.map +1 -0
- package/lib-esm/items/ApiItem.js +270 -0
- package/lib-esm/items/ApiItem.js.map +1 -0
- package/lib-esm/items/ApiPropertyItem.js +45 -0
- package/lib-esm/items/ApiPropertyItem.js.map +1 -0
- package/lib-esm/mixins/ApiAbstractMixin.js +58 -0
- package/lib-esm/mixins/ApiAbstractMixin.js.map +1 -0
- package/lib-esm/mixins/ApiExportedMixin.js +63 -0
- package/lib-esm/mixins/ApiExportedMixin.js.map +1 -0
- package/lib-esm/mixins/ApiInitializerMixin.js +70 -0
- package/lib-esm/mixins/ApiInitializerMixin.js.map +1 -0
- package/lib-esm/mixins/ApiItemContainerMixin.js +319 -0
- package/lib-esm/mixins/ApiItemContainerMixin.js.map +1 -0
- package/lib-esm/mixins/ApiNameMixin.js +61 -0
- package/lib-esm/mixins/ApiNameMixin.js.map +1 -0
- package/lib-esm/mixins/ApiOptionalMixin.js +57 -0
- package/lib-esm/mixins/ApiOptionalMixin.js.map +1 -0
- package/lib-esm/mixins/ApiParameterListMixin.js +93 -0
- package/lib-esm/mixins/ApiParameterListMixin.js.map +1 -0
- package/lib-esm/mixins/ApiProtectedMixin.js +57 -0
- package/lib-esm/mixins/ApiProtectedMixin.js.map +1 -0
- package/lib-esm/mixins/ApiReadonlyMixin.js +58 -0
- package/lib-esm/mixins/ApiReadonlyMixin.js.map +1 -0
- package/lib-esm/mixins/ApiReleaseTagMixin.js +65 -0
- package/lib-esm/mixins/ApiReleaseTagMixin.js.map +1 -0
- package/lib-esm/mixins/ApiReturnTypeMixin.js +65 -0
- package/lib-esm/mixins/ApiReturnTypeMixin.js.map +1 -0
- package/lib-esm/mixins/ApiStaticMixin.js +57 -0
- package/lib-esm/mixins/ApiStaticMixin.js.map +1 -0
- package/lib-esm/mixins/ApiTypeParameterListMixin.js +90 -0
- package/lib-esm/mixins/ApiTypeParameterListMixin.js.map +1 -0
- package/lib-esm/mixins/Excerpt.js +101 -0
- package/lib-esm/mixins/Excerpt.js.map +1 -0
- package/lib-esm/mixins/IFindApiItemsResult.js +26 -0
- package/lib-esm/mixins/IFindApiItemsResult.js.map +1 -0
- package/lib-esm/mixins/Mixin.js +4 -0
- package/lib-esm/mixins/Mixin.js.map +1 -0
- package/lib-esm/model/ApiCallSignature.js +63 -0
- package/lib-esm/model/ApiCallSignature.js.map +1 -0
- package/lib-esm/model/ApiClass.js +84 -0
- package/lib-esm/model/ApiClass.js.map +1 -0
- package/lib-esm/model/ApiConstructSignature.js +76 -0
- package/lib-esm/model/ApiConstructSignature.js.map +1 -0
- package/lib-esm/model/ApiConstructor.js +60 -0
- package/lib-esm/model/ApiConstructor.js.map +1 -0
- package/lib-esm/model/ApiEntryPoint.js +71 -0
- package/lib-esm/model/ApiEntryPoint.js.map +1 -0
- package/lib-esm/model/ApiEnum.js +65 -0
- package/lib-esm/model/ApiEnum.js.map +1 -0
- package/lib-esm/model/ApiEnumMember.js +80 -0
- package/lib-esm/model/ApiEnumMember.js.map +1 -0
- package/lib-esm/model/ApiFunction.js +58 -0
- package/lib-esm/model/ApiFunction.js.map +1 -0
- package/lib-esm/model/ApiIndexSignature.js +56 -0
- package/lib-esm/model/ApiIndexSignature.js.map +1 -0
- package/lib-esm/model/ApiInterface.js +73 -0
- package/lib-esm/model/ApiInterface.js.map +1 -0
- package/lib-esm/model/ApiMethod.js +65 -0
- package/lib-esm/model/ApiMethod.js.map +1 -0
- package/lib-esm/model/ApiMethodSignature.js +57 -0
- package/lib-esm/model/ApiMethodSignature.js.map +1 -0
- package/lib-esm/model/ApiModel.js +170 -0
- package/lib-esm/model/ApiModel.js.map +1 -0
- package/lib-esm/model/ApiNamespace.js +56 -0
- package/lib-esm/model/ApiNamespace.js.map +1 -0
- package/lib-esm/model/ApiPackage.js +148 -0
- package/lib-esm/model/ApiPackage.js.map +1 -0
- package/lib-esm/model/ApiProperty.js +72 -0
- package/lib-esm/model/ApiProperty.js.map +1 -0
- package/lib-esm/model/ApiPropertySignature.js +51 -0
- package/lib-esm/model/ApiPropertySignature.js.map +1 -0
- package/lib-esm/model/ApiTypeAlias.js +71 -0
- package/lib-esm/model/ApiTypeAlias.js.map +1 -0
- package/lib-esm/model/ApiVariable.js +66 -0
- package/lib-esm/model/ApiVariable.js.map +1 -0
- package/lib-esm/model/Deserializer.js +88 -0
- package/lib-esm/model/Deserializer.js.map +1 -0
- package/lib-esm/model/DeserializerContext.js +111 -0
- package/lib-esm/model/DeserializerContext.js.map +1 -0
- package/lib-esm/model/HeritageType.js +25 -0
- package/lib-esm/model/HeritageType.js.map +1 -0
- package/lib-esm/model/ModelReferenceResolver.js +177 -0
- package/lib-esm/model/ModelReferenceResolver.js.map +1 -0
- package/lib-esm/model/Parameter.js +39 -0
- package/lib-esm/model/Parameter.js.map +1 -0
- package/lib-esm/model/SourceLocation.js +35 -0
- package/lib-esm/model/SourceLocation.js.map +1 -0
- package/lib-esm/model/TypeParameter.js +49 -0
- package/lib-esm/model/TypeParameter.js.map +1 -0
- package/package.json +27 -5
- /package/{lib → lib-commonjs}/aedoc/AedocDefinitions.js +0 -0
- /package/{lib → lib-commonjs}/aedoc/AedocDefinitions.js.map +0 -0
- /package/{lib → lib-commonjs}/aedoc/ReleaseTag.js +0 -0
- /package/{lib → lib-commonjs}/aedoc/ReleaseTag.js.map +0 -0
- /package/{lib → lib-commonjs}/index.js +0 -0
- /package/{lib → lib-commonjs}/index.js.map +0 -0
- /package/{lib → lib-commonjs}/items/ApiDeclaredItem.js +0 -0
- /package/{lib → lib-commonjs}/items/ApiDeclaredItem.js.map +0 -0
- /package/{lib → lib-commonjs}/items/ApiDocumentedItem.js +0 -0
- /package/{lib → lib-commonjs}/items/ApiDocumentedItem.js.map +0 -0
- /package/{lib → lib-commonjs}/items/ApiItem.js +0 -0
- /package/{lib → lib-commonjs}/items/ApiItem.js.map +0 -0
- /package/{lib → lib-commonjs}/items/ApiPropertyItem.js +0 -0
- /package/{lib → lib-commonjs}/items/ApiPropertyItem.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiAbstractMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiAbstractMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiExportedMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiExportedMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiInitializerMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiInitializerMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiItemContainerMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiItemContainerMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiNameMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiNameMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiOptionalMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiOptionalMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiParameterListMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiParameterListMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiProtectedMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiProtectedMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiReadonlyMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiReadonlyMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiReleaseTagMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiReleaseTagMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiReturnTypeMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiReturnTypeMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiStaticMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiStaticMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiTypeParameterListMixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/ApiTypeParameterListMixin.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/Excerpt.js +0 -0
- /package/{lib → lib-commonjs}/mixins/Excerpt.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/IFindApiItemsResult.js +0 -0
- /package/{lib → lib-commonjs}/mixins/IFindApiItemsResult.js.map +0 -0
- /package/{lib → lib-commonjs}/mixins/Mixin.js +0 -0
- /package/{lib → lib-commonjs}/mixins/Mixin.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiCallSignature.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiCallSignature.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiClass.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiClass.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiConstructSignature.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiConstructSignature.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiConstructor.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiConstructor.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiEntryPoint.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiEntryPoint.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiEnum.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiEnum.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiEnumMember.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiEnumMember.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiFunction.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiFunction.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiIndexSignature.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiIndexSignature.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiInterface.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiInterface.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiMethod.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiMethod.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiMethodSignature.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiMethodSignature.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiModel.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiModel.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiNamespace.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiNamespace.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiPackage.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiPackage.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiProperty.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiProperty.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiPropertySignature.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiPropertySignature.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiTypeAlias.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiTypeAlias.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ApiVariable.js +0 -0
- /package/{lib → lib-commonjs}/model/ApiVariable.js.map +0 -0
- /package/{lib → lib-commonjs}/model/Deserializer.js +0 -0
- /package/{lib → lib-commonjs}/model/Deserializer.js.map +0 -0
- /package/{lib → lib-commonjs}/model/DeserializerContext.js +0 -0
- /package/{lib → lib-commonjs}/model/DeserializerContext.js.map +0 -0
- /package/{lib → lib-commonjs}/model/HeritageType.js +0 -0
- /package/{lib → lib-commonjs}/model/HeritageType.js.map +0 -0
- /package/{lib → lib-commonjs}/model/ModelReferenceResolver.js +0 -0
- /package/{lib → lib-commonjs}/model/ModelReferenceResolver.js.map +0 -0
- /package/{lib → lib-commonjs}/model/Parameter.js +0 -0
- /package/{lib → lib-commonjs}/model/Parameter.js.map +0 -0
- /package/{lib → lib-commonjs}/model/SourceLocation.js +0 -0
- /package/{lib → lib-commonjs}/model/SourceLocation.js.map +0 -0
- /package/{lib → lib-commonjs}/model/TypeParameter.js +0 -0
- /package/{lib → lib-commonjs}/model/TypeParameter.js.map +0 -0
- /package/{lib → lib-dts}/aedoc/AedocDefinitions.d.ts +0 -0
- /package/{lib → lib-dts}/aedoc/AedocDefinitions.d.ts.map +0 -0
- /package/{lib → lib-dts}/aedoc/ReleaseTag.d.ts +0 -0
- /package/{lib → lib-dts}/aedoc/ReleaseTag.d.ts.map +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts.map +0 -0
- /package/{lib → lib-dts}/items/ApiDeclaredItem.d.ts +0 -0
- /package/{lib → lib-dts}/items/ApiDeclaredItem.d.ts.map +0 -0
- /package/{lib → lib-dts}/items/ApiDocumentedItem.d.ts +0 -0
- /package/{lib → lib-dts}/items/ApiDocumentedItem.d.ts.map +0 -0
- /package/{lib → lib-dts}/items/ApiItem.d.ts +0 -0
- /package/{lib → lib-dts}/items/ApiItem.d.ts.map +0 -0
- /package/{lib → lib-dts}/items/ApiPropertyItem.d.ts +0 -0
- /package/{lib → lib-dts}/items/ApiPropertyItem.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiAbstractMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiAbstractMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiExportedMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiExportedMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiInitializerMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiInitializerMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiItemContainerMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiItemContainerMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiNameMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiNameMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiOptionalMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiOptionalMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiParameterListMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiParameterListMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiProtectedMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiProtectedMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiReadonlyMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiReadonlyMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiReleaseTagMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiReleaseTagMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiReturnTypeMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiReturnTypeMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiStaticMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiStaticMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/ApiTypeParameterListMixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/ApiTypeParameterListMixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/Excerpt.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/Excerpt.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/IFindApiItemsResult.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/IFindApiItemsResult.d.ts.map +0 -0
- /package/{lib → lib-dts}/mixins/Mixin.d.ts +0 -0
- /package/{lib → lib-dts}/mixins/Mixin.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiCallSignature.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiCallSignature.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiClass.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiClass.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiConstructSignature.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiConstructSignature.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiConstructor.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiConstructor.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiEntryPoint.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiEntryPoint.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiEnum.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiEnum.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiEnumMember.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiEnumMember.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiFunction.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiFunction.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiIndexSignature.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiIndexSignature.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiInterface.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiInterface.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiMethod.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiMethod.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiMethodSignature.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiMethodSignature.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiModel.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiModel.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiNamespace.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiNamespace.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiPackage.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiPackage.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiProperty.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiProperty.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiPropertySignature.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiPropertySignature.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiTypeAlias.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiTypeAlias.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ApiVariable.d.ts +0 -0
- /package/{lib → lib-dts}/model/ApiVariable.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/Deserializer.d.ts +0 -0
- /package/{lib → lib-dts}/model/Deserializer.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/DeserializerContext.d.ts +0 -0
- /package/{lib → lib-dts}/model/DeserializerContext.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/HeritageType.d.ts +0 -0
- /package/{lib → lib-dts}/model/HeritageType.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/ModelReferenceResolver.d.ts +0 -0
- /package/{lib → lib-dts}/model/ModelReferenceResolver.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/Parameter.d.ts +0 -0
- /package/{lib → lib-dts}/model/Parameter.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/SourceLocation.d.ts +0 -0
- /package/{lib → lib-dts}/model/SourceLocation.d.ts.map +0 -0
- /package/{lib → lib-dts}/model/TypeParameter.d.ts +0 -0
- /package/{lib → lib-dts}/model/TypeParameter.d.ts.map +0 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { InternalError } from '@rushstack/node-core-library';
|
|
4
|
+
import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';
|
|
5
|
+
import { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';
|
|
6
|
+
/**
|
|
7
|
+
* The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of
|
|
8
|
+
* {@link ApiItem}.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export var ApiItemKind;
|
|
13
|
+
(function (ApiItemKind) {
|
|
14
|
+
ApiItemKind["CallSignature"] = "CallSignature";
|
|
15
|
+
ApiItemKind["Class"] = "Class";
|
|
16
|
+
ApiItemKind["Constructor"] = "Constructor";
|
|
17
|
+
ApiItemKind["ConstructSignature"] = "ConstructSignature";
|
|
18
|
+
ApiItemKind["EntryPoint"] = "EntryPoint";
|
|
19
|
+
ApiItemKind["Enum"] = "Enum";
|
|
20
|
+
ApiItemKind["EnumMember"] = "EnumMember";
|
|
21
|
+
ApiItemKind["Function"] = "Function";
|
|
22
|
+
ApiItemKind["IndexSignature"] = "IndexSignature";
|
|
23
|
+
ApiItemKind["Interface"] = "Interface";
|
|
24
|
+
ApiItemKind["Method"] = "Method";
|
|
25
|
+
ApiItemKind["MethodSignature"] = "MethodSignature";
|
|
26
|
+
ApiItemKind["Model"] = "Model";
|
|
27
|
+
ApiItemKind["Namespace"] = "Namespace";
|
|
28
|
+
ApiItemKind["Package"] = "Package";
|
|
29
|
+
ApiItemKind["Property"] = "Property";
|
|
30
|
+
ApiItemKind["PropertySignature"] = "PropertySignature";
|
|
31
|
+
ApiItemKind["TypeAlias"] = "TypeAlias";
|
|
32
|
+
ApiItemKind["Variable"] = "Variable";
|
|
33
|
+
ApiItemKind["None"] = "None";
|
|
34
|
+
})(ApiItemKind || (ApiItemKind = {}));
|
|
35
|
+
// PRIVATE - Allows ApiItemContainerMixin to assign the parent.
|
|
36
|
+
//
|
|
37
|
+
export const apiItem_onParentChanged = Symbol('ApiItem._onAddToContainer');
|
|
38
|
+
/**
|
|
39
|
+
* The abstract base class for all members of an `ApiModel` object.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
|
|
43
|
+
* API declarations.
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export class ApiItem {
|
|
47
|
+
constructor(options) {
|
|
48
|
+
// ("options" is not used here, but part of the inheritance pattern)
|
|
49
|
+
}
|
|
50
|
+
static deserialize(jsonObject, context) {
|
|
51
|
+
// The Deserializer class is coupled with a ton of other classes, so we delay loading it
|
|
52
|
+
// to avoid ES5 circular imports.
|
|
53
|
+
const deserializerModule = require('../model/Deserializer');
|
|
54
|
+
return deserializerModule.Deserializer.deserialize(context, jsonObject);
|
|
55
|
+
}
|
|
56
|
+
/** @virtual */
|
|
57
|
+
static onDeserializeInto(options, context, jsonObject) {
|
|
58
|
+
// (implemented by subclasses)
|
|
59
|
+
}
|
|
60
|
+
/** @virtual */
|
|
61
|
+
serializeInto(jsonObject) {
|
|
62
|
+
jsonObject.kind = this.kind;
|
|
63
|
+
jsonObject.canonicalReference = this.canonicalReference.toString();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Identifies the subclass of the `ApiItem` base class.
|
|
67
|
+
* @virtual
|
|
68
|
+
*/
|
|
69
|
+
get kind() {
|
|
70
|
+
throw new Error('ApiItem.kind was not implemented by the child class');
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Warning: This API is used internally by API extractor but is not yet ready for general usage.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
*
|
|
77
|
+
* Returns a `DeclarationReference` object using the experimental new declaration reference notation.
|
|
78
|
+
*
|
|
79
|
+
* @beta
|
|
80
|
+
*/
|
|
81
|
+
get canonicalReference() {
|
|
82
|
+
if (!this._canonicalReference) {
|
|
83
|
+
try {
|
|
84
|
+
this._canonicalReference = this.buildCanonicalReference();
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
const name = this.getScopedNameWithinPackage() || this.displayName;
|
|
88
|
+
throw new InternalError(`Error building canonical reference for ${name}:\n` + e.message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return this._canonicalReference;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Returns a string key that can be used to efficiently retrieve an `ApiItem` from an `ApiItemContainerMixin`.
|
|
95
|
+
* The key is unique within the container. Its format is undocumented and may change at any time.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation
|
|
99
|
+
* of this function, according to the aspects that are important for identifying it.
|
|
100
|
+
*
|
|
101
|
+
* @virtual
|
|
102
|
+
*/
|
|
103
|
+
get containerKey() {
|
|
104
|
+
throw new InternalError('ApiItem.containerKey was not implemented by the child class');
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Returns a name for this object that can be used in diagnostic messages, for example.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* For an object that inherits ApiNameMixin, this will return the declared name (e.g. the name of a TypeScript
|
|
111
|
+
* function). Otherwise, it will return a string such as "(call signature)" or "(model)".
|
|
112
|
+
*
|
|
113
|
+
* @virtual
|
|
114
|
+
*/
|
|
115
|
+
get displayName() {
|
|
116
|
+
switch (this.kind) {
|
|
117
|
+
case ApiItemKind.CallSignature:
|
|
118
|
+
return '(call)';
|
|
119
|
+
case ApiItemKind.Constructor:
|
|
120
|
+
return '(constructor)';
|
|
121
|
+
case ApiItemKind.ConstructSignature:
|
|
122
|
+
return '(new)';
|
|
123
|
+
case ApiItemKind.IndexSignature:
|
|
124
|
+
return '(indexer)';
|
|
125
|
+
case ApiItemKind.Model:
|
|
126
|
+
return '(model)';
|
|
127
|
+
}
|
|
128
|
+
return '(???)'; // All other types should inherit ApiNameMixin which will override this property
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* If this item was added to a ApiItemContainerMixin item, then this returns the container item.
|
|
132
|
+
* If this is an Parameter that was added to a method or function, then this returns the function item.
|
|
133
|
+
* Otherwise, it returns undefined.
|
|
134
|
+
* @virtual
|
|
135
|
+
*/
|
|
136
|
+
get parent() {
|
|
137
|
+
return this._parent;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* This property supports a visitor pattern for walking the tree.
|
|
141
|
+
* For items with ApiItemContainerMixin, it returns the contained items, sorted alphabetically.
|
|
142
|
+
* Otherwise it returns an empty array.
|
|
143
|
+
* @virtual
|
|
144
|
+
*/
|
|
145
|
+
get members() {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* If this item has a name (i.e. extends `ApiNameMixin`), then return all items that have the same parent
|
|
150
|
+
* and the same name. Otherwise, return all items that have the same parent and the same `ApiItemKind`.
|
|
151
|
+
*
|
|
152
|
+
* @remarks
|
|
153
|
+
* Examples: For a function, this would return all overloads for the function. For a constructor, this would
|
|
154
|
+
* return all overloads for the constructor. For a merged declaration (e.g. a `namespace` and `enum` with the
|
|
155
|
+
* same name), this would return both declarations. If this item does not have a parent, or if it is the only
|
|
156
|
+
* item of its name/kind, then the result is an array containing only this item.
|
|
157
|
+
*/
|
|
158
|
+
getMergedSiblings() {
|
|
159
|
+
const parent = this._parent;
|
|
160
|
+
if (parent && ApiItemContainerMixin.isBaseClassOf(parent)) {
|
|
161
|
+
return parent._getMergedSiblingsForMember(this);
|
|
162
|
+
}
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.
|
|
167
|
+
*/
|
|
168
|
+
getHierarchy() {
|
|
169
|
+
const hierarchy = [];
|
|
170
|
+
for (let current = this; current !== undefined; current = current.parent) {
|
|
171
|
+
hierarchy.push(current);
|
|
172
|
+
}
|
|
173
|
+
hierarchy.reverse();
|
|
174
|
+
return hierarchy;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* This returns a scoped name such as `"Namespace1.Namespace2.MyClass.myMember()"`. It does not include the
|
|
178
|
+
* package name or entry point.
|
|
179
|
+
*
|
|
180
|
+
* @remarks
|
|
181
|
+
* If called on an ApiEntrypoint, ApiPackage, or ApiModel item, the result is an empty string.
|
|
182
|
+
*/
|
|
183
|
+
getScopedNameWithinPackage() {
|
|
184
|
+
const reversedParts = [];
|
|
185
|
+
for (let current = this; current !== undefined; current = current.parent) {
|
|
186
|
+
if (current.kind === ApiItemKind.Model ||
|
|
187
|
+
current.kind === ApiItemKind.Package ||
|
|
188
|
+
current.kind === ApiItemKind.EntryPoint) {
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (reversedParts.length !== 0) {
|
|
192
|
+
reversedParts.push('.');
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
switch (current.kind) {
|
|
196
|
+
case ApiItemKind.CallSignature:
|
|
197
|
+
case ApiItemKind.ConstructSignature:
|
|
198
|
+
case ApiItemKind.Constructor:
|
|
199
|
+
case ApiItemKind.IndexSignature:
|
|
200
|
+
// These functional forms don't have a proper name, so we don't append the "()" suffix
|
|
201
|
+
break;
|
|
202
|
+
default:
|
|
203
|
+
if (ApiParameterListMixin.isBaseClassOf(current)) {
|
|
204
|
+
reversedParts.push('()');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
reversedParts.push(current.displayName);
|
|
209
|
+
}
|
|
210
|
+
return reversedParts.reverse().join('');
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned.
|
|
214
|
+
* Otherwise undefined is returned.
|
|
215
|
+
*/
|
|
216
|
+
getAssociatedPackage() {
|
|
217
|
+
for (let current = this; current !== undefined; current = current.parent) {
|
|
218
|
+
if (current.kind === ApiItemKind.Package) {
|
|
219
|
+
return current;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.
|
|
226
|
+
* Otherwise undefined is returned.
|
|
227
|
+
*/
|
|
228
|
+
getAssociatedModel() {
|
|
229
|
+
for (let current = this; current !== undefined; current = current.parent) {
|
|
230
|
+
if (current.kind === ApiItemKind.Model) {
|
|
231
|
+
return current;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* A text string whose value determines the sort order that is automatically applied by the
|
|
238
|
+
* {@link (ApiItemContainerMixin:interface)} class.
|
|
239
|
+
*
|
|
240
|
+
* @remarks
|
|
241
|
+
* The value of this string is undocumented and may change at any time.
|
|
242
|
+
* If {@link (ApiItemContainerMixin:interface).preserveMemberOrder} is enabled for the `ApiItem`'s parent,
|
|
243
|
+
* then no sorting is performed, and this key is not used.
|
|
244
|
+
*
|
|
245
|
+
* @virtual
|
|
246
|
+
*/
|
|
247
|
+
getSortKey() {
|
|
248
|
+
return this.containerKey;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* PRIVATE
|
|
252
|
+
*
|
|
253
|
+
* @privateRemarks
|
|
254
|
+
* Allows ApiItemContainerMixin to assign the parent when the item is added to a container.
|
|
255
|
+
*
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
258
|
+
[apiItem_onParentChanged](parent) {
|
|
259
|
+
this._parent = parent;
|
|
260
|
+
this._canonicalReference = undefined;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Builds the cached object used by the `canonicalReference` property.
|
|
264
|
+
* @virtual
|
|
265
|
+
*/
|
|
266
|
+
buildCanonicalReference() {
|
|
267
|
+
throw new InternalError('ApiItem.canonicalReference was not implemented by the child class');
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=ApiItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiItem.js","sourceRoot":"","sources":["../../src/items/ApiItem.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAI7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAGxE;;;;;GAKG;AACH,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB,8CAA+B,CAAA;IAC/B,8BAAe,CAAA;IACf,0CAA2B,CAAA;IAC3B,wDAAyC,CAAA;IACzC,wCAAyB,CAAA;IACzB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,gDAAiC,CAAA;IACjC,sCAAuB,CAAA;IACvB,gCAAiB,CAAA;IACjB,kDAAmC,CAAA;IACnC,8BAAe,CAAA;IACf,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,sDAAuC,CAAA;IACvC,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;AACf,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAaD,+DAA+D;AAC/D,EAAE;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAkB,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAE1F;;;;;;;GAOG;AACH,MAAM,OAAO,OAAO;IAIlB,YAAmB,OAAwB;QACzC,oEAAoE;IACtE,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,UAAwB,EAAE,OAA4B;QAC9E,yFAAyF;QACzF,iCAAiC;QACjC,MAAM,kBAAkB,GAA2C,OAAO,CAAC,uBAAuB,CAAC,CAAC;QACpG,OAAO,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AC;YAC7B,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;OAUG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACI,CAAC,uBAAuB,CAAC,CAAC,MAA2B;QAC1D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;IACvC,CAAC;IAED;;;OAGG;IACO,uBAAuB;QAC/B,MAAM,IAAI,aAAa,CAAC,mEAAmE,CAAC,CAAC;IAC/F,CAAC;CACF","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 { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { Constructor, PropertiesOf } from '../mixins/Mixin';\nimport type { ApiPackage } from '../model/ApiPackage';\nimport { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\nimport type { DeserializerContext } from '../model/DeserializerContext';\nimport { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';\nimport type { ApiModel } from '../model/ApiModel';\n\n/**\n * The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of\n * {@link ApiItem}.\n *\n * @public\n */\nexport enum ApiItemKind {\n CallSignature = 'CallSignature',\n Class = 'Class',\n Constructor = 'Constructor',\n ConstructSignature = 'ConstructSignature',\n EntryPoint = 'EntryPoint',\n Enum = 'Enum',\n EnumMember = 'EnumMember',\n Function = 'Function',\n IndexSignature = 'IndexSignature',\n Interface = 'Interface',\n Method = 'Method',\n MethodSignature = 'MethodSignature',\n Model = 'Model',\n Namespace = 'Namespace',\n Package = 'Package',\n Property = 'Property',\n PropertySignature = 'PropertySignature',\n TypeAlias = 'TypeAlias',\n Variable = 'Variable',\n None = 'None'\n}\n\n/**\n * Constructor options for {@link ApiItem}.\n * @public\n */\nexport interface IApiItemOptions {}\n\nexport interface IApiItemJson {\n kind: ApiItemKind;\n canonicalReference: string;\n}\n\n// PRIVATE - Allows ApiItemContainerMixin to assign the parent.\n//\nexport const apiItem_onParentChanged: unique symbol = Symbol('ApiItem._onAddToContainer');\n\n/**\n * The abstract base class for all members of an `ApiModel` object.\n *\n * @remarks\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations.\n * @public\n */\nexport class ApiItem {\n private _canonicalReference: DeclarationReference | undefined;\n private _parent: ApiItem | undefined;\n\n public constructor(options: IApiItemOptions) {\n // (\"options\" is not used here, but part of the inheritance pattern)\n }\n\n public static deserialize(jsonObject: IApiItemJson, context: DeserializerContext): ApiItem {\n // The Deserializer class is coupled with a ton of other classes, so we delay loading it\n // to avoid ES5 circular imports.\n const deserializerModule: typeof import('../model/Deserializer') = require('../model/Deserializer');\n return deserializerModule.Deserializer.deserialize(context, jsonObject);\n }\n\n /** @virtual */\n public static onDeserializeInto(\n options: Partial<IApiItemOptions>,\n context: DeserializerContext,\n jsonObject: IApiItemJson\n ): void {\n // (implemented by subclasses)\n }\n\n /** @virtual */\n public serializeInto(jsonObject: Partial<IApiItemJson>): void {\n jsonObject.kind = this.kind;\n jsonObject.canonicalReference = this.canonicalReference.toString();\n }\n\n /**\n * Identifies the subclass of the `ApiItem` base class.\n * @virtual\n */\n public get kind(): ApiItemKind {\n throw new Error('ApiItem.kind was not implemented by the child class');\n }\n\n /**\n * Warning: This API is used internally by API extractor but is not yet ready for general usage.\n *\n * @remarks\n *\n * Returns a `DeclarationReference` object using the experimental new declaration reference notation.\n *\n * @beta\n */\n public get canonicalReference(): DeclarationReference {\n if (!this._canonicalReference) {\n try {\n this._canonicalReference = this.buildCanonicalReference();\n } catch (e) {\n const name: string = this.getScopedNameWithinPackage() || this.displayName;\n throw new InternalError(`Error building canonical reference for ${name}:\\n` + (e as Error).message);\n }\n }\n return this._canonicalReference;\n }\n\n /**\n * Returns a string key that can be used to efficiently retrieve an `ApiItem` from an `ApiItemContainerMixin`.\n * The key is unique within the container. Its format is undocumented and may change at any time.\n *\n * @remarks\n * Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation\n * of this function, according to the aspects that are important for identifying it.\n *\n * @virtual\n */\n public get containerKey(): string {\n throw new InternalError('ApiItem.containerKey was not implemented by the child class');\n }\n\n /**\n * Returns a name for this object that can be used in diagnostic messages, for example.\n *\n * @remarks\n * For an object that inherits ApiNameMixin, this will return the declared name (e.g. the name of a TypeScript\n * function). Otherwise, it will return a string such as \"(call signature)\" or \"(model)\".\n *\n * @virtual\n */\n public get displayName(): string {\n switch (this.kind) {\n case ApiItemKind.CallSignature:\n return '(call)';\n case ApiItemKind.Constructor:\n return '(constructor)';\n case ApiItemKind.ConstructSignature:\n return '(new)';\n case ApiItemKind.IndexSignature:\n return '(indexer)';\n case ApiItemKind.Model:\n return '(model)';\n }\n return '(???)'; // All other types should inherit ApiNameMixin which will override this property\n }\n\n /**\n * If this item was added to a ApiItemContainerMixin item, then this returns the container item.\n * If this is an Parameter that was added to a method or function, then this returns the function item.\n * Otherwise, it returns undefined.\n * @virtual\n */\n public get parent(): ApiItem | undefined {\n return this._parent;\n }\n\n /**\n * This property supports a visitor pattern for walking the tree.\n * For items with ApiItemContainerMixin, it returns the contained items, sorted alphabetically.\n * Otherwise it returns an empty array.\n * @virtual\n */\n public get members(): ReadonlyArray<ApiItem> {\n return [];\n }\n\n /**\n * If this item has a name (i.e. extends `ApiNameMixin`), then return all items that have the same parent\n * and the same name. Otherwise, return all items that have the same parent and the same `ApiItemKind`.\n *\n * @remarks\n * Examples: For a function, this would return all overloads for the function. For a constructor, this would\n * return all overloads for the constructor. For a merged declaration (e.g. a `namespace` and `enum` with the\n * same name), this would return both declarations. If this item does not have a parent, or if it is the only\n * item of its name/kind, then the result is an array containing only this item.\n */\n public getMergedSiblings(): ReadonlyArray<ApiItem> {\n const parent: ApiItem | undefined = this._parent;\n if (parent && ApiItemContainerMixin.isBaseClassOf(parent)) {\n return parent._getMergedSiblingsForMember(this);\n }\n return [];\n }\n\n /**\n * Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.\n */\n public getHierarchy(): ReadonlyArray<ApiItem> {\n const hierarchy: ApiItem[] = [];\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n hierarchy.push(current);\n }\n hierarchy.reverse();\n return hierarchy;\n }\n\n /**\n * This returns a scoped name such as `\"Namespace1.Namespace2.MyClass.myMember()\"`. It does not include the\n * package name or entry point.\n *\n * @remarks\n * If called on an ApiEntrypoint, ApiPackage, or ApiModel item, the result is an empty string.\n */\n public getScopedNameWithinPackage(): string {\n const reversedParts: string[] = [];\n\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (\n current.kind === ApiItemKind.Model ||\n current.kind === ApiItemKind.Package ||\n current.kind === ApiItemKind.EntryPoint\n ) {\n break;\n }\n if (reversedParts.length !== 0) {\n reversedParts.push('.');\n } else {\n switch (current.kind) {\n case ApiItemKind.CallSignature:\n case ApiItemKind.ConstructSignature:\n case ApiItemKind.Constructor:\n case ApiItemKind.IndexSignature:\n // These functional forms don't have a proper name, so we don't append the \"()\" suffix\n break;\n default:\n if (ApiParameterListMixin.isBaseClassOf(current)) {\n reversedParts.push('()');\n }\n }\n }\n reversedParts.push(current.displayName);\n }\n\n return reversedParts.reverse().join('');\n }\n\n /**\n * If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned.\n * Otherwise undefined is returned.\n */\n public getAssociatedPackage(): ApiPackage | undefined {\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (current.kind === ApiItemKind.Package) {\n return current as ApiPackage;\n }\n }\n return undefined;\n }\n\n /**\n * If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.\n * Otherwise undefined is returned.\n */\n public getAssociatedModel(): ApiModel | undefined {\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (current.kind === ApiItemKind.Model) {\n return current as ApiModel;\n }\n }\n return undefined;\n }\n\n /**\n * A text string whose value determines the sort order that is automatically applied by the\n * {@link (ApiItemContainerMixin:interface)} class.\n *\n * @remarks\n * The value of this string is undocumented and may change at any time.\n * If {@link (ApiItemContainerMixin:interface).preserveMemberOrder} is enabled for the `ApiItem`'s parent,\n * then no sorting is performed, and this key is not used.\n *\n * @virtual\n */\n public getSortKey(): string {\n return this.containerKey;\n }\n\n /**\n * PRIVATE\n *\n * @privateRemarks\n * Allows ApiItemContainerMixin to assign the parent when the item is added to a container.\n *\n * @internal\n */\n public [apiItem_onParentChanged](parent: ApiItem | undefined): void {\n this._parent = parent;\n this._canonicalReference = undefined;\n }\n\n /**\n * Builds the cached object used by the `canonicalReference` property.\n * @virtual\n */\n protected buildCanonicalReference(): DeclarationReference {\n throw new InternalError('ApiItem.canonicalReference was not implemented by the child class');\n }\n}\n\n/**\n * This abstraction is used by the mixin pattern.\n * It describes a class type that inherits from {@link ApiItem}.\n *\n * @public\n */\nexport interface IApiItemConstructor extends Constructor<ApiItem>, PropertiesOf<typeof ApiItem> {}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { ApiDeclaredItem } from './ApiDeclaredItem';
|
|
4
|
+
import { ApiReleaseTagMixin } from '../mixins/ApiReleaseTagMixin';
|
|
5
|
+
import { ApiNameMixin } from '../mixins/ApiNameMixin';
|
|
6
|
+
import { ApiOptionalMixin } from '../mixins/ApiOptionalMixin';
|
|
7
|
+
import { ApiReadonlyMixin } from '../mixins/ApiReadonlyMixin';
|
|
8
|
+
/**
|
|
9
|
+
* The abstract base class for {@link ApiProperty} and {@link ApiPropertySignature}.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export class ApiPropertyItem extends ApiNameMixin(ApiReleaseTagMixin(ApiOptionalMixin(ApiReadonlyMixin(ApiDeclaredItem)))) {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super(options);
|
|
16
|
+
this.propertyTypeExcerpt = this.buildExcerpt(options.propertyTypeTokenRange);
|
|
17
|
+
}
|
|
18
|
+
/** @override */
|
|
19
|
+
static onDeserializeInto(options, context, jsonObject) {
|
|
20
|
+
super.onDeserializeInto(options, context, jsonObject);
|
|
21
|
+
options.propertyTypeTokenRange = jsonObject.propertyTypeTokenRange;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns true if this property should be documented as an event.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* The `@eventProperty` TSDoc modifier can be added to readonly properties to indicate that they return an
|
|
28
|
+
* event object that event handlers can be attached to. The event-handling API is implementation-defined, but
|
|
29
|
+
* typically the return type would be a class with members such as `addHandler()` and `removeHandler()`.
|
|
30
|
+
* The documentation should display such properties under an "Events" heading instead of the
|
|
31
|
+
* usual "Properties" heading.
|
|
32
|
+
*/
|
|
33
|
+
get isEventProperty() {
|
|
34
|
+
if (this.tsdocComment) {
|
|
35
|
+
return this.tsdocComment.modifierTagSet.isEventProperty();
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
/** @override */
|
|
40
|
+
serializeInto(jsonObject) {
|
|
41
|
+
super.serializeInto(jsonObject);
|
|
42
|
+
jsonObject.propertyTypeTokenRange = this.propertyTypeExcerpt.tokenRange;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ApiPropertyItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiPropertyItem.js","sourceRoot":"","sources":["../../src/items/ApiPropertyItem.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAG3D,OAAO,EAAgC,eAAe,EAA6B,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAmC,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAA6B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAiC,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAiC,MAAM,4BAA4B,CAAC;AAmB7F;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY,CAC/C,kBAAkB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,eAAe,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,CAAC;YACtB,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;QAC5D,CAAC;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","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 { type IApiDeclaredItemOptions, ApiDeclaredItem, type IApiDeclaredItemJson } from './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"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
const _isAbstract = Symbol('ApiAbstractMixin._isAbstract');
|
|
4
|
+
/**
|
|
5
|
+
* Mixin function for {@link (ApiAbstractMixin:interface)}.
|
|
6
|
+
*
|
|
7
|
+
* @param baseClass - The base class to be extended
|
|
8
|
+
* @returns A child class that extends baseClass, adding the {@link (ApiAbstractMixin:interface)}
|
|
9
|
+
* functionality.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export function ApiAbstractMixin(baseClass
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
) {
|
|
16
|
+
class MixedClass extends baseClass {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
constructor(...args) {
|
|
19
|
+
super(...args);
|
|
20
|
+
const options = args[0];
|
|
21
|
+
this[_isAbstract] = options.isAbstract;
|
|
22
|
+
}
|
|
23
|
+
/** @override */
|
|
24
|
+
static onDeserializeInto(options, context, jsonObject) {
|
|
25
|
+
baseClass.onDeserializeInto(options, context, jsonObject);
|
|
26
|
+
options.isAbstract = jsonObject.isAbstract || false;
|
|
27
|
+
}
|
|
28
|
+
get isAbstract() {
|
|
29
|
+
return this[_isAbstract];
|
|
30
|
+
}
|
|
31
|
+
/** @override */
|
|
32
|
+
serializeInto(jsonObject) {
|
|
33
|
+
super.serializeInto(jsonObject);
|
|
34
|
+
jsonObject.isAbstract = this.isAbstract;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return MixedClass;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Static members for {@link (ApiAbstractMixin:interface)}.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
(function (ApiAbstractMixin) {
|
|
44
|
+
/**
|
|
45
|
+
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiAbstractMixin` mixin.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
*
|
|
49
|
+
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
|
|
50
|
+
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
|
|
51
|
+
* the TypeScript type system cannot invoke a runtime test.)
|
|
52
|
+
*/
|
|
53
|
+
function isBaseClassOf(apiItem) {
|
|
54
|
+
return apiItem.hasOwnProperty(_isAbstract);
|
|
55
|
+
}
|
|
56
|
+
ApiAbstractMixin.isBaseClassOf = isBaseClassOf;
|
|
57
|
+
})(ApiAbstractMixin || (ApiAbstractMixin = {}));
|
|
58
|
+
//# sourceMappingURL=ApiAbstractMixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiAbstractMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiAbstractMixin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAmB3D,MAAM,WAAW,GAAkB,MAAM,CAAC,8BAA8B,CAAC,CAAC;AA2B1E;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAqB;AACrB,8DAA8D;;IAE9D,MAAM,UAAW,SAAQ,SAAS;QAGhC,8DAA8D;QAC9D,YAAmB,GAAG,IAAW;YAC/B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAEf,MAAM,OAAO,GAA6B,IAAI,CAAC,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;QACzC,CAAC;QAED,gBAAgB;QACT,MAAM,CAAC,iBAAiB,CAC7B,OAA0C,EAC1C,OAA4B,EAC5B,UAAiC;YAEjC,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE1D,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,KAAK,CAAC;QACtD,CAAC;QAED,IAAW,UAAU;YACnB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3B,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAA0C;YAC7D,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1C,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,WAAiB,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAFe,8BAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,gBAAgB,KAAhB,gBAAgB,QAahC","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/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Constructor options for {@link (ApiAbstractMixin:interface)}.\n * @public\n */\nexport interface IApiAbstractMixinOptions extends IApiItemOptions {\n isAbstract: boolean;\n}\n\nexport interface IApiAbstractMixinJson extends IApiItemJson {\n isAbstract: boolean;\n}\n\nconst _isAbstract: unique symbol = Symbol('ApiAbstractMixin._isAbstract');\n\n/**\n * The mixin base class for API items that have an abstract modifier.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiAbstractMixin extends ApiItem {\n /**\n * Indicates that the API item's value has an 'abstract' modifier.\n */\n readonly isAbstract: boolean;\n\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiAbstractMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiAbstractMixin:interface)}\n * functionality.\n *\n * @public\n */\nexport function ApiAbstractMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiAbstractMixin) {\n class MixedClass extends baseClass implements ApiAbstractMixin {\n public [_isAbstract]: boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiAbstractMixinOptions = args[0];\n this[_isAbstract] = options.isAbstract;\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiAbstractMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiAbstractMixinJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.isAbstract = jsonObject.isAbstract || false;\n }\n\n public get isAbstract(): boolean {\n return this[_isAbstract];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiAbstractMixinJson>): void {\n super.serializeInto(jsonObject);\n\n jsonObject.isAbstract = this.isAbstract;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiAbstractMixin:interface)}.\n * @public\n */\nexport namespace ApiAbstractMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiAbstractMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiAbstractMixin {\n return apiItem.hasOwnProperty(_isAbstract);\n }\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-redeclare */
|
|
4
|
+
import { DeclarationReference, Navigation } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
|
|
5
|
+
const _isExported = Symbol('ApiExportedMixin._isExported');
|
|
6
|
+
/**
|
|
7
|
+
* Mixin function for {@link (ApiExportedMixin:interface)}.
|
|
8
|
+
*
|
|
9
|
+
* @param baseClass - The base class to be extended
|
|
10
|
+
* @returns A child class that extends baseClass, adding the {@link (ApiExportedMixin:interface)} functionality.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export function ApiExportedMixin(baseClass
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
) {
|
|
17
|
+
class MixedClass extends baseClass {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
constructor(...args) {
|
|
20
|
+
super(...args);
|
|
21
|
+
const options = args[0];
|
|
22
|
+
this[_isExported] = options.isExported;
|
|
23
|
+
}
|
|
24
|
+
/** @override */
|
|
25
|
+
static onDeserializeInto(options, context, jsonObject) {
|
|
26
|
+
baseClass.onDeserializeInto(options, context, jsonObject);
|
|
27
|
+
const declarationReference = DeclarationReference.parse(jsonObject.canonicalReference);
|
|
28
|
+
options.isExported = declarationReference.navigation === Navigation.Exports;
|
|
29
|
+
}
|
|
30
|
+
get isExported() {
|
|
31
|
+
return this[_isExported];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The `isExported` property is intentionally not serialized because the information is already present
|
|
35
|
+
* in the item's `canonicalReference`.
|
|
36
|
+
* @override
|
|
37
|
+
*/
|
|
38
|
+
serializeInto(jsonObject) {
|
|
39
|
+
super.serializeInto(jsonObject);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return MixedClass;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Static members for {@link (ApiExportedMixin:interface)}.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
(function (ApiExportedMixin) {
|
|
49
|
+
/**
|
|
50
|
+
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiExportedMixin` mixin.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
*
|
|
54
|
+
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
|
|
55
|
+
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
|
|
56
|
+
* the TypeScript type system cannot invoke a runtime test.)
|
|
57
|
+
*/
|
|
58
|
+
function isBaseClassOf(apiItem) {
|
|
59
|
+
return apiItem.hasOwnProperty(_isExported);
|
|
60
|
+
}
|
|
61
|
+
ApiExportedMixin.isBaseClassOf = isBaseClassOf;
|
|
62
|
+
})(ApiExportedMixin || (ApiExportedMixin = {}));
|
|
63
|
+
//# sourceMappingURL=ApiExportedMixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiExportedMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiExportedMixin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,oDAAoD;AAEpD,OAAO,EAAE,oBAAoB,EAAE,UAA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ved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { DeclarationReference, Navigation } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\n\nimport type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Constructor options for {@link (IApiExportedMixinOptions:interface)}.\n * @public\n */\nexport interface IApiExportedMixinOptions extends IApiItemOptions {\n isExported: boolean;\n}\n\nexport interface IApiExportedMixinJson extends IApiItemJson {\n isExported: boolean;\n}\n\nconst _isExported: unique symbol = Symbol('ApiExportedMixin._isExported');\n\n/**\n * The mixin base class for API items that can be exported.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiExportedMixin extends ApiItem {\n /**\n * Whether the declaration is exported from its parent item container (i.e. either an `ApiEntryPoint` or an\n * `ApiNamespace`).\n *\n * @remarks\n * Suppose `index.ts` is your entry point:\n *\n * ```ts\n * // index.ts\n *\n * export class A {}\n * class B {}\n *\n * namespace n {\n * export class C {}\n * class D {}\n * }\n *\n * // file.ts\n * export class E {}\n * ```\n *\n * Classes `A` and `C` are both exported, while classes `B`, `D`, and `E` are not. `E` is exported from its\n * local file, but not from its parent item container (i.e. the entry point).\n *\n */\n readonly isExported: boolean;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiExportedMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiExportedMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiExportedMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiExportedMixin) {\n class MixedClass extends baseClass implements ApiExportedMixin {\n public [_isExported]: boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiExportedMixinOptions = args[0];\n this[_isExported] = options.isExported;\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiExportedMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiExportedMixinJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n const declarationReference: DeclarationReference = DeclarationReference.parse(\n jsonObject.canonicalReference\n );\n options.isExported = declarationReference.navigation === Navigation.Exports;\n }\n\n public get isExported(): boolean {\n return this[_isExported];\n }\n\n /**\n * The `isExported` property is intentionally not serialized because the information is already present\n * in the item's `canonicalReference`.\n * @override\n */\n public serializeInto(jsonObject: Partial<IApiExportedMixinJson>): void {\n super.serializeInto(jsonObject);\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiExportedMixin:interface)}.\n * @public\n */\nexport namespace ApiExportedMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiExportedMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiExportedMixin {\n return apiItem.hasOwnProperty(_isExported);\n }\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-redeclare */
|
|
4
|
+
import { InternalError } from '@rushstack/node-core-library';
|
|
5
|
+
import { ApiDeclaredItem } from '../items/ApiDeclaredItem';
|
|
6
|
+
const _initializerExcerpt = Symbol('ApiInitializerMixin._initializerExcerpt');
|
|
7
|
+
/**
|
|
8
|
+
* Mixin function for {@link (ApiInitializerMixin:interface)}.
|
|
9
|
+
*
|
|
10
|
+
* @param baseClass - The base class to be extended
|
|
11
|
+
* @returns A child class that extends baseClass, adding the {@link (ApiInitializerMixin:interface)} functionality.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export function ApiInitializerMixin(baseClass
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
) {
|
|
18
|
+
class MixedClass extends baseClass {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
constructor(...args) {
|
|
21
|
+
super(...args);
|
|
22
|
+
const options = args[0];
|
|
23
|
+
if (this instanceof ApiDeclaredItem) {
|
|
24
|
+
if (options.initializerTokenRange) {
|
|
25
|
+
this[_initializerExcerpt] = this.buildExcerpt(options.initializerTokenRange);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new InternalError('ApiInitializerMixin expects a base class that inherits from ApiDeclaredItem');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** @override */
|
|
33
|
+
static onDeserializeInto(options, context, jsonObject) {
|
|
34
|
+
baseClass.onDeserializeInto(options, context, jsonObject);
|
|
35
|
+
options.initializerTokenRange = jsonObject.initializerTokenRange;
|
|
36
|
+
}
|
|
37
|
+
get initializerExcerpt() {
|
|
38
|
+
return this[_initializerExcerpt];
|
|
39
|
+
}
|
|
40
|
+
/** @override */
|
|
41
|
+
serializeInto(jsonObject) {
|
|
42
|
+
super.serializeInto(jsonObject);
|
|
43
|
+
// Note that JSON does not support the "undefined" value, so we simply omit the field entirely if it is undefined
|
|
44
|
+
if (this.initializerExcerpt) {
|
|
45
|
+
jsonObject.initializerTokenRange = this.initializerExcerpt.tokenRange;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return MixedClass;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Static members for {@link (ApiInitializerMixin:interface)}.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
(function (ApiInitializerMixin) {
|
|
56
|
+
/**
|
|
57
|
+
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiInitializerMixin` mixin.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
*
|
|
61
|
+
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
|
|
62
|
+
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
|
|
63
|
+
* the TypeScript type system cannot invoke a runtime test.)
|
|
64
|
+
*/
|
|
65
|
+
function isBaseClassOf(apiItem) {
|
|
66
|
+
return apiItem.hasOwnProperty(_initializerExcerpt);
|
|
67
|
+
}
|
|
68
|
+
ApiInitializerMixin.isBaseClassOf = isBaseClassOf;
|
|
69
|
+
})(ApiInitializerMixin || (ApiInitializerMixin = {}));
|
|
70
|
+
//# sourceMappingURL=ApiInitializerMixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiInitializerMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiInitializerMixin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAI7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAe3D,MAAM,mBAAmB,GAAkB,MAAM,CAAC,yCAAyC,CAAC,CAAC;AA4B7F;;;;;;;G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c,CAAC,mBAAmB,CAAC,CAAC;IACrD,CAAC;IAFe,iCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,mBAAmB,KAAnB,mBAAmB,QAanC","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/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport type { IExcerptTokenRange, Excerpt } from './Excerpt';\nimport { ApiDeclaredItem } from '../items/ApiDeclaredItem';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Constructor options for {@link (IApiInitializerMixinOptions:interface)}.\n * @public\n */\nexport interface IApiInitializerMixinOptions extends IApiItemOptions {\n initializerTokenRange?: IExcerptTokenRange;\n}\n\nexport interface IApiInitializerMixinJson extends IApiItemJson {\n initializerTokenRange?: IExcerptTokenRange;\n}\n\nconst _initializerExcerpt: unique symbol = Symbol('ApiInitializerMixin._initializerExcerpt');\n\n/**\n * The mixin base class for API items that can have an initializer.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiInitializerMixin extends ApiItem {\n /**\n * An {@link Excerpt} that describes the item's initializer.\n */\n readonly initializerExcerpt?: Excerpt;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiInitializerMixinJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiInitializerMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiInitializerMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiInitializerMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiInitializerMixin) {\n class MixedClass extends baseClass implements ApiInitializerMixin {\n public [_initializerExcerpt]?: Excerpt;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiInitializerMixinOptions = args[0];\n\n if (this instanceof ApiDeclaredItem) {\n if (options.initializerTokenRange) {\n this[_initializerExcerpt] = this.buildExcerpt(options.initializerTokenRange);\n }\n } else {\n throw new InternalError(\n 'ApiInitializerMixin expects a base class that inherits from ApiDeclaredItem'\n );\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiInitializerMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiInitializerMixinJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.initializerTokenRange = jsonObject.initializerTokenRange;\n }\n\n public get initializerExcerpt(): Excerpt | undefined {\n return this[_initializerExcerpt];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiInitializerMixinJson>): void {\n super.serializeInto(jsonObject);\n\n // Note that JSON does not support the \"undefined\" value, so we simply omit the field entirely if it is undefined\n if (this.initializerExcerpt) {\n jsonObject.initializerTokenRange = this.initializerExcerpt.tokenRange;\n }\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiInitializerMixin:interface)}.\n * @public\n */\nexport namespace ApiInitializerMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiInitializerMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiInitializerMixin {\n return apiItem.hasOwnProperty(_initializerExcerpt);\n }\n}\n"]}
|