Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
linkText: 'Home',
urlDestination: '/api',
}),
);
for (const hierarchyItem of apiItem.getHierarchy()) {
switch (hierarchyItem.kind) {
case ApiItemKind.Model:
case ApiItemKind.EntryPoint:
// We don't show the model as part of the breadcrumb because it is the root-level container.
// We don't show the entry point because today API Extractor doesn't support multiple entry points;
// this may change in the future.
break;
default:
output.appendNodesInParagraph([
new DocPlainText({
configuration: this._tsdocConfiguration,
text: ' > ',
}),
new DocLinkTag({
configuration: this._tsdocConfiguration,
tagName: '@link',
linkText: hierarchyItem.displayName,
urlDestination: this._getLinkFilenameForApiItem(hierarchyItem),
}),
]);
}
}
}
// Constructors always do pretty much the same thing, so it's annoying to require people to write
// descriptions for them. Instead, if the constructor lacks a TSDoc summary, then API Extractor
// will auto-generate one.
const configuration: tsdoc.TSDocConfiguration = AedocDefinitions.tsdocConfiguration;
if (docComment === undefined) {
docComment = new tsdoc.DocComment({ configuration });
}
if (!tsdoc.PlainTextEmitter.hasAnyTextContent(docComment.summarySection)) {
docComment.summarySection.appendNodesInParagraph([
new tsdoc.DocPlainText({ configuration, text: 'Constructs a new instance of the ' }),
new tsdoc.DocCodeSpan({
configuration,
code: parentApiItem.displayName
}),
new tsdoc.DocPlainText({ configuration, text: ' class' })
]);
}
apiConstructor = new ApiConstructor({ docComment, releaseTag, isStatic, parameters, overloadIndex,
excerptTokens });
parentApiItem.addMember(apiConstructor);
}
}
private _createDescriptionCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (ApiReleaseTagMixin.isBaseClassOf(apiItem)) {
if (apiItem.releaseTag === ReleaseTag.Beta) {
section.appendNodesInParagraph([
new DocEmphasisSpan({ configuration, bold: true, italic: true }, [
new DocPlainText({ configuration, text: '(BETA)' }),
]),
new DocPlainText({ configuration, text: ' ' }),
]);
}
}
if (apiItem instanceof ApiDocumentedItem) {
if (apiItem.tsdocComment !== undefined) {
this._appendAndMergeSection(section, apiItem.tsdocComment.summarySection);
}
}
return new DocTableCell({ configuration }, section.nodes);
}
private _writeBetaWarning(output: DocSection): void {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const betaWarning: string = 'This API is provided as a preview for developers and may change'
+ ' based on feedback that we receive. Do not use this API in a production environment.';
output.appendNode(
new DocNoteBox({ configuration }, [
new DocParagraph({ configuration }, [
new DocPlainText({ configuration, text: betaWarning })
])
])
);
}
})
});
}
classMetadata.tsdocComment.remarksBlock.content.appendNode(
new tsdoc.DocParagraph({ configuration }, [
new tsdoc.DocPlainText({
configuration,
text: `The constructor for this class is marked as internal. Third-party code should not`
+ ` call the constructor directly or create subclasses that extend the `
}),
new tsdoc.DocCodeSpan({
configuration,
code: classDeclaration.astSymbol.localName
}),
new tsdoc.DocPlainText({ configuration, text: ' class.' })
])
);
}
return;
}
if (astDeclaration.declaration.kind === ts.SyntaxKind.SetAccessor) {
if (metadata.tsdocComment) {
this._collector.messageRouter.addAnalyzerIssue(ExtractorMessageId.SetterWithDocs,
`The doc comment for the property "${astDeclaration.astSymbol.localName}"`
+ ` must appear on the getter, not the setter.`,
astDeclaration);
}
return;
}
new DocTableCell({configuration}, parameterDescription.nodes)
])
);
}
if (parametersTable.rows.length > 0) {
output.appendNode(new DocHeading({ configuration: this._tsdocConfiguration, title: 'Parameters' }));
output.appendNode(parametersTable);
}
if (ApiReturnTypeMixin.isBaseClassOf(apiParameterListMixin)) {
const returnTypeExcerpt: Excerpt = apiParameterListMixin.returnTypeExcerpt;
output.appendNode(
new DocParagraph({ configuration }, [
new DocEmphasisSpan({ configuration, bold: true}, [
new DocPlainText({ configuration, text: 'Returns:' })
])
])
);
output.appendNode(
new DocParagraph({ configuration }, [
new DocCodeSpan({ configuration, code: returnTypeExcerpt.text.trim() || '(not declared)' })
])
);
if (apiParameterListMixin instanceof ApiDocumentedItem) {
if (apiParameterListMixin.tsdocComment && apiParameterListMixin.tsdocComment.returnsBlock) {
this._appendSection(output, apiParameterListMixin.tsdocComment.returnsBlock.content);
}
}
}
private _createDescriptionCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (ApiReleaseTagMixin.isBaseClassOf(apiItem)) {
if (apiItem.releaseTag === ReleaseTag.Beta) {
section.appendNodesInParagraph([
new DocEmphasisSpan({ configuration, bold: true, italic: true }, [
new DocPlainText({ configuration, text: '(BETA)' })
]),
new DocPlainText({ configuration, text: ' ' })
]);
}
}
if (apiItem instanceof ApiDocumentedItem) {
if (apiItem.tsdocComment !== undefined) {
this._appendAndMergeSection(section, apiItem.tsdocComment.summarySection);
}
}
return new DocTableCell({ configuration }, section.nodes);
}
public addPlainTextCell(cellContent: string): DocTableCell {
const cell: DocTableCell = this.createAndAddCell();
cell.content.appendNodeInParagraph(new DocPlainText({
configuration: this.configuration,
text: cellContent
}));
return cell;
}
private _writeEnumTables(output: DocSection, apiEnum: ApiEnum): void {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const enumMembersTable: DocTable = new DocTable({
configuration,
headerTitles: ['Member', 'Value', 'Description'],
});
for (const apiEnumMember of apiEnum.members) {
enumMembersTable.addRow(
new DocTableRow({ configuration }, [
new DocTableCell({ configuration }, [
new DocParagraph({ configuration }, [
new DocPlainText({ configuration, text: Utilities.getConciseSignature(apiEnumMember) }),
]),
]),
new DocTableCell({ configuration }, [
new DocParagraph({ configuration }, [
new DocCodeSpan({ configuration, code: apiEnumMember.initializerExcerpt.text }),
]),
]),
this._createDescriptionCell(apiEnumMember),
]),
);
}
if (enumMembersTable.rows.length > 0) {
output.appendNode(