Commit 107cdd2d authored by DatHV's avatar DatHV
Browse files

update build x-app-sdk

parent 9bb8aadd
Pipeline #2082 failed with stages
in 0 seconds
"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.DeserializerContext = exports.ApiJsonSchemaVersion = void 0;
var ApiJsonSchemaVersion;
(function (ApiJsonSchemaVersion) {
/**
* The initial release.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1000"] = 1000] = "V_1000";
/**
* Add support for type parameters and type alias types.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1001"] = 1001] = "V_1001";
/**
* Remove `canonicalReference` field. This field was for diagnostic purposes only and was never deserialized.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1002"] = 1002] = "V_1002";
/**
* Reintroduce the `canonicalReference` field using the experimental new TSDoc declaration reference notation.
*
* This is not a breaking change because this field is never deserialized; it is provided for informational
* purposes only.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1003"] = 1003] = "V_1003";
/**
* Add a `tsdocConfig` field that tracks the TSDoc configuration for parsing doc comments.
*
* This is not a breaking change because an older implementation will still work correctly. The
* custom tags will be skipped over by the parser.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1004"] = 1004] = "V_1004";
/**
* Add an `isOptional` field to `Parameter` and `TypeParameter` to track whether a function parameter is optional.
*
* When loading older JSON files, the value defaults to `false`.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1005"] = 1005] = "V_1005";
/**
* Add an `isProtected` field to `ApiConstructor`, `ApiMethod`, and `ApiProperty` to
* track whether a class member has the `protected` modifier.
*
* Add an `isReadonly` field to `ApiProperty`, `ApiPropertySignature`, and `ApiVariable` to
* track whether the item is readonly.
*
* When loading older JSON files, the values default to `false`.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1006"] = 1006] = "V_1006";
/**
* Add `ApiItemContainerMixin.preserveMemberOrder` to support enums that preserve their original sort order.
*
* When loading older JSON files, the value default to `false`.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1007"] = 1007] = "V_1007";
/**
* Add an `initializerTokenRange` field to `ApiProperty` and `ApiVariable` to track the item's
* initializer.
*
* When loading older JSON files, this range is empty.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1008"] = 1008] = "V_1008";
/**
* Add an `isReadonly` field to `ApiIndexSignature` to track whether the item is readonly.
*
* When loading older JSON files, the values defaults to `false`.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1009"] = 1009] = "V_1009";
/**
* Add a `fileUrlPath` field to `ApiDeclaredItem` to track the URL to a declared item's source file.
*
* When loading older JSON files, the value defaults to `undefined`.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1010"] = 1010] = "V_1010";
/**
* Add an `isAbstract` field to `ApiClass`, `ApiMethod`, and `ApiProperty` to
* track whether the item is abstract.
*
* When loading older JSON files, the value defaults to `false`.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1011"] = 1011] = "V_1011";
/**
* The current latest .api.json schema version.
*
* IMPORTANT: When incrementing this number, consider whether `OLDEST_SUPPORTED` or `OLDEST_FORWARDS_COMPATIBLE`
* should be updated.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["LATEST"] = 1011] = "LATEST";
/**
* The oldest .api.json schema version that is still supported for backwards compatibility.
*
* This must be updated if you change to the file format and do not implement compatibility logic for
* deserializing the older representation.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["OLDEST_SUPPORTED"] = 1001] = "OLDEST_SUPPORTED";
/**
* Used to assign `IApiPackageMetadataJson.oldestForwardsCompatibleVersion`.
*
* This value must be \<= `ApiJsonSchemaVersion.LATEST`. It must be reset to the `LATEST` value
* if the older library would not be able to deserialize your new file format. Adding a nonessential field
* is generally okay. Removing, modifying, or reinterpreting existing fields is NOT safe.
*/
ApiJsonSchemaVersion[ApiJsonSchemaVersion["OLDEST_FORWARDS_COMPATIBLE"] = 1001] = "OLDEST_FORWARDS_COMPATIBLE";
})(ApiJsonSchemaVersion || (exports.ApiJsonSchemaVersion = ApiJsonSchemaVersion = {}));
class DeserializerContext {
constructor(options) {
this.apiJsonFilename = options.apiJsonFilename;
this.toolPackage = options.toolPackage;
this.toolVersion = options.toolVersion;
this.versionToDeserialize = options.versionToDeserialize;
this.tsdocConfiguration = options.tsdocConfiguration;
}
}
exports.DeserializerContext = DeserializerContext;
//# sourceMappingURL=DeserializerContext.js.map
\ No newline at end of file
{"version":3,"file":"DeserializerContext.js","sourceRoot":"","sources":["../../src/model/DeserializerContext.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,IAAY,oBA+GX;AA/GD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,sEAAa,CAAA;IAEb;;OAEG;IACH,sEAAa,CAAA;IAEb;;OAEG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;;;;;OAQG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAe,CAAA;IAEf;;;;;OAKG;IACH,0FAAyB,CAAA;IAEzB;;;;;;OAMG;IACH,8GAAmC,CAAA;AACrC,CAAC,EA/GW,oBAAoB,oCAApB,oBAAoB,QA+G/B;AAED,MAAa,mBAAmB;IA0B9B,YAAmB,OAA4B;QAC7C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IACvD,CAAC;CACF;AAjCD,kDAiCC","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 { TSDocConfiguration } from '@microsoft/tsdoc';\n\nexport enum ApiJsonSchemaVersion {\n /**\n * The initial release.\n */\n V_1000 = 1000,\n\n /**\n * Add support for type parameters and type alias types.\n */\n V_1001 = 1001,\n\n /**\n * Remove `canonicalReference` field. This field was for diagnostic purposes only and was never deserialized.\n */\n V_1002 = 1002,\n\n /**\n * Reintroduce the `canonicalReference` field using the experimental new TSDoc declaration reference notation.\n *\n * This is not a breaking change because this field is never deserialized; it is provided for informational\n * purposes only.\n */\n V_1003 = 1003,\n\n /**\n * Add a `tsdocConfig` field that tracks the TSDoc configuration for parsing doc comments.\n *\n * This is not a breaking change because an older implementation will still work correctly. The\n * custom tags will be skipped over by the parser.\n */\n V_1004 = 1004,\n\n /**\n * Add an `isOptional` field to `Parameter` and `TypeParameter` to track whether a function parameter is optional.\n *\n * When loading older JSON files, the value defaults to `false`.\n */\n V_1005 = 1005,\n\n /**\n * Add an `isProtected` field to `ApiConstructor`, `ApiMethod`, and `ApiProperty` to\n * track whether a class member has the `protected` modifier.\n *\n * Add an `isReadonly` field to `ApiProperty`, `ApiPropertySignature`, and `ApiVariable` to\n * track whether the item is readonly.\n *\n * When loading older JSON files, the values default to `false`.\n */\n V_1006 = 1006,\n\n /**\n * Add `ApiItemContainerMixin.preserveMemberOrder` to support enums that preserve their original sort order.\n *\n * When loading older JSON files, the value default to `false`.\n */\n V_1007 = 1007,\n\n /**\n * Add an `initializerTokenRange` field to `ApiProperty` and `ApiVariable` to track the item's\n * initializer.\n *\n * When loading older JSON files, this range is empty.\n */\n V_1008 = 1008,\n\n /**\n * Add an `isReadonly` field to `ApiIndexSignature` to track whether the item is readonly.\n *\n * When loading older JSON files, the values defaults to `false`.\n */\n V_1009 = 1009,\n\n /**\n * Add a `fileUrlPath` field to `ApiDeclaredItem` to track the URL to a declared item's source file.\n *\n * When loading older JSON files, the value defaults to `undefined`.\n */\n V_1010 = 1010,\n\n /**\n * Add an `isAbstract` field to `ApiClass`, `ApiMethod`, and `ApiProperty` to\n * track whether the item is abstract.\n *\n * When loading older JSON files, the value defaults to `false`.\n */\n V_1011 = 1011,\n\n /**\n * The current latest .api.json schema version.\n *\n * IMPORTANT: When incrementing this number, consider whether `OLDEST_SUPPORTED` or `OLDEST_FORWARDS_COMPATIBLE`\n * should be updated.\n */\n LATEST = V_1011,\n\n /**\n * The oldest .api.json schema version that is still supported for backwards compatibility.\n *\n * This must be updated if you change to the file format and do not implement compatibility logic for\n * deserializing the older representation.\n */\n OLDEST_SUPPORTED = V_1001,\n\n /**\n * Used to assign `IApiPackageMetadataJson.oldestForwardsCompatibleVersion`.\n *\n * This value must be \\<= `ApiJsonSchemaVersion.LATEST`. It must be reset to the `LATEST` value\n * if the older library would not be able to deserialize your new file format. Adding a nonessential field\n * is generally okay. Removing, modifying, or reinterpreting existing fields is NOT safe.\n */\n OLDEST_FORWARDS_COMPATIBLE = V_1001\n}\n\nexport class DeserializerContext {\n /**\n * The path of the file being deserialized, which may be useful for diagnostic purposes.\n */\n public readonly apiJsonFilename: string;\n\n /**\n * Metadata from `IApiPackageMetadataJson.toolPackage`.\n */\n public readonly toolPackage: string;\n\n /**\n * Metadata from `IApiPackageMetadataJson.toolVersion`.\n */\n public readonly toolVersion: string;\n\n /**\n * The version of the schema being deserialized, as obtained from `IApiPackageMetadataJson.schemaVersion`.\n */\n public readonly versionToDeserialize: ApiJsonSchemaVersion;\n\n /**\n * The TSDoc configuration for the context.\n */\n public readonly tsdocConfiguration: TSDocConfiguration;\n\n public constructor(options: DeserializerContext) {\n this.apiJsonFilename = options.apiJsonFilename;\n this.toolPackage = options.toolPackage;\n this.toolVersion = options.toolVersion;\n this.versionToDeserialize = options.versionToDeserialize;\n this.tsdocConfiguration = options.tsdocConfiguration;\n }\n}\n"]}
\ No newline at end of file
import type { Excerpt } from '../mixins/Excerpt';
/**
* Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class
* or interface.
*
* @remarks
*
* For example, consider this declaration:
*
* ```ts
* export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {
* // . . .
* }
* ```
*
* The heritage types are `Controls.WidgetBase`, `Controls.IWidget`, and `IDisposable`.
* @public
*/
export declare class HeritageType {
/**
* An excerpt corresponding to the referenced type.
* @remarks
*
* For example, consider this declaration:
*
* ```ts
* export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {
* // . . .
* }
* ```
*
* The excerpt might be `Controls.WidgetBase`, `Controls.IWidget`, or `IDisposable`.
*/
readonly excerpt: Excerpt;
constructor(excerpt: Excerpt);
}
//# sourceMappingURL=HeritageType.d.ts.map
\ No newline at end of file
{"version":3,"file":"HeritageType.d.ts","sourceRoot":"","sources":["../../src/model/HeritageType.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,YAAY;IACvB;;;;;;;;;;;;;OAaG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,OAAO;CAGpC"}
\ No newline at end of file
"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.HeritageType = void 0;
/**
* Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class
* or interface.
*
* @remarks
*
* For example, consider this declaration:
*
* ```ts
* export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {
* // . . .
* }
* ```
*
* The heritage types are `Controls.WidgetBase`, `Controls.IWidget`, and `IDisposable`.
* @public
*/
class HeritageType {
constructor(excerpt) {
this.excerpt = excerpt;
}
}
exports.HeritageType = HeritageType;
//# sourceMappingURL=HeritageType.js.map
\ No newline at end of file
{"version":3,"file":"HeritageType.js","sourceRoot":"","sources":["../../src/model/HeritageType.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,YAAY;IAiBvB,YAAmB,OAAgB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AApBD,oCAoBC","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 } from '../mixins/Excerpt';\n\n/**\n * Represents a type referenced via an \"extends\" or \"implements\" heritage clause for a TypeScript class\n * or interface.\n *\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The heritage types are `Controls.WidgetBase`, `Controls.IWidget`, and `IDisposable`.\n * @public\n */\nexport class HeritageType {\n /**\n * An excerpt corresponding to the referenced type.\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The excerpt might be `Controls.WidgetBase`, `Controls.IWidget`, or `IDisposable`.\n */\n public readonly excerpt: Excerpt;\n\n public constructor(excerpt: Excerpt) {\n this.excerpt = excerpt;\n }\n}\n"]}
\ No newline at end of file
import { type DocDeclarationReference } from '@microsoft/tsdoc';
import { type ApiItem } from '../items/ApiItem';
import type { ApiModel } from './ApiModel';
/**
* Result object for {@link ApiModel.resolveDeclarationReference}.
*
* @public
*/
export interface IResolveDeclarationReferenceResult {
/**
* The referenced ApiItem, if the declaration reference could be resolved.
*/
resolvedApiItem: ApiItem | undefined;
/**
* If resolvedApiItem is undefined, then this will always contain an error message explaining why the
* resolution failed.
*/
errorMessage: string | undefined;
}
/**
* This resolves a TSDoc declaration reference by walking the `ApiModel` hierarchy.
*
* @remarks
*
* This class is analogous to `AstReferenceResolver` from the `@microsoft/api-extractor` project,
* which resolves declaration references by walking the compiler state.
*/
export declare class ModelReferenceResolver {
private readonly _apiModel;
constructor(apiModel: ApiModel);
resolve(declarationReference: DocDeclarationReference, contextApiItem: ApiItem | undefined): IResolveDeclarationReferenceResult;
private _selectUsingSystemSelector;
private _selectUsingIndexSelector;
}
//# sourceMappingURL=ModelReferenceResolver.d.ts.map
\ No newline at end of file
{"version":3,"file":"ModelReferenceResolver.d.ts","sourceRoot":"","sources":["../../src/model/ModelReferenceResolver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,uBAAuB,EAAwC,MAAM,kBAAkB,CAAC;AAEtG,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM3C;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IACjD;;OAEG;IACH,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;gBAElB,QAAQ,EAAE,QAAQ;IAI9B,OAAO,CACZ,oBAAoB,EAAE,uBAAuB,EAC7C,cAAc,EAAE,OAAO,GAAG,SAAS,GAClC,kCAAkC;IAiGrC,OAAO,CAAC,0BAA0B;IAsDlC,OAAO,CAAC,yBAAyB;CAoClC"}
\ No newline at end of file
"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.ModelReferenceResolver = void 0;
const tsdoc_1 = require("@microsoft/tsdoc");
const ApiItem_1 = require("../items/ApiItem");
const ApiItemContainerMixin_1 = require("../mixins/ApiItemContainerMixin");
const ApiParameterListMixin_1 = require("../mixins/ApiParameterListMixin");
/**
* This resolves a TSDoc declaration reference by walking the `ApiModel` hierarchy.
*
* @remarks
*
* This class is analogous to `AstReferenceResolver` from the `@microsoft/api-extractor` project,
* which resolves declaration references by walking the compiler state.
*/
class ModelReferenceResolver {
constructor(apiModel) {
this._apiModel = apiModel;
}
resolve(declarationReference, contextApiItem) {
const result = {
resolvedApiItem: undefined,
errorMessage: undefined
};
let apiPackage = undefined;
// Is this an absolute reference?
if (declarationReference.packageName !== undefined) {
apiPackage = this._apiModel.tryGetPackageByName(declarationReference.packageName);
if (apiPackage === undefined) {
result.errorMessage = `The package "${declarationReference.packageName}" could not be located`;
return result;
}
}
else {
// If the package name is omitted, try to infer it from the context
if (contextApiItem !== undefined) {
apiPackage = contextApiItem.getAssociatedPackage();
}
if (apiPackage === undefined) {
result.errorMessage =
`The reference does not include a package name, and the package could not be inferred` +
` from the context`;
return result;
}
}
const importPath = declarationReference.importPath || '';
const foundEntryPoints = apiPackage.findEntryPointsByPath(importPath);
if (foundEntryPoints.length !== 1) {
result.errorMessage = `The import path "${importPath}" could not be resolved`;
return result;
}
let currentItem = foundEntryPoints[0];
// Now search for the member reference
for (const memberReference of declarationReference.memberReferences) {
if (memberReference.memberSymbol !== undefined) {
result.errorMessage = `Symbols are not yet supported in declaration references`;
return result;
}
if (memberReference.memberIdentifier === undefined) {
result.errorMessage = `Missing member identifier`;
return result;
}
const identifier = memberReference.memberIdentifier.identifier;
if (!ApiItemContainerMixin_1.ApiItemContainerMixin.isBaseClassOf(currentItem)) {
// For example, {@link MyClass.myMethod.X} is invalid because methods cannot contain members
result.errorMessage = `Unable to resolve ${JSON.stringify(identifier)} because ${currentItem.getScopedNameWithinPackage()} cannot act as a container`;
return result;
}
const foundMembers = currentItem.findMembersByName(identifier);
if (foundMembers.length === 0) {
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was not found`;
return result;
}
const memberSelector = memberReference.selector;
if (memberSelector === undefined) {
if (foundMembers.length > 1) {
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;
return result;
}
currentItem = foundMembers[0];
}
else {
let memberSelectorResult;
switch (memberSelector.selectorKind) {
case tsdoc_1.SelectorKind.System:
memberSelectorResult = this._selectUsingSystemSelector(foundMembers, memberSelector, identifier);
break;
case tsdoc_1.SelectorKind.Index:
memberSelectorResult = this._selectUsingIndexSelector(foundMembers, memberSelector, identifier);
break;
default:
result.errorMessage = `The selector "${memberSelector.selector}" is not a supported selector type`;
return result;
}
if (memberSelectorResult.resolvedApiItem === undefined) {
return memberSelectorResult;
}
currentItem = memberSelectorResult.resolvedApiItem;
}
}
result.resolvedApiItem = currentItem;
return result;
}
_selectUsingSystemSelector(foundMembers, memberSelector, identifier) {
const result = {
resolvedApiItem: undefined,
errorMessage: undefined
};
const selectorName = memberSelector.selector;
let selectorItemKind;
switch (selectorName) {
case 'class':
selectorItemKind = ApiItem_1.ApiItemKind.Class;
break;
case 'enum':
selectorItemKind = ApiItem_1.ApiItemKind.Enum;
break;
case 'function':
selectorItemKind = ApiItem_1.ApiItemKind.Function;
break;
case 'interface':
selectorItemKind = ApiItem_1.ApiItemKind.Interface;
break;
case 'namespace':
selectorItemKind = ApiItem_1.ApiItemKind.Namespace;
break;
case 'type':
selectorItemKind = ApiItem_1.ApiItemKind.TypeAlias;
break;
case 'variable':
selectorItemKind = ApiItem_1.ApiItemKind.Variable;
break;
default:
result.errorMessage = `Unsupported system selector "${selectorName}"`;
return result;
}
const matches = foundMembers.filter((x) => x.kind === selectorItemKind);
if (matches.length === 0) {
result.errorMessage =
`A declaration for "${identifier}" was not found that matches the` +
` TSDoc selector "${selectorName}"`;
return result;
}
if (matches.length > 1) {
result.errorMessage = `More than one declaration "${identifier}" matches the TSDoc selector "${selectorName}"`;
}
result.resolvedApiItem = matches[0];
return result;
}
_selectUsingIndexSelector(foundMembers, memberSelector, identifier) {
const result = {
resolvedApiItem: undefined,
errorMessage: undefined
};
const selectedMembers = [];
const selectorOverloadIndex = parseInt(memberSelector.selector, 10);
for (const foundMember of foundMembers) {
if (ApiParameterListMixin_1.ApiParameterListMixin.isBaseClassOf(foundMember)) {
if (foundMember.overloadIndex === selectorOverloadIndex) {
selectedMembers.push(foundMember);
}
}
}
if (selectedMembers.length === 0) {
result.errorMessage =
`An overload for ${JSON.stringify(identifier)} was not found that matches` +
` the TSDoc selector ":${selectorOverloadIndex}"`;
return result;
}
if (selectedMembers.length === 1) {
result.resolvedApiItem = selectedMembers[0];
return result;
}
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;
return result;
}
}
exports.ModelReferenceResolver = ModelReferenceResolver;
//# sourceMappingURL=ModelReferenceResolver.js.map
\ No newline at end of file
{"version":3,"file":"ModelReferenceResolver.js","sourceRoot":"","sources":["../../src/model/ModelReferenceResolver.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,4CAAsG;AAEtG,8CAA6D;AAI7D,2EAAwE;AACxE,2EAAwE;AAoBxE;;;;;;;GAOG;AACH,MAAa,sBAAsB;IAGjC,YAAmB,QAAkB;QACnC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,OAAO,CACZ,oBAA6C,EAC7C,cAAmC;QAEnC,MAAM,MAAM,GAAuC;YACjD,eAAe,EAAE,SAAS;YAC1B,YAAY,EAAE,SAAS;SACxB,CAAC;QAEF,IAAI,UAAU,GAA2B,SAAS,CAAC;QAEnD,iCAAiC;QACjC,IAAI,oBAAoB,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACnD,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;YAClF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,MAAM,CAAC,YAAY,GAAG,gBAAgB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AAC;YAC5C,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,CAAC,YAAY,GAAG,wBAAwB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,gBAAgB,CAAC;QACzF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArMD,wDAqMC","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 DocDeclarationReference, type DocMemberSelector, SelectorKind } from '@microsoft/tsdoc';\n\nimport { type ApiItem, ApiItemKind } from '../items/ApiItem';\nimport type { ApiModel } from './ApiModel';\nimport type { ApiPackage } from './ApiPackage';\nimport type { ApiEntryPoint } from './ApiEntryPoint';\nimport { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';\nimport { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\n\n/**\n * Result object for {@link ApiModel.resolveDeclarationReference}.\n *\n * @public\n */\nexport interface IResolveDeclarationReferenceResult {\n /**\n * The referenced ApiItem, if the declaration reference could be resolved.\n */\n resolvedApiItem: ApiItem | undefined;\n\n /**\n * If resolvedApiItem is undefined, then this will always contain an error message explaining why the\n * resolution failed.\n */\n errorMessage: string | undefined;\n}\n\n/**\n * This resolves a TSDoc declaration reference by walking the `ApiModel` hierarchy.\n *\n * @remarks\n *\n * This class is analogous to `AstReferenceResolver` from the `@microsoft/api-extractor` project,\n * which resolves declaration references by walking the compiler state.\n */\nexport class ModelReferenceResolver {\n private readonly _apiModel: ApiModel;\n\n public constructor(apiModel: ApiModel) {\n this._apiModel = apiModel;\n }\n\n public resolve(\n declarationReference: DocDeclarationReference,\n contextApiItem: ApiItem | undefined\n ): IResolveDeclarationReferenceResult {\n const result: IResolveDeclarationReferenceResult = {\n resolvedApiItem: undefined,\n errorMessage: undefined\n };\n\n let apiPackage: ApiPackage | undefined = undefined;\n\n // Is this an absolute reference?\n if (declarationReference.packageName !== undefined) {\n apiPackage = this._apiModel.tryGetPackageByName(declarationReference.packageName);\n if (apiPackage === undefined) {\n result.errorMessage = `The package \"${declarationReference.packageName}\" could not be located`;\n return result;\n }\n } else {\n // If the package name is omitted, try to infer it from the context\n if (contextApiItem !== undefined) {\n apiPackage = contextApiItem.getAssociatedPackage();\n }\n\n if (apiPackage === undefined) {\n result.errorMessage =\n `The reference does not include a package name, and the package could not be inferred` +\n ` from the context`;\n return result;\n }\n }\n\n const importPath: string = declarationReference.importPath || '';\n\n const foundEntryPoints: ReadonlyArray<ApiEntryPoint> = apiPackage.findEntryPointsByPath(importPath);\n if (foundEntryPoints.length !== 1) {\n result.errorMessage = `The import path \"${importPath}\" could not be resolved`;\n return result;\n }\n\n let currentItem: ApiItem = foundEntryPoints[0];\n\n // Now search for the member reference\n for (const memberReference of declarationReference.memberReferences) {\n if (memberReference.memberSymbol !== undefined) {\n result.errorMessage = `Symbols are not yet supported in declaration references`;\n return result;\n }\n\n if (memberReference.memberIdentifier === undefined) {\n result.errorMessage = `Missing member identifier`;\n return result;\n }\n\n const identifier: string = memberReference.memberIdentifier.identifier;\n\n if (!ApiItemContainerMixin.isBaseClassOf(currentItem)) {\n // For example, {@link MyClass.myMethod.X} is invalid because methods cannot contain members\n result.errorMessage = `Unable to resolve ${JSON.stringify(\n identifier\n )} because ${currentItem.getScopedNameWithinPackage()} cannot act as a container`;\n return result;\n }\n\n const foundMembers: ReadonlyArray<ApiItem> = currentItem.findMembersByName(identifier);\n if (foundMembers.length === 0) {\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was not found`;\n return result;\n }\n\n const memberSelector: DocMemberSelector | undefined = memberReference.selector;\n if (memberSelector === undefined) {\n if (foundMembers.length > 1) {\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\n return result;\n }\n currentItem = foundMembers[0];\n } else {\n let memberSelectorResult: IResolveDeclarationReferenceResult;\n switch (memberSelector.selectorKind) {\n case SelectorKind.System:\n memberSelectorResult = this._selectUsingSystemSelector(foundMembers, memberSelector, identifier);\n break;\n case SelectorKind.Index:\n memberSelectorResult = this._selectUsingIndexSelector(foundMembers, memberSelector, identifier);\n break;\n default:\n result.errorMessage = `The selector \"${memberSelector.selector}\" is not a supported selector type`;\n return result;\n }\n if (memberSelectorResult.resolvedApiItem === undefined) {\n return memberSelectorResult;\n }\n currentItem = memberSelectorResult.resolvedApiItem;\n }\n }\n result.resolvedApiItem = currentItem;\n return result;\n }\n\n private _selectUsingSystemSelector(\n foundMembers: ReadonlyArray<ApiItem>,\n memberSelector: DocMemberSelector,\n identifier: string\n ): IResolveDeclarationReferenceResult {\n const result: IResolveDeclarationReferenceResult = {\n resolvedApiItem: undefined,\n errorMessage: undefined\n };\n\n const selectorName: string = memberSelector.selector;\n\n let selectorItemKind: ApiItemKind;\n switch (selectorName) {\n case 'class':\n selectorItemKind = ApiItemKind.Class;\n break;\n case 'enum':\n selectorItemKind = ApiItemKind.Enum;\n break;\n case 'function':\n selectorItemKind = ApiItemKind.Function;\n break;\n case 'interface':\n selectorItemKind = ApiItemKind.Interface;\n break;\n case 'namespace':\n selectorItemKind = ApiItemKind.Namespace;\n break;\n case 'type':\n selectorItemKind = ApiItemKind.TypeAlias;\n break;\n case 'variable':\n selectorItemKind = ApiItemKind.Variable;\n break;\n default:\n result.errorMessage = `Unsupported system selector \"${selectorName}\"`;\n return result;\n }\n\n const matches: ApiItem[] = foundMembers.filter((x) => x.kind === selectorItemKind);\n if (matches.length === 0) {\n result.errorMessage =\n `A declaration for \"${identifier}\" was not found that matches the` +\n ` TSDoc selector \"${selectorName}\"`;\n return result;\n }\n if (matches.length > 1) {\n result.errorMessage = `More than one declaration \"${identifier}\" matches the TSDoc selector \"${selectorName}\"`;\n }\n result.resolvedApiItem = matches[0];\n return result;\n }\n\n private _selectUsingIndexSelector(\n foundMembers: ReadonlyArray<ApiItem>,\n memberSelector: DocMemberSelector,\n identifier: string\n ): IResolveDeclarationReferenceResult {\n const result: IResolveDeclarationReferenceResult = {\n resolvedApiItem: undefined,\n errorMessage: undefined\n };\n\n const selectedMembers: ApiItem[] = [];\n\n const selectorOverloadIndex: number = parseInt(memberSelector.selector, 10);\n for (const foundMember of foundMembers) {\n if (ApiParameterListMixin.isBaseClassOf(foundMember)) {\n if (foundMember.overloadIndex === selectorOverloadIndex) {\n selectedMembers.push(foundMember);\n }\n }\n }\n\n if (selectedMembers.length === 0) {\n result.errorMessage =\n `An overload for ${JSON.stringify(identifier)} was not found that matches` +\n ` the TSDoc selector \":${selectorOverloadIndex}\"`;\n return result;\n }\n\n if (selectedMembers.length === 1) {\n result.resolvedApiItem = selectedMembers[0];\n return result;\n }\n\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\n return result;\n }\n}\n"]}
\ No newline at end of file
import type * as tsdoc from '@microsoft/tsdoc';
import type { Excerpt } from '../mixins/Excerpt';
import type { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';
/**
* Constructor options for {@link Parameter}.
* @public
*/
export interface IParameterOptions {
name: string;
parameterTypeExcerpt: Excerpt;
isOptional: boolean;
parent: ApiParameterListMixin;
}
/**
* Represents a named parameter for a function-like declaration.
*
* @remarks
*
* `Parameter` represents a TypeScript declaration such as `x: number` in this example:
*
* ```ts
* export function add(x: number, y: number): number {
* return x + y;
* }
* ```
*
* `Parameter` objects belong to the {@link (ApiParameterListMixin:interface).parameters} collection.
*
* @public
*/
export declare class Parameter {
/**
* An {@link Excerpt} that describes the type of the parameter.
*/
readonly parameterTypeExcerpt: Excerpt;
/**
* The parameter name.
*/
name: string;
/**
* Whether the parameter is optional.
*/
isOptional: boolean;
private _parent;
constructor(options: IParameterOptions);
/**
* Returns the `@param` documentation for this parameter, if present.
*/
get tsdocParamBlock(): tsdoc.DocParamBlock | undefined;
}
//# sourceMappingURL=Parameter.d.ts.map
\ No newline at end of file
{"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../src/model/Parameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAG/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,SAAgB,oBAAoB,EAAE,OAAO,CAAC;IAE9C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,UAAU,EAAE,OAAO,CAAC;IAE3B,OAAO,CAAC,OAAO,CAAwB;gBAEpB,OAAO,EAAE,iBAAiB;IAO7C;;OAEG;IACH,IAAW,eAAe,IAAI,KAAK,CAAC,aAAa,GAAG,SAAS,CAM5D;CACF"}
\ No newline at end of file
"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.Parameter = void 0;
const ApiDocumentedItem_1 = require("../items/ApiDocumentedItem");
/**
* Represents a named parameter for a function-like declaration.
*
* @remarks
*
* `Parameter` represents a TypeScript declaration such as `x: number` in this example:
*
* ```ts
* export function add(x: number, y: number): number {
* return x + y;
* }
* ```
*
* `Parameter` objects belong to the {@link (ApiParameterListMixin:interface).parameters} collection.
*
* @public
*/
class Parameter {
constructor(options) {
this.name = options.name;
this.parameterTypeExcerpt = options.parameterTypeExcerpt;
this.isOptional = options.isOptional;
this._parent = options.parent;
}
/**
* Returns the `@param` documentation for this parameter, if present.
*/
get tsdocParamBlock() {
if (this._parent instanceof ApiDocumentedItem_1.ApiDocumentedItem) {
if (this._parent.tsdocComment) {
return this._parent.tsdocComment.params.tryGetBlockByName(this.name);
}
}
}
}
exports.Parameter = Parameter;
//# sourceMappingURL=Parameter.js.map
\ No newline at end of file
{"version":3,"file":"Parameter.js","sourceRoot":"","sources":["../../src/model/Parameter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,kEAA+D;AAe/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,SAAS;IAkBpB,YAAmB,OAA0B;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACxB,IAAI,IAAI,CAAC,OAAO,YAAY,qCAAiB,EAAE,CAAC;YAC9C,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAnCD,8BAmCC","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 * as tsdoc from '@microsoft/tsdoc';\n\nimport { ApiDocumentedItem } from '../items/ApiDocumentedItem';\nimport type { Excerpt } from '../mixins/Excerpt';\nimport type { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\n\n/**\n * Constructor options for {@link Parameter}.\n * @public\n */\nexport interface IParameterOptions {\n name: string;\n parameterTypeExcerpt: Excerpt;\n isOptional: boolean;\n parent: ApiParameterListMixin;\n}\n\n/**\n * Represents a named parameter for a function-like declaration.\n *\n * @remarks\n *\n * `Parameter` represents a TypeScript declaration such as `x: number` in this example:\n *\n * ```ts\n * export function add(x: number, y: number): number {\n * return x + y;\n * }\n * ```\n *\n * `Parameter` objects belong to the {@link (ApiParameterListMixin:interface).parameters} collection.\n *\n * @public\n */\nexport class Parameter {\n /**\n * An {@link Excerpt} that describes the type of the parameter.\n */\n public readonly parameterTypeExcerpt: Excerpt;\n\n /**\n * The parameter name.\n */\n public name: string;\n\n /**\n * Whether the parameter is optional.\n */\n public isOptional: boolean;\n\n private _parent: ApiParameterListMixin;\n\n public constructor(options: IParameterOptions) {\n this.name = options.name;\n this.parameterTypeExcerpt = options.parameterTypeExcerpt;\n this.isOptional = options.isOptional;\n this._parent = options.parent;\n }\n\n /**\n * Returns the `@param` documentation for this parameter, if present.\n */\n public get tsdocParamBlock(): tsdoc.DocParamBlock | undefined {\n if (this._parent instanceof ApiDocumentedItem) {\n if (this._parent.tsdocComment) {\n return this._parent.tsdocComment.params.tryGetBlockByName(this.name);\n }\n }\n }\n}\n"]}
\ No newline at end of file
/**
* Constructor options for `SourceLocation`.
* @public
*/
export interface ISourceLocationOptions {
/**
* The project folder URL as defined by the `api-extractor.json` config `projectFolderUrl`
* setting.
*/
projectFolderUrl?: string;
/**
* The file URL path relative to the `projectFolder` and `projectFolderURL` fields as
* defined in the `api-extractor.json` config.
*/
fileUrlPath?: string;
}
/**
* The source location where a given API item is declared.
*
* @remarks
* The source location points to the `.ts` source file where the API item was originally
declared. However, in some cases, if source map resolution fails, it falls back to pointing
to the `.d.ts` file instead.
*
* @public
*/
export declare class SourceLocation {
private readonly _projectFolderUrl?;
private readonly _fileUrlPath?;
constructor(options: ISourceLocationOptions);
/**
* Returns the file URL to the given source location. Returns `undefined` if the file URL
* cannot be determined.
*/
get fileUrl(): string | undefined;
}
//# sourceMappingURL=SourceLocation.d.ts.map
\ No newline at end of file
{"version":3,"file":"SourceLocation.d.ts","sourceRoot":"","sources":["../../src/model/SourceLocation.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAS;gBAEpB,OAAO,EAAE,sBAAsB;IAKlD;;;OAGG;IACH,IAAW,OAAO,IAAI,MAAM,GAAG,SAAS,CAYvC;CACF"}
\ No newline at end of file
"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 = void 0;
const node_url_1 = require("node:url");
/**
* The source location where a given API item is declared.
*
* @remarks
* The source location points to the `.ts` source file where the API item was originally
declared. However, in some cases, if source map resolution fails, it falls back to pointing
to the `.d.ts` file instead.
*
* @public
*/
class SourceLocation {
constructor(options) {
this._projectFolderUrl = options.projectFolderUrl;
this._fileUrlPath = options.fileUrlPath;
}
/**
* Returns the file URL to the given source location. Returns `undefined` if the file URL
* cannot be determined.
*/
get fileUrl() {
if (this._projectFolderUrl === undefined || this._fileUrlPath === undefined) {
return undefined;
}
let projectFolderUrl = this._projectFolderUrl;
if (!projectFolderUrl.endsWith('/')) {
projectFolderUrl += '/';
}
const url = new node_url_1.URL(this._fileUrlPath, projectFolderUrl);
return url.href;
}
}
exports.SourceLocation = SourceLocation;
//# sourceMappingURL=SourceLocation.js.map
\ No newline at end of file
{"version":3,"file":"SourceLocation.js","sourceRoot":"","sources":["../../src/model/SourceLocation.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,uCAA+B;AAoB/B;;;;;;;;;GASG;AACH,MAAa,cAAc;IAIzB,YAAmB,OAA+B;QAChD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QAClD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,IAAW,OAAO;QAChB,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAC5E,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,gBAAgB,GAAW,IAAI,CAAC,iBAAiB,CAAC;QACtD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,gBAAgB,IAAI,GAAG,CAAC;QAC1B,CAAC;QAED,MAAM,GAAG,GAAQ,IAAI,cAAG,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;CACF;AA1BD,wCA0BC","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 { URL } from 'node:url';\n\n/**\n * Constructor options for `SourceLocation`.\n * @public\n */\nexport interface ISourceLocationOptions {\n /**\n * The project folder URL as defined by the `api-extractor.json` config `projectFolderUrl`\n * setting.\n */\n projectFolderUrl?: string;\n\n /**\n * The file URL path relative to the `projectFolder` and `projectFolderURL` fields as\n * defined in the `api-extractor.json` config.\n */\n fileUrlPath?: string;\n}\n\n/**\n * The source location where a given API item is declared.\n *\n * @remarks\n * The source location points to the `.ts` source file where the API item was originally\n declared. However, in some cases, if source map resolution fails, it falls back to pointing\n to the `.d.ts` file instead.\n *\n * @public\n */\nexport class SourceLocation {\n private readonly _projectFolderUrl?: string;\n private readonly _fileUrlPath?: string;\n\n public constructor(options: ISourceLocationOptions) {\n this._projectFolderUrl = options.projectFolderUrl;\n this._fileUrlPath = options.fileUrlPath;\n }\n\n /**\n * Returns the file URL to the given source location. Returns `undefined` if the file URL\n * cannot be determined.\n */\n public get fileUrl(): string | undefined {\n if (this._projectFolderUrl === undefined || this._fileUrlPath === undefined) {\n return undefined;\n }\n\n let projectFolderUrl: string = this._projectFolderUrl;\n if (!projectFolderUrl.endsWith('/')) {\n projectFolderUrl += '/';\n }\n\n const url: URL = new URL(this._fileUrlPath, projectFolderUrl);\n return url.href;\n }\n}\n"]}
\ No newline at end of file
import type * as tsdoc from '@microsoft/tsdoc';
import type { Excerpt } from '../mixins/Excerpt';
import type { ApiTypeParameterListMixin } from '../mixins/ApiTypeParameterListMixin';
/**
* Constructor options for {@link TypeParameter}.
* @public
*/
export interface ITypeParameterOptions {
name: string;
constraintExcerpt: Excerpt;
defaultTypeExcerpt: Excerpt;
isOptional: boolean;
parent: ApiTypeParameterListMixin;
}
/**
* Represents a named type parameter for a generic declaration.
*
* @remarks
*
* `TypeParameter` represents a TypeScript declaration such as `T` in this example:
*
* ```ts
* interface IIdentifier {
* getCode(): string;
* }
*
* class BarCode implements IIdentifier {
* private _value: number;
* public getCode(): string { return this._value.toString(); }
* }
*
* class Book<TIdentifier extends IIdentifier = BarCode> {
* public identifier: TIdentifier;
* }
* ```
*
* `TypeParameter` objects belong to the {@link (ApiTypeParameterListMixin:interface).typeParameters} collection.
*
* @public
*/
export declare class TypeParameter {
/**
* An {@link Excerpt} that describes the base constraint of the type parameter.
*
* @remarks
* In the example below, the `constraintExcerpt` would correspond to the `IIdentifier` subexpression:
*
* ```ts
* class Book<TIdentifier extends IIdentifier = BarCode> {
* public identifier: TIdentifier;
* }
* ```
*/
readonly constraintExcerpt: Excerpt;
/**
* An {@link Excerpt} that describes the default type of the type parameter.
*
* @remarks
* In the example below, the `defaultTypeExcerpt` would correspond to the `BarCode` subexpression:
*
* ```ts
* class Book<TIdentifier extends IIdentifier = BarCode> {
* public identifier: TIdentifier;
* }
* ```
*/
readonly defaultTypeExcerpt: Excerpt;
/**
* The parameter name.
*/
name: string;
/**
* Whether the type parameter is optional. True IFF there exists a `defaultTypeExcerpt`.
*/
isOptional: boolean;
private _parent;
constructor(options: ITypeParameterOptions);
/**
* Returns the `@typeParam` documentation for this parameter, if present.
*/
get tsdocTypeParamBlock(): tsdoc.DocParamBlock | undefined;
}
//# sourceMappingURL=TypeParameter.d.ts.map
\ No newline at end of file
{"version":3,"file":"TypeParameter.d.ts","sourceRoot":"","sources":["../../src/model/TypeParameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAG/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,yBAAyB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,aAAa;IACxB;;;;;;;;;;;OAWG;IACH,SAAgB,iBAAiB,EAAE,OAAO,CAAC;IAE3C;;;;;;;;;;;OAWG;IACH,SAAgB,kBAAkB,EAAE,OAAO,CAAC;IAE5C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,UAAU,EAAE,OAAO,CAAC;IAE3B,OAAO,CAAC,OAAO,CAA4B;gBAExB,OAAO,EAAE,qBAAqB;IAQjD;;OAEG;IACH,IAAW,mBAAmB,IAAI,KAAK,CAAC,aAAa,GAAG,SAAS,CAMhE;CACF"}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment