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;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,CAAC,CAAC;IAClE,CAAC;IAEO,qBAAqB,CAAC,YAAoB;QAChD,OAAO,CAAC,GAAG,CAAC,2BAA2B,GAAG,YAAY,CAAC,CAAC;QACxD,8BAAU,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;CACF;AAz8BD,wCAy8BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\n\nimport yaml = require('js-yaml');\nimport {\n JsonFile,\n JsonSchema,\n PackageName,\n FileSystem,\n NewlineKind,\n InternalError\n} from '@rushstack/node-core-library';\nimport {\n StringBuilder,\n type DocSection,\n type DocComment,\n type DocBlock,\n StandardTags\n} from '@microsoft/tsdoc';\nimport {\n type ApiModel,\n type ApiItem,\n ApiItemKind,\n ApiDocumentedItem,\n ApiReleaseTagMixin,\n ReleaseTag,\n type ApiPropertyItem,\n ApiItemContainerMixin,\n type ApiPackage,\n type ApiEnumMember,\n ApiClass,\n ApiInterface,\n type ApiMethod,\n type ApiMethodSignature,\n type ApiConstructor,\n type ApiFunction,\n ApiReturnTypeMixin,\n ApiTypeParameterListMixin,\n type Excerpt,\n type ExcerptToken,\n ExcerptTokenKind,\n type HeritageType,\n type ApiVariable,\n type ApiTypeAlias\n} from '@microsoft/api-extractor-model';\nimport {\n type DeclarationReference,\n Navigation,\n Meaning\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport type {\n IYamlApiFile,\n IYamlItem,\n IYamlSyntax,\n IYamlParameter,\n IYamlReference,\n IYamlReferenceSpec,\n IYamlInheritanceTree\n} from '../yaml/IYamlApiFile';\nimport type { IYamlTocFile, IYamlTocItem } from '../yaml/IYamlTocFile';\nimport { Utilities } from '../utils/Utilities';\nimport { CustomMarkdownEmitter } from '../markdown/CustomMarkdownEmitter';\nimport { convertUDPYamlToSDP } from '../utils/ToSdpConvertHelper';\nimport typescriptSchema from '../yaml/typescript.schema.json';\n\nconst yamlApiSchema: JsonSchema = JsonSchema.fromLoadedObject(typescriptSchema);\n\ninterface IYamlReferences {\n references: IYamlReference[];\n typeNameToUid: Map<string, string>;\n uidTypeReferenceCounters: Map<string, number>;\n}\n\nconst enum FlattenMode {\n /** Include entries for nested namespaces and non-namespace children. */\n NestedNamespacesAndChildren,\n /** Include entries for nested namespaces only. */\n NestedNamespacesOnly,\n /** Include entries for non-namespace immediate children. */\n ImmediateChildren,\n /** Include entries for nested non-namespace children. */\n NestedChildren\n}\n\ninterface INameOptions {\n includeSignature?: boolean;\n includeNamespace?: boolean;\n}\n\n/**\n * Writes documentation in the Universal Reference YAML file format, as defined by typescript.schema.json.\n */\nexport class YamlDocumenter {\n protected readonly newDocfxNamespaces: boolean;\n private readonly _yamlFormat: string;\n private readonly _apiModel: ApiModel;\n private readonly _markdownEmitter: CustomMarkdownEmitter;\n\n private _apiItemsByCanonicalReference: Map<string, ApiItem>;\n private _yamlReferences: IYamlReferences | undefined;\n\n public constructor(apiModel: ApiModel, newDocfxNamespaces: boolean = false, yamlFormat: string = 'sdp') {\n this._apiModel = apiModel;\n this.newDocfxNamespaces = newDocfxNamespaces;\n this._yamlFormat = yamlFormat;\n this._markdownEmitter = new CustomMarkdownEmitter(this._apiModel);\n this._apiItemsByCanonicalReference = new Map<string, ApiItem>();\n\n this._initApiItems();\n }\n\n /** @virtual */\n public generateFiles(outputFolder: string): void {\n console.log();\n this._deleteOldOutputFiles(outputFolder);\n\n for (const apiPackage of this._apiModel.packages) {\n console.log(`Writing ${apiPackage.name} package`);\n this._visitApiItems(outputFolder, apiPackage, undefined);\n }\n\n if (this._yamlFormat === 'sdp') {\n convertUDPYamlToSDP(outputFolder);\n }\n\n this._writeTocFile(outputFolder, this._apiModel.packages);\n }\n\n /** @virtual */\n protected onGetTocRoot(): IYamlTocItem {\n return {\n name: 'SharePoint Framework reference',\n href: '~/overview/sharepoint.md',\n items: []\n };\n }\n\n /** @virtual */\n protected onCustomizeYamlItem(yamlItem: IYamlItem): void {\n // virtual\n // (overridden by child class)\n }\n\n private _visitApiItems(\n outputFolder: string,\n apiItem: ApiDocumentedItem,\n parentYamlFile: IYamlApiFile | undefined\n ): boolean {\n let savedYamlReferences: IYamlReferences | undefined;\n if (!this._shouldEmbed(apiItem.kind)) {\n savedYamlReferences = this._yamlReferences;\n this._yamlReferences = undefined;\n }\n\n const yamlItem: IYamlItem | undefined = this._generateYamlItem(apiItem);\n if (!yamlItem) {\n return false;\n }\n\n this.onCustomizeYamlItem(yamlItem);\n\n if (this._shouldEmbed(apiItem.kind)) {\n if (!parentYamlFile) {\n throw new InternalError('Missing file context');\n }\n parentYamlFile.items.push(yamlItem);\n } else {\n const newYamlFile: IYamlApiFile = {\n items: []\n };\n newYamlFile.items.push(yamlItem);\n\n const children: ApiItem[] = this._getLogicalChildren(apiItem);\n for (const child of children) {\n if (child instanceof ApiDocumentedItem) {\n if (this._visitApiItems(outputFolder, child, newYamlFile)) {\n if (!yamlItem.children) {\n yamlItem.children = [];\n }\n yamlItem.children.push(this._getUid(child));\n }\n }\n }\n\n if (this._yamlReferences && this._yamlReferences.references.length > 0) {\n newYamlFile.references = this._yamlReferences.references;\n }\n\n this._yamlReferences = savedYamlReferences;\n\n const yamlFilePath: string = this._getYamlFilePath(outputFolder, apiItem);\n\n if (apiItem.kind === ApiItemKind.Package) {\n console.log('Writing ' + yamlFilePath);\n }\n\n this._writeYamlFile(newYamlFile, yamlFilePath, 'UniversalReference', yamlApiSchema);\n\n if (parentYamlFile) {\n // References should be recorded in the parent YAML file with the local name of the embedded item.\n // This avoids unnecessary repetition when listing items inside of a namespace.\n this._recordYamlReference(\n this._ensureYamlReferences(),\n this._getUid(apiItem),\n this._getYamlItemName(apiItem, {\n includeNamespace: !this.newDocfxNamespaces,\n includeSignature: true\n }),\n this._getYamlItemName(apiItem, { includeNamespace: true, includeSignature: true })\n );\n }\n }\n\n return true;\n }\n\n protected _getLogicalChildren(apiItem: ApiItem): ApiItem[] {\n const children: ApiItem[] = [];\n if (apiItem.kind === ApiItemKind.Package) {\n // Skip over the entry point, since it's not part of the documentation hierarchy\n this._flattenNamespaces(\n apiItem.members[0].members,\n children,\n this.newDocfxNamespaces ? FlattenMode.NestedNamespacesAndChildren : FlattenMode.NestedChildren\n );\n } else {\n this._flattenNamespaces(\n apiItem.members,\n children,\n this.newDocfxNamespaces ? FlattenMode.ImmediateChildren : FlattenMode.NestedChildren\n );\n }\n return children;\n }\n\n // Flattens nested namespaces into top level entries so that the following:\n // namespace X { export namespace Y { export namespace Z { } }\n // Is represented as:\n // - X\n // - X.Y\n // - X.Y.Z\n private _flattenNamespaces(\n items: ReadonlyArray<ApiItem>,\n childrenOut: ApiItem[],\n mode: FlattenMode\n ): boolean {\n let hasNonNamespaceChildren: boolean = false;\n for (const item of items) {\n if (item.kind === ApiItemKind.Namespace) {\n switch (mode) {\n case FlattenMode.NestedChildren:\n // Include children of namespaces, but not the namespaces themselves. This matches existing legacy behavior.\n this._flattenNamespaces(item.members, childrenOut, FlattenMode.NestedChildren);\n break;\n case FlattenMode.NestedNamespacesOnly:\n case FlattenMode.NestedNamespacesAndChildren:\n // At any level, always include a nested namespace if it has non-namespace children, but do not include its\n // non-namespace children in the result.\n\n // Record the offset at which the namespace is added in case we need to remove it later.\n const index: number = childrenOut.length;\n childrenOut.push(item);\n\n if (!this._flattenNamespaces(item.members, childrenOut, FlattenMode.NestedNamespacesOnly)) {\n // This namespace had no non-namespace children, remove it.\n childrenOut.splice(index, 1);\n }\n break;\n }\n } else if (this._shouldInclude(item.kind)) {\n switch (mode) {\n case FlattenMode.NestedChildren:\n case FlattenMode.NestedNamespacesAndChildren:\n case FlattenMode.ImmediateChildren:\n // At the top level, include non-namespace children as well.\n childrenOut.push(item);\n break;\n }\n hasNonNamespaceChildren = true;\n }\n }\n return hasNonNamespaceChildren;\n }\n\n /**\n * Write the table of contents\n */\n private _writeTocFile(outputFolder: string, apiItems: ReadonlyArray<ApiItem>): void {\n const tocFile: IYamlTocFile = this.buildYamlTocFile(apiItems);\n\n const tocFilePath: string = path.join(outputFolder, 'toc.yml');\n console.log('Writing ' + tocFilePath);\n this._writeYamlFile(tocFile, tocFilePath, '', undefined);\n }\n\n /** @virtual */\n protected buildYamlTocFile(apiItems: ReadonlyArray<ApiItem>): IYamlTocFile {\n const tocFile: IYamlTocFile = {\n items: []\n };\n\n const rootItem: IYamlTocItem = this.onGetTocRoot();\n tocFile.items.push(rootItem);\n\n rootItem.items!.push(...this._buildTocItems(apiItems));\n return tocFile;\n }\n\n private _buildTocItems(apiItems: ReadonlyArray<ApiItem>): IYamlTocItem[] {\n const tocItems: IYamlTocItem[] = [];\n for (const apiItem of apiItems) {\n let tocItem: IYamlTocItem;\n if (apiItem.kind === ApiItemKind.Namespace && !this.newDocfxNamespaces) {\n tocItem = {\n name: this._getTocItemName(apiItem)\n };\n } else {\n if (this._shouldEmbed(apiItem.kind)) {\n // Don't generate table of contents items for embedded definitions\n continue;\n }\n\n tocItem = {\n name: this._getTocItemName(apiItem),\n uid: this._getUid(apiItem)\n };\n }\n\n tocItems.push(tocItem);\n\n const children: ApiItem[] = this._getLogicalChildren(apiItem);\n const childItems: IYamlTocItem[] = this._buildTocItems(children);\n if (childItems.length > 0) {\n tocItem.items = childItems;\n }\n }\n return tocItems;\n }\n\n /** @virtual */\n protected _getTocItemName(apiItem: ApiItem): string {\n let name: string;\n if (apiItem.kind === ApiItemKind.Package) {\n name = PackageName.getUnscopedName(apiItem.displayName);\n } else {\n name = this._getYamlItemName(apiItem);\n }\n\n if (name === apiItem.displayName && apiItem.getMergedSiblings().length > 1) {\n name += ` (${apiItem.kind})`;\n }\n\n return name;\n }\n\n protected _shouldEmbed(apiItemKind: ApiItemKind): boolean {\n switch (apiItemKind) {\n case ApiItemKind.Class:\n case ApiItemKind.Package:\n case ApiItemKind.Interface:\n case ApiItemKind.Enum:\n case ApiItemKind.TypeAlias:\n return false;\n case ApiItemKind.Namespace:\n return !this.newDocfxNamespaces;\n }\n return true;\n }\n\n protected _shouldInclude(apiItemKind: ApiItemKind): boolean {\n // Filter out known items that are not yet supported\n switch (apiItemKind) {\n case ApiItemKind.CallSignature:\n case ApiItemKind.ConstructSignature:\n case ApiItemKind.IndexSignature:\n return false;\n }\n return true;\n }\n\n private _generateYamlItem(apiItem: ApiDocumentedItem): IYamlItem | undefined {\n // Filter out known items that are not yet supported\n if (!this._shouldInclude(apiItem.kind)) {\n return undefined;\n }\n\n const uid: DeclarationReference = this._getUidObject(apiItem);\n const yamlItem: Partial<IYamlItem> = {\n uid: uid.toString()\n };\n\n if (apiItem.tsdocComment) {\n const tsdocComment: DocComment = apiItem.tsdocComment;\n if (tsdocComment.summarySection) {\n const summary: string = this._renderMarkdown(tsdocComment.summarySection, apiItem);\n if (summary) {\n yamlItem.summary = summary;\n }\n }\n\n if (tsdocComment.remarksBlock) {\n const remarks: string = this._renderMarkdown(tsdocComment.remarksBlock.content, apiItem);\n if (remarks) {\n yamlItem.remarks = remarks;\n }\n }\n\n if (tsdocComment) {\n // Write the @example blocks\n const exampleBlocks: DocBlock[] = tsdocComment.customBlocks.filter(\n (x) => x.blockTag.tagNameWithUpperCase === StandardTags.example.tagNameWithUpperCase\n );\n\n for (const exampleBlock of exampleBlocks) {\n const example: string = this._renderMarkdown(exampleBlock.content, apiItem);\n if (example) {\n yamlItem.example = [...(yamlItem.example || []), example];\n }\n }\n }\n\n if (tsdocComment.deprecatedBlock) {\n const deprecatedMessage: string = this._renderMarkdown(tsdocComment.deprecatedBlock.content, apiItem);\n if (deprecatedMessage.length > 0) {\n yamlItem.deprecated = { content: deprecatedMessage };\n }\n }\n }\n\n if (ApiReleaseTagMixin.isBaseClassOf(apiItem)) {\n if (apiItem.releaseTag === ReleaseTag.Alpha || apiItem.releaseTag === ReleaseTag.Beta) {\n yamlItem.isPreview = true;\n }\n }\n\n yamlItem.name = this._getYamlItemName(apiItem, {\n includeSignature: true,\n includeNamespace: !this.newDocfxNamespaces\n });\n yamlItem.fullName = this._getYamlItemName(apiItem, { includeSignature: true, includeNamespace: true });\n yamlItem.langs = ['typeScript'];\n\n // Add the namespace of the item if it is contained in one.\n // Do not add the namespace parent of a namespace as they are flattened in the documentation.\n if (\n apiItem.kind !== ApiItemKind.Namespace &&\n apiItem.parent &&\n apiItem.parent.kind === ApiItemKind.Namespace &&\n this.newDocfxNamespaces\n ) {\n yamlItem.namespace = apiItem.parent.canonicalReference.toString();\n }\n\n switch (apiItem.kind) {\n case ApiItemKind.Enum:\n yamlItem.type = 'enum';\n break;\n case ApiItemKind.EnumMember:\n yamlItem.type = 'field';\n const enumMember: ApiEnumMember = apiItem as ApiEnumMember;\n\n if (enumMember.initializerExcerpt && enumMember.initializerExcerpt.text.length > 0) {\n yamlItem.numericValue = enumMember.initializerExcerpt.text;\n }\n\n break;\n case ApiItemKind.Class:\n yamlItem.type = 'class';\n this._populateYamlClassOrInterface(uid, yamlItem, apiItem as ApiClass);\n break;\n case ApiItemKind.Interface:\n yamlItem.type = 'interface';\n this._populateYamlClassOrInterface(uid, yamlItem, apiItem as ApiInterface);\n break;\n case ApiItemKind.Method:\n case ApiItemKind.MethodSignature:\n yamlItem.type = 'method';\n this._populateYamlFunctionLike(uid, yamlItem, apiItem as ApiMethod | ApiMethodSignature);\n break;\n\n case ApiItemKind.Constructor:\n yamlItem.type = 'constructor';\n this._populateYamlFunctionLike(uid, yamlItem, apiItem as ApiConstructor);\n break;\n\n case ApiItemKind.Package:\n yamlItem.type = 'package';\n break;\n case ApiItemKind.Namespace:\n yamlItem.type = 'namespace';\n break;\n case ApiItemKind.Property:\n case ApiItemKind.PropertySignature:\n const apiProperty: ApiPropertyItem = apiItem as ApiPropertyItem;\n if (apiProperty.isEventProperty) {\n yamlItem.type = 'event';\n } else {\n yamlItem.type = 'property';\n }\n this._populateYamlProperty(uid, yamlItem, apiProperty);\n break;\n\n case ApiItemKind.Function:\n yamlItem.type = 'function';\n this._populateYamlFunctionLike(uid, yamlItem, apiItem as ApiFunction);\n break;\n\n case ApiItemKind.Variable:\n yamlItem.type = 'variable';\n this._populateYamlVariable(uid, yamlItem, apiItem as ApiVariable);\n break;\n\n case ApiItemKind.TypeAlias:\n yamlItem.type = 'typealias';\n this._populateYamlTypeAlias(uid, yamlItem, apiItem as ApiTypeAlias);\n break;\n\n default:\n throw new Error('Unimplemented item kind: ' + apiItem.kind);\n }\n\n if (apiItem.kind !== ApiItemKind.Package && !this._shouldEmbed(apiItem.kind)) {\n const associatedPackage: ApiPackage | undefined = apiItem.getAssociatedPackage();\n if (!associatedPackage) {\n throw new Error('Unable to determine associated package for ' + apiItem.displayName);\n }\n yamlItem.package = this._getUid(associatedPackage);\n }\n\n return yamlItem as IYamlItem;\n }\n\n private _populateYamlTypeParameters(\n contextUid: DeclarationReference,\n apiItem: ApiTypeParameterListMixin\n ): IYamlParameter[] {\n const typeParameters: IYamlParameter[] = [];\n for (const apiTypeParameter of apiItem.typeParameters) {\n const typeParameter: IYamlParameter = {\n id: apiTypeParameter.name\n };\n\n if (apiTypeParameter.tsdocTypeParamBlock) {\n typeParameter.description = this._renderMarkdown(\n apiTypeParameter.tsdocTypeParamBlock.content,\n apiItem\n );\n }\n\n if (!apiTypeParameter.constraintExcerpt.isEmpty) {\n typeParameter.type = [this._renderType(contextUid, apiTypeParameter.constraintExcerpt)];\n }\n\n typeParameters.push(typeParameter);\n }\n return typeParameters;\n }\n\n private _populateYamlClassOrInterface(\n uid: DeclarationReference,\n yamlItem: Partial<IYamlItem>,\n apiItem: ApiClass | ApiInterface\n ): void {\n if (apiItem instanceof ApiClass) {\n if (apiItem.extendsType) {\n yamlItem.extends = [this._renderType(uid, apiItem.extendsType.excerpt)];\n yamlItem.inheritance = this._renderInheritance(uid, [apiItem.extendsType]);\n }\n if (apiItem.implementsTypes.length > 0) {\n yamlItem.implements = [];\n for (const implementsType of apiItem.implementsTypes) {\n yamlItem.implements.push(this._renderType(uid, implementsType.excerpt));\n }\n }\n } else if (apiItem instanceof ApiInterface) {\n if (apiItem.extendsTypes.length > 0) {\n yamlItem.extends = [];\n for (const extendsType of apiItem.extendsTypes) {\n yamlItem.extends.push(this._renderType(uid, extendsType.excerpt));\n }\n yamlItem.inheritance = this._renderInheritance(uid, apiItem.extendsTypes);\n }\n\n const typeParameters: IYamlParameter[] = this._populateYamlTypeParameters(uid, apiItem);\n if (typeParameters.length) {\n yamlItem.syntax = { typeParameters };\n }\n }\n\n if (apiItem.tsdocComment) {\n if (apiItem.tsdocComment.modifierTagSet.isSealed()) {\n let sealedMessage: string;\n if (apiItem.kind === ApiItemKind.Class) {\n sealedMessage = 'This class is marked as `@sealed`. Subclasses should not extend it.';\n } else {\n sealedMessage = 'This interface is marked as `@sealed`. Other interfaces should not extend it.';\n }\n if (!yamlItem.remarks) {\n yamlItem.remarks = sealedMessage;\n } else {\n yamlItem.remarks = sealedMessage + '\\n\\n' + yamlItem.remarks;\n }\n }\n }\n }\n\n private _populateYamlFunctionLike(\n uid: DeclarationReference,\n yamlItem: Partial<IYamlItem>,\n apiItem: ApiMethod | ApiMethodSignature | ApiConstructor | ApiFunction\n ): void {\n const syntax: IYamlSyntax = {\n content: apiItem.getExcerptWithModifiers()\n };\n yamlItem.syntax = syntax;\n\n if (ApiReturnTypeMixin.isBaseClassOf(apiItem)) {\n const returnType: string = this._renderType(uid, apiItem.returnTypeExcerpt);\n\n let returnDescription: string = '';\n\n if (apiItem.tsdocComment && apiItem.tsdocComment.returnsBlock) {\n returnDescription = this._renderMarkdown(apiItem.tsdocComment.returnsBlock.content, apiItem);\n // temporary workaround for people who mistakenly add a hyphen, e.g. \"@returns - blah\"\n returnDescription = returnDescription.replace(/^\\s*-\\s+/, '');\n }\n\n if (returnType || returnDescription) {\n syntax.return = {\n type: [returnType],\n description: returnDescription\n };\n }\n }\n\n const parameters: IYamlParameter[] = [];\n for (const apiParameter of apiItem.parameters) {\n let parameterDescription: string = '';\n if (apiParameter.tsdocParamBlock) {\n parameterDescription = this._renderMarkdown(apiParameter.tsdocParamBlock.content, apiItem);\n }\n\n parameters.push({\n id: apiParameter.name,\n description: parameterDescription,\n type: [this._renderType(uid, apiParameter.parameterTypeExcerpt)],\n optional: apiParameter.isOptional\n } as IYamlParameter);\n }\n\n if (parameters.length) {\n syntax.parameters = parameters;\n }\n\n if (ApiTypeParameterListMixin.isBaseClassOf(apiItem)) {\n const typeParameters: IYamlParameter[] = this._populateYamlTypeParameters(uid, apiItem);\n if (typeParameters.length) {\n syntax.typeParameters = typeParameters;\n }\n }\n }\n\n private _populateYamlProperty(\n uid: DeclarationReference,\n yamlItem: Partial<IYamlItem>,\n apiItem: ApiPropertyItem\n ): void {\n const syntax: IYamlSyntax = {\n content: apiItem.getExcerptWithModifiers()\n };\n yamlItem.syntax = syntax;\n\n if (apiItem.propertyTypeExcerpt.text) {\n syntax.return = {\n type: [this._renderType(uid, apiItem.propertyTypeExcerpt)]\n };\n }\n }\n\n private _populateYamlVariable(\n uid: DeclarationReference,\n yamlItem: Partial<IYamlItem>,\n apiItem: ApiVariable\n ): void {\n const syntax: IYamlSyntax = {\n content: apiItem.getExcerptWithModifiers()\n };\n yamlItem.syntax = syntax;\n\n if (apiItem.variableTypeExcerpt.text) {\n syntax.return = {\n type: [this._renderType(uid, apiItem.variableTypeExcerpt)]\n };\n }\n }\n\n private _populateYamlTypeAlias(\n uid: DeclarationReference,\n yamlItem: Partial<IYamlItem>,\n apiItem: ApiTypeAlias\n ): void {\n const syntax: IYamlSyntax = {\n content: apiItem.getExcerptWithModifiers()\n };\n yamlItem.syntax = syntax;\n\n const typeParameters: IYamlParameter[] = this._populateYamlTypeParameters(uid, apiItem);\n if (typeParameters.length) {\n syntax.typeParameters = typeParameters;\n }\n\n if (apiItem.typeExcerpt.text) {\n syntax.return = {\n type: [this._renderType(uid, apiItem.typeExcerpt)]\n };\n }\n }\n\n private _renderMarkdown(docSection: DocSection, contextApiItem: ApiItem): string {\n const stringBuilder: StringBuilder = new StringBuilder();\n\n this._markdownEmitter.emit(stringBuilder, docSection, {\n contextApiItem,\n onGetFilenameForApiItem: (apiItem: ApiItem) => {\n // NOTE: GitHub's markdown renderer does not resolve relative hyperlinks correctly\n // unless they start with \"./\" or \"../\".\n\n // To ensure the xref is properly escaped, we first encode the entire xref\n // to handle escaping of reserved characters. Then we must replace '#' and '?'\n // characters so that they are not interpreted as a querystring or hash.\n // We must also backslash-escape unbalanced `(` and `)` characters as the\n // markdown spec insists that they are only valid when balanced. To reduce\n // the overhead we only support balanced parenthesis with a depth of 1.\n return encodeURI(`xref:${this._getUid(apiItem)}`)\n .replace(/[#?]/g, (s) => encodeURIComponent(s))\n .replace(/(\\([^(]*\\))|[()]/g, (s, balanced) => balanced || '\\\\' + s);\n }\n });\n\n return stringBuilder.toString().trim();\n }\n\n private _writeYamlFile(\n dataObject: {},\n filePath: string,\n yamlMimeType: string,\n schema: JsonSchema | undefined\n ): void {\n JsonFile.validateNoUndefinedMembers(dataObject);\n\n let stringified: string = yaml.safeDump(dataObject, {\n lineWidth: 120\n });\n\n if (yamlMimeType) {\n stringified = `### YamlMime:${yamlMimeType}\\n` + stringified;\n }\n\n FileSystem.writeFile(filePath, stringified, {\n convertLineEndings: NewlineKind.CrLf,\n ensureFolderExists: true\n });\n\n if (schema) {\n schema.validateObject(dataObject, filePath);\n }\n }\n\n /**\n * Calculate the DocFX \"uid\" for the ApiItem\n * Example: `node-core-library!JsonFile#load`\n */\n protected _getUid(apiItem: ApiItem): string {\n return this._getUidObject(apiItem).toString();\n }\n\n protected _getUidObject(apiItem: ApiItem): DeclarationReference {\n return apiItem.canonicalReference;\n }\n\n /**\n * Initialize the _apiItemsByCanonicalReference data structure.\n */\n private _initApiItems(): void {\n this._initApiItemsRecursive(this._apiModel);\n }\n\n /**\n * Helper for _initApiItems()\n */\n private _initApiItemsRecursive(apiItem: ApiItem): void {\n if (apiItem.canonicalReference && !apiItem.canonicalReference.isEmpty) {\n this._apiItemsByCanonicalReference.set(apiItem.canonicalReference.toString(), apiItem);\n }\n\n // Recurse container members\n if (ApiItemContainerMixin.isBaseClassOf(apiItem)) {\n for (const apiMember of apiItem.members) {\n this._initApiItemsRecursive(apiMember);\n }\n }\n }\n\n private _ensureYamlReferences(): IYamlReferences {\n if (!this._yamlReferences) {\n this._yamlReferences = {\n references: [],\n typeNameToUid: new Map(),\n uidTypeReferenceCounters: new Map()\n };\n }\n return this._yamlReferences;\n }\n\n private _renderInheritance(\n contextUid: DeclarationReference,\n heritageTypes: ReadonlyArray<HeritageType>\n ): IYamlInheritanceTree[] {\n const result: IYamlInheritanceTree[] = [];\n for (const heritageType of heritageTypes) {\n const type: string = this._renderType(contextUid, heritageType.excerpt);\n const yamlInheritance: IYamlInheritanceTree = { type };\n const apiItem: ApiItem | undefined = this._apiItemsByCanonicalReference.get(type);\n if (apiItem) {\n if (apiItem instanceof ApiClass) {\n if (apiItem.extendsType) {\n yamlInheritance.inheritance = this._renderInheritance(this._getUidObject(apiItem), [\n apiItem.extendsType\n ]);\n }\n } else if (apiItem instanceof ApiInterface) {\n if (apiItem.extendsTypes.length > 0) {\n yamlInheritance.inheritance = this._renderInheritance(\n this._getUidObject(apiItem),\n apiItem.extendsTypes\n );\n }\n }\n }\n result.push(yamlInheritance);\n }\n return result;\n }\n\n private _renderType(contextUid: DeclarationReference, typeExcerpt: Excerpt): string {\n const excerptTokens: ExcerptToken[] = [...typeExcerpt.spannedTokens]; // copy the read-only array\n\n if (excerptTokens.length === 0) {\n return '';\n }\n\n // Remove the last token if it consists only of whitespace\n const lastToken: ExcerptToken = excerptTokens[excerptTokens.length - 1];\n if (lastToken.kind === ExcerptTokenKind.Content && !lastToken.text.trim()) {\n excerptTokens.pop();\n if (excerptTokens.length === 0) {\n return '';\n }\n }\n\n const typeName: string = typeExcerpt.text.trim();\n\n // If there are no references to be used for a complex type, return the type name.\n if (!excerptTokens.some((tok) => tok.kind === ExcerptTokenKind.Reference && !!tok.canonicalReference)) {\n return typeName;\n }\n\n const yamlReferences: IYamlReferences = this._ensureYamlReferences();\n const existingUid: string | undefined = yamlReferences.typeNameToUid.get(typeName);\n\n // If this type has already been referenced for the current file, return its uid.\n if (existingUid) {\n return existingUid;\n }\n\n // If the excerpt consists of a single reference token, record the reference.\n if (\n excerptTokens.length === 1 &&\n excerptTokens[0].kind === ExcerptTokenKind.Reference &&\n excerptTokens[0].canonicalReference\n ) {\n const excerptRef: string = excerptTokens[0].canonicalReference.toString();\n const apiItem: ApiItem | undefined = this._apiItemsByCanonicalReference.get(excerptRef);\n return this._recordYamlReference(\n yamlReferences,\n excerptTokens[0].canonicalReference.toString(),\n apiItem ? this._getYamlItemName(apiItem) : typeName,\n apiItem ? this._getYamlItemName(apiItem, { includeNamespace: true }) : typeName\n );\n }\n\n // Otherwise, the type is complex and consists of one or more reference tokens. Record a reference\n // and return its uid.\n const baseUid: string = contextUid.withMeaning(undefined).withOverloadIndex(undefined).toString();\n\n // Keep track of the count for the base uid (without meaning or overload index) to ensure\n // that each complex type reference is unique.\n const counter: number = yamlReferences.uidTypeReferenceCounters.get(baseUid) || 0;\n yamlReferences.uidTypeReferenceCounters.set(baseUid, counter + 1);\n\n const uid: string = contextUid\n .addNavigationStep(Navigation.Locals, `${counter}`)\n .withMeaning(Meaning.ComplexType)\n .withOverloadIndex(undefined)\n .toString();\n\n return this._recordYamlReference(yamlReferences, uid, typeName, typeName, excerptTokens);\n }\n\n private _recordYamlReference(\n yamlReferences: IYamlReferences,\n uid: string,\n name: string,\n fullName: string,\n excerptTokens?: ExcerptToken[]\n ): string {\n if (yamlReferences.references.some((ref) => ref.uid === uid)) {\n return uid;\n }\n\n // Fill in the reference spec from the excerpt.\n const specs: IYamlReferenceSpec[] = [];\n if (excerptTokens) {\n for (const token of excerptTokens) {\n if (token.kind === ExcerptTokenKind.Reference) {\n const spec: IYamlReferenceSpec = {};\n const specUid: string | undefined = token.canonicalReference && token.canonicalReference.toString();\n const apiItem: ApiItem | undefined = specUid\n ? this._apiItemsByCanonicalReference.get(specUid)\n : undefined;\n if (specUid) {\n spec.uid = specUid;\n }\n spec.name = token.text;\n spec.fullName = apiItem\n ? apiItem.getScopedNameWithinPackage()\n : token.canonicalReference\n ? token.canonicalReference\n .withSource(undefined)\n .withMeaning(undefined)\n .withOverloadIndex(undefined)\n .toString()\n : token.text;\n specs.push(spec);\n } else {\n specs.push({\n name: token.text,\n fullName: token.text\n });\n }\n }\n }\n\n const yamlReference: IYamlReference = { uid };\n if (specs.length > 0) {\n yamlReference.name = specs\n .map((s) => s.name)\n .join('')\n .trim();\n yamlReference.fullName = specs\n .map((s) => s.fullName || s.name)\n .join('')\n .trim();\n yamlReference['spec.typeScript'] = specs;\n } else {\n if (name !== uid) {\n yamlReference.name = name;\n }\n if (fullName !== uid && fullName !== name) {\n yamlReference.fullName = fullName;\n }\n }\n\n yamlReferences.references.push(yamlReference);\n return uid;\n }\n\n private _getYamlItemName(apiItem: ApiItem, options: INameOptions = {}): string {\n const { includeSignature, includeNamespace } = options;\n const baseName: string = includeSignature ? Utilities.getConciseSignature(apiItem) : apiItem.displayName;\n if (\n (includeNamespace || apiItem.kind === ApiItemKind.Namespace) &&\n apiItem.parent &&\n apiItem.parent.kind === ApiItemKind.Namespace\n ) {\n // If the immediate parent is a namespace, then add the namespaces to the name. For example:\n //\n // // Name: \"N1\"\n // export namespace N1 {\n // // Name: \"N1.N2\"\n // export namespace N2 {\n // // Name: \"N1.N2.f(x,y)\"\n // export function f(x: string, y: string): string {\n // return x + y;\n // }\n //\n //\n // // Name: \"N1.N2.C\"\n // export class C {\n // // Name: \"member(x,y)\" <===========\n // public member(x: string, y: string): string {\n // return x + y;\n // }\n // }\n // }\n // }\n //\n // In the above example, \"member(x, y)\" does not appear as \"N1.N2.C.member(x,y)\" because YamlDocumenter\n // embeds this entry in the web page for \"N1.N2.C\", so the container is obvious. Whereas \"N1.N2.f(x,y)\"\n // needs to be qualified because the DocFX template doesn't make pages for namespaces. Instead, they get\n // flattened into the package's page.\n const nameParts: string[] = [baseName];\n\n for (let current: ApiItem | undefined = apiItem.parent; current; current = current.parent) {\n if (current.kind !== ApiItemKind.Namespace) {\n break;\n }\n\n nameParts.unshift(current.displayName);\n }\n\n return nameParts.join('.');\n } else {\n return baseName;\n }\n }\n\n private _getYamlFilePath(outputFolder: string, apiItem: ApiItem): string {\n let result: string = '';\n\n for (const current of apiItem.getHierarchy()) {\n switch (current.kind) {\n case ApiItemKind.Model:\n case ApiItemKind.EntryPoint:\n break;\n case ApiItemKind.Package:\n result += Utilities.getSafeFilenameForName(PackageName.getUnscopedName(current.displayName));\n break;\n default:\n if (current.parent && current.parent.kind === ApiItemKind.EntryPoint) {\n result += '/';\n } else {\n result += '.';\n }\n result += Utilities.getSafeFilenameForName(current.displayName);\n break;\n }\n }\n\n let disambiguator: string = '';\n if (apiItem.getMergedSiblings().length > 1) {\n disambiguator = `-${apiItem.kind.toLowerCase()}`;\n }\n\n return path.join(outputFolder, result + disambiguator + '.yml');\n }\n\n private _deleteOldOutputFiles(outputFolder: string): void {\n console.log('Deleting old output from ' + outputFolder);\n FileSystem.ensureEmptyFolder(outputFolder);\n }\n}\n"]} |