@microsoft/api-documenter 7.23.10 → 7.23.12

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.
Files changed (41) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +19 -19
  3. package/bin/api-documenter +2 -2
  4. package/dist/tsdoc-metadata.json +1 -1
  5. package/lib/cli/ApiDocumenterCommandLine.js.map +1 -1
  6. package/lib/cli/BaseAction.js.map +1 -1
  7. package/lib/cli/GenerateAction.js.map +1 -1
  8. package/lib/cli/MarkdownAction.js.map +1 -1
  9. package/lib/cli/YamlAction.js.map +1 -1
  10. package/lib/documenters/DocumenterConfig.js.map +1 -1
  11. package/lib/documenters/ExperimentalYamlDocumenter.js.map +1 -1
  12. package/lib/documenters/IConfigFile.js.map +1 -1
  13. package/lib/documenters/MarkdownDocumenter.js.map +1 -1
  14. package/lib/documenters/OfficeYamlDocumenter.js.map +1 -1
  15. package/lib/documenters/YamlDocumenter.js.map +1 -1
  16. package/lib/index.js.map +1 -1
  17. package/lib/markdown/CustomMarkdownEmitter.js.map +1 -1
  18. package/lib/markdown/MarkdownEmitter.js.map +1 -1
  19. package/lib/nodes/CustomDocNodeKind.js.map +1 -1
  20. package/lib/nodes/DocEmphasisSpan.js.map +1 -1
  21. package/lib/nodes/DocHeading.js.map +1 -1
  22. package/lib/nodes/DocNoteBox.js.map +1 -1
  23. package/lib/nodes/DocTable.js.map +1 -1
  24. package/lib/nodes/DocTableCell.js.map +1 -1
  25. package/lib/nodes/DocTableRow.js.map +1 -1
  26. package/lib/plugin/IApiDocumenterPluginManifest.js.map +1 -1
  27. package/lib/plugin/MarkdownDocumenterAccessor.js.map +1 -1
  28. package/lib/plugin/MarkdownDocumenterFeature.js.map +1 -1
  29. package/lib/plugin/PluginFeature.js.map +1 -1
  30. package/lib/plugin/PluginLoader.js.map +1 -1
  31. package/lib/schemas/api-documenter-template.json +99 -99
  32. package/lib/schemas/api-documenter.schema.json +47 -47
  33. package/lib/start.js.map +1 -1
  34. package/lib/utils/IndentedWriter.js.map +1 -1
  35. package/lib/utils/ToSdpConvertHelper.js.map +1 -1
  36. package/lib/utils/Utilities.js.map +1 -1
  37. package/lib/yaml/ISDPYamlFile.js.map +1 -1
  38. package/lib/yaml/IYamlApiFile.js.map +1 -1
  39. package/lib/yaml/IYamlTocFile.js.map +1 -1
  40. package/lib/yaml/typescript.schema.json +643 -643
  41. package/package.json +3 -3
package/LICENSE CHANGED
@@ -1,24 +1,24 @@
1
- @microsoft/api-documenter
2
-
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
-
5
- MIT License
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining
8
- a copy of this software and associated documentation files (the
9
- "Software"), to deal in the Software without restriction, including
10
- without limitation the rights to use, copy, modify, merge, publish,
11
- distribute, sublicense, and/or sell copies of the Software, and to
12
- permit persons to whom the Software is furnished to do so, subject to
13
- the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be
16
- included in all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1
+ @microsoft/api-documenter
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
24
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # @microsoft/api-documenter
2
-
3
- This tool can be used to generate an online API reference manual for your TypeScript library.
4
- It reads the *.api.json data files produced by [API Extractor](https://api-extractor.com/),
5
- and then generates files in [Markdown](https://en.wikipedia.org/wiki/Markdown) or
6
- [DocFX](https://dotnet.github.io/docfx/) format.
7
-
8
- For usage information, see the
9
- [Generating Docs](https://api-extractor.com/pages/setup/generating_docs/) article from the API Extractor
10
- documentation.
11
-
12
- ## Links
13
-
14
- - [CHANGELOG.md](
15
- https://github.com/microsoft/rushstack/blob/main/apps/api-documenter/CHANGELOG.md) - Find
16
- out what's new in the latest version
17
- - [API Reference](https://rushstack.io/pages/api/api-documenter/)
18
-
19
- API Documenter is part of the [Rush Stack](https://rushstack.io/) family of projects.
1
+ # @microsoft/api-documenter
2
+
3
+ This tool can be used to generate an online API reference manual for your TypeScript library.
4
+ It reads the *.api.json data files produced by [API Extractor](https://api-extractor.com/),
5
+ and then generates files in [Markdown](https://en.wikipedia.org/wiki/Markdown) or
6
+ [DocFX](https://dotnet.github.io/docfx/) format.
7
+
8
+ For usage information, see the
9
+ [Generating Docs](https://api-extractor.com/pages/setup/generating_docs/) article from the API Extractor
10
+ documentation.
11
+
12
+ ## Links
13
+
14
+ - [CHANGELOG.md](
15
+ https://github.com/microsoft/rushstack/blob/main/apps/api-documenter/CHANGELOG.md) - Find
16
+ out what's new in the latest version
17
+ - [API Reference](https://rushstack.io/pages/api/api-documenter/)
18
+
19
+ API Documenter is part of the [Rush Stack](https://rushstack.io/) family of projects.
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- require('../lib/start.js')
1
+ #!/usr/bin/env node
2
+ require('../lib/start.js')
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.0"
8
+ "packageVersion": "7.38.2"
9
9
  }
10
10
  ]
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ApiDocumenterCommandLine.js","sourceRoot":"","sources":["../../src/cli/ApiDocumenterCommandLine.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,gEAA+D;AAC/D,qDAAkD;AAClD,6CAA0C;AAC1C,qDAAkD;AAElD,MAAa,wBAAyB,SAAQ,mCAAiB;IAC7D;QACE,KAAK,CAAC;YACJ,YAAY,EAAE,gBAAgB;YAC9B,eAAe,EACb,oDAAoD;gBACpD,6DAA6D;SAChE,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,SAAS,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,uBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF;AAhBD,4DAgBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { CommandLineParser } from '@rushstack/ts-command-line';\r\nimport { MarkdownAction } from './MarkdownAction';\r\nimport { YamlAction } from './YamlAction';\r\nimport { GenerateAction } from './GenerateAction';\r\n\r\nexport class ApiDocumenterCommandLine extends CommandLineParser {\r\n public constructor() {\r\n super({\r\n toolFilename: 'api-documenter',\r\n toolDescription:\r\n 'Reads *.api.json files produced by api-extractor, ' +\r\n ' and generates API documentation in various output formats.'\r\n });\r\n this._populateActions();\r\n }\r\n\r\n private _populateActions(): void {\r\n this.addAction(new MarkdownAction(this));\r\n this.addAction(new YamlAction(this));\r\n this.addAction(new GenerateAction(this));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ApiDocumenterCommandLine.js","sourceRoot":"","sources":["../../src/cli/ApiDocumenterCommandLine.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,gEAA+D;AAC/D,qDAAkD;AAClD,6CAA0C;AAC1C,qDAAkD;AAElD,MAAa,wBAAyB,SAAQ,mCAAiB;IAC7D;QACE,KAAK,CAAC;YACJ,YAAY,EAAE,gBAAgB;YAC9B,eAAe,EACb,oDAAoD;gBACpD,6DAA6D;SAChE,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,SAAS,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,uBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF;AAhBD,4DAgBC","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 { CommandLineParser } from '@rushstack/ts-command-line';\nimport { MarkdownAction } from './MarkdownAction';\nimport { YamlAction } from './YamlAction';\nimport { GenerateAction } from './GenerateAction';\n\nexport class ApiDocumenterCommandLine extends CommandLineParser {\n public constructor() {\n super({\n toolFilename: 'api-documenter',\n toolDescription:\n 'Reads *.api.json files produced by api-extractor, ' +\n ' and generates API documentation in various output formats.'\n });\n this._populateActions();\n }\n\n private _populateActions(): void {\n this.addAction(new MarkdownAction(this));\n this.addAction(new YamlAction(this));\n this.addAction(new GenerateAction(this));\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAction.js","sourceRoot":"","sources":["../../src/cli/BaseAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAE7B,uDAAiC;AAEjC,gEAIoC;AACpC,oEAA0D;AAC1D,wEAMwC;AAQxC,MAAsB,UAAW,SAAQ,mCAAiB;IAIxD,YAAsB,OAAkC;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,WAAW;QACX,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACtD,iBAAiB,EAAE,gBAAgB;YACnC,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,SAAS;YACvB,WAAW,EACT,6EAA6E;gBAC7E,uCAAuC;SAC1C,CAAC,CAAC;QAEH,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACvD,iBAAiB,EAAE,iBAAiB;YACpC,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,SAAS;YACvB,WAAW,EACT,sEAAsE;gBACtE,yCAAyC;gBACzC,kCAAkC,IAAI,CAAC,UAAU,GAAG;SACvD,CAAC,CAAC;IACL,CAAC;IAES,aAAa;QACrB,MAAM,QAAQ,GAAa,IAAI,8BAAQ,EAAE,CAAC;QAE1C,MAAM,WAAW,GAAW,IAAI,CAAC,qBAAqB,CAAC,KAAK,IAAI,SAAS,CAAC;QAC1E,IAAI,CAAC,8BAAU,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;YAC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CACF,CAAC;qBACH;yBAAM;wBACL,IACE,MAAM,CAAC,eAAe,YAAY,uCAAiB;4BACnD,MAAM,CAAC,eAAe,CAAC,YAAY;4BACnC,MAAM,CAAC,eAAe,KAAK,OAAO,EAClC;4BACA,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;yBACpF;qBACF;iBACF;aACF;SACF;QAED,kBAAkB;QAClB,IAAI,2CAAqB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;YAChD,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;gBACpC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAED;;;OAGG;IACK,kBAAkB,CAAC,gBAAkC,EAAE,gBAAkC;QAC/F,gBAAgB,CAAC,cAAc,GAAG,gBAAgB,CAAC,cAAc,CAAC;QAClE,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAE9D,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3C,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpC;QACD,KAAK,MAAM,SAAS,IAAI,gBAAgB,CAAC,UAAU,EAAE;YACnD,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;SAC5C;QACD,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAE9D,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;IAC7C,CAAC;CACF;AAjHD,gCAiHC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as path from 'path';\r\nimport type * as tsdoc from '@microsoft/tsdoc';\r\nimport colors from 'colors/safe';\r\n\r\nimport {\r\n CommandLineAction,\r\n type CommandLineStringParameter,\r\n type ICommandLineActionOptions\r\n} from '@rushstack/ts-command-line';\r\nimport { FileSystem } from '@rushstack/node-core-library';\r\nimport {\r\n ApiModel,\r\n type ApiItem,\r\n ApiItemContainerMixin,\r\n ApiDocumentedItem,\r\n type IResolveDeclarationReferenceResult\r\n} from '@microsoft/api-extractor-model';\r\n\r\nexport interface IBuildApiModelResult {\r\n apiModel: ApiModel;\r\n inputFolder: string;\r\n outputFolder: string;\r\n}\r\n\r\nexport abstract class BaseAction extends CommandLineAction {\r\n private readonly _inputFolderParameter: CommandLineStringParameter;\r\n private readonly _outputFolderParameter: CommandLineStringParameter;\r\n\r\n protected constructor(options: ICommandLineActionOptions) {\r\n super(options);\r\n\r\n // override\r\n this._inputFolderParameter = this.defineStringParameter({\r\n parameterLongName: '--input-folder',\r\n parameterShortName: '-i',\r\n argumentName: 'FOLDER1',\r\n description:\r\n `Specifies the input folder containing the *.api.json files to be processed.` +\r\n ` If omitted, the default is \"./input\"`\r\n });\r\n\r\n this._outputFolderParameter = this.defineStringParameter({\r\n parameterLongName: '--output-folder',\r\n parameterShortName: '-o',\r\n argumentName: 'FOLDER2',\r\n description:\r\n `Specifies the output folder where the documentation will be written.` +\r\n ` ANY EXISTING CONTENTS WILL BE DELETED!` +\r\n ` If omitted, the default is \"./${this.actionName}\"`\r\n });\r\n }\r\n\r\n protected buildApiModel(): IBuildApiModelResult {\r\n const apiModel: ApiModel = new ApiModel();\r\n\r\n const inputFolder: string = this._inputFolderParameter.value || './input';\r\n if (!FileSystem.exists(inputFolder)) {\r\n throw new Error('The input folder does not exist: ' + inputFolder);\r\n }\r\n\r\n const outputFolder: string = this._outputFolderParameter.value || `./${this.actionName}`;\r\n FileSystem.ensureFolder(outputFolder);\r\n\r\n for (const filename of FileSystem.readFolderItemNames(inputFolder)) {\r\n if (filename.match(/\\.api\\.json$/i)) {\r\n console.log(`Reading ${filename}`);\r\n const filenamePath: string = path.join(inputFolder, filename);\r\n apiModel.loadPackage(filenamePath);\r\n }\r\n }\r\n\r\n this._applyInheritDoc(apiModel, apiModel);\r\n\r\n return { apiModel, inputFolder, outputFolder };\r\n }\r\n\r\n // TODO: This is a temporary workaround. The long term plan is for API Extractor's DocCommentEnhancer\r\n // to apply all @inheritDoc tags before the .api.json file is written.\r\n // See DocCommentEnhancer._applyInheritDoc() for more info.\r\n private _applyInheritDoc(apiItem: ApiItem, apiModel: ApiModel): void {\r\n if (apiItem instanceof ApiDocumentedItem) {\r\n if (apiItem.tsdocComment) {\r\n const inheritDocTag: tsdoc.DocInheritDocTag | undefined = apiItem.tsdocComment.inheritDocTag;\r\n\r\n if (inheritDocTag && inheritDocTag.declarationReference) {\r\n // Attempt to resolve the declaration reference\r\n const result: IResolveDeclarationReferenceResult = apiModel.resolveDeclarationReference(\r\n inheritDocTag.declarationReference,\r\n apiItem\r\n );\r\n\r\n if (result.errorMessage) {\r\n console.log(\r\n colors.yellow(\r\n `Warning: Unresolved @inheritDoc tag for ${apiItem.displayName}: ` + result.errorMessage\r\n )\r\n );\r\n } else {\r\n if (\r\n result.resolvedApiItem instanceof ApiDocumentedItem &&\r\n result.resolvedApiItem.tsdocComment &&\r\n result.resolvedApiItem !== apiItem\r\n ) {\r\n this._copyInheritedDocs(apiItem.tsdocComment, result.resolvedApiItem.tsdocComment);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Recurse members\r\n if (ApiItemContainerMixin.isBaseClassOf(apiItem)) {\r\n for (const member of apiItem.members) {\r\n this._applyInheritDoc(member, apiModel);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Copy the content from `sourceDocComment` to `targetDocComment`.\r\n * This code is borrowed from DocCommentEnhancer as a temporary workaround.\r\n */\r\n private _copyInheritedDocs(targetDocComment: tsdoc.DocComment, sourceDocComment: tsdoc.DocComment): void {\r\n targetDocComment.summarySection = sourceDocComment.summarySection;\r\n targetDocComment.remarksBlock = sourceDocComment.remarksBlock;\r\n\r\n targetDocComment.params.clear();\r\n for (const param of sourceDocComment.params) {\r\n targetDocComment.params.add(param);\r\n }\r\n for (const typeParam of sourceDocComment.typeParams) {\r\n targetDocComment.typeParams.add(typeParam);\r\n }\r\n targetDocComment.returnsBlock = sourceDocComment.returnsBlock;\r\n\r\n targetDocComment.inheritDocTag = undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"BaseAction.js","sourceRoot":"","sources":["../../src/cli/BaseAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAE7B,uDAAiC;AAEjC,gEAIoC;AACpC,oEAA0D;AAC1D,wEAMwC;AAQxC,MAAsB,UAAW,SAAQ,mCAAiB;IAIxD,YAAsB,OAAkC;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,WAAW;QACX,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACtD,iBAAiB,EAAE,gBAAgB;YACnC,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,SAAS;YACvB,WAAW,EACT,6EAA6E;gBAC7E,uCAAuC;SAC1C,CAAC,CAAC;QAEH,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACvD,iBAAiB,EAAE,iBAAiB;YACpC,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,SAAS;YACvB,WAAW,EACT,sEAAsE;gBACtE,yCAAyC;gBACzC,kCAAkC,IAAI,CAAC,UAAU,GAAG;SACvD,CAAC,CAAC;IACL,CAAC;IAES,aAAa;QACrB,MAAM,QAAQ,GAAa,IAAI,8BAAQ,EAAE,CAAC;QAE1C,MAAM,WAAW,GAAW,IAAI,CAAC,qBAAqB,CAAC,KAAK,IAAI,SAAS,CAAC;QAC1E,IAAI,CAAC,8BAAU,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;YACnC,MAAM,IAA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ACH;yBAAM;wBACL,IACE,MAAM,CAAC,eAAe,YAAY,uCAAiB;4BACnD,MAAM,CAAC,eAAe,CAAC,YAAY;4BACnC,MAAM,CAAC,eAAe,KAAK,OAAO,EAClC;4BACA,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;yBACpF;qBACF;iBACF;aACF;SACF;QAED,kBAAkB;QAClB,IAAI,2CAAqB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;YAChD,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;gBACpC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAED;;;OAGG;IACK,kBAAkB,CAAC,gBAAkC,EAAE,gBAAkC;QAC/F,gBAAgB,CAAC,cAAc,GAAG,gBAAgB,CAAC,cAAc,CAAC;QAClE,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAE9D,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3C,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpC;QACD,KAAK,MAAM,SAAS,IAAI,gBAAgB,CAAC,UAAU,EAAE;YACnD,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;SAC5C;QACD,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAE9D,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;IAC7C,CAAC;CACF;AAjHD,gCAiHC","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';\nimport type * as tsdoc from '@microsoft/tsdoc';\nimport colors from 'colors/safe';\n\nimport {\n CommandLineAction,\n type CommandLineStringParameter,\n type ICommandLineActionOptions\n} from '@rushstack/ts-command-line';\nimport { FileSystem } from '@rushstack/node-core-library';\nimport {\n ApiModel,\n type ApiItem,\n ApiItemContainerMixin,\n ApiDocumentedItem,\n type IResolveDeclarationReferenceResult\n} from '@microsoft/api-extractor-model';\n\nexport interface IBuildApiModelResult {\n apiModel: ApiModel;\n inputFolder: string;\n outputFolder: string;\n}\n\nexport abstract class BaseAction extends CommandLineAction {\n private readonly _inputFolderParameter: CommandLineStringParameter;\n private readonly _outputFolderParameter: CommandLineStringParameter;\n\n protected constructor(options: ICommandLineActionOptions) {\n super(options);\n\n // override\n this._inputFolderParameter = this.defineStringParameter({\n parameterLongName: '--input-folder',\n parameterShortName: '-i',\n argumentName: 'FOLDER1',\n description:\n `Specifies the input folder containing the *.api.json files to be processed.` +\n ` If omitted, the default is \"./input\"`\n });\n\n this._outputFolderParameter = this.defineStringParameter({\n parameterLongName: '--output-folder',\n parameterShortName: '-o',\n argumentName: 'FOLDER2',\n description:\n `Specifies the output folder where the documentation will be written.` +\n ` ANY EXISTING CONTENTS WILL BE DELETED!` +\n ` If omitted, the default is \"./${this.actionName}\"`\n });\n }\n\n protected buildApiModel(): IBuildApiModelResult {\n const apiModel: ApiModel = new ApiModel();\n\n const inputFolder: string = this._inputFolderParameter.value || './input';\n if (!FileSystem.exists(inputFolder)) {\n throw new Error('The input folder does not exist: ' + inputFolder);\n }\n\n const outputFolder: string = this._outputFolderParameter.value || `./${this.actionName}`;\n FileSystem.ensureFolder(outputFolder);\n\n for (const filename of FileSystem.readFolderItemNames(inputFolder)) {\n if (filename.match(/\\.api\\.json$/i)) {\n console.log(`Reading ${filename}`);\n const filenamePath: string = path.join(inputFolder, filename);\n apiModel.loadPackage(filenamePath);\n }\n }\n\n this._applyInheritDoc(apiModel, apiModel);\n\n return { apiModel, inputFolder, outputFolder };\n }\n\n // TODO: This is a temporary workaround. The long term plan is for API Extractor's DocCommentEnhancer\n // to apply all @inheritDoc tags before the .api.json file is written.\n // See DocCommentEnhancer._applyInheritDoc() for more info.\n private _applyInheritDoc(apiItem: ApiItem, apiModel: ApiModel): void {\n if (apiItem instanceof ApiDocumentedItem) {\n if (apiItem.tsdocComment) {\n const inheritDocTag: tsdoc.DocInheritDocTag | undefined = apiItem.tsdocComment.inheritDocTag;\n\n if (inheritDocTag && inheritDocTag.declarationReference) {\n // Attempt to resolve the declaration reference\n const result: IResolveDeclarationReferenceResult = apiModel.resolveDeclarationReference(\n inheritDocTag.declarationReference,\n apiItem\n );\n\n if (result.errorMessage) {\n console.log(\n colors.yellow(\n `Warning: Unresolved @inheritDoc tag for ${apiItem.displayName}: ` + result.errorMessage\n )\n );\n } else {\n if (\n result.resolvedApiItem instanceof ApiDocumentedItem &&\n result.resolvedApiItem.tsdocComment &&\n result.resolvedApiItem !== apiItem\n ) {\n this._copyInheritedDocs(apiItem.tsdocComment, result.resolvedApiItem.tsdocComment);\n }\n }\n }\n }\n }\n\n // Recurse members\n if (ApiItemContainerMixin.isBaseClassOf(apiItem)) {\n for (const member of apiItem.members) {\n this._applyInheritDoc(member, apiModel);\n }\n }\n }\n\n /**\n * Copy the content from `sourceDocComment` to `targetDocComment`.\n * This code is borrowed from DocCommentEnhancer as a temporary workaround.\n */\n private _copyInheritedDocs(targetDocComment: tsdoc.DocComment, sourceDocComment: tsdoc.DocComment): void {\n targetDocComment.summarySection = sourceDocComment.summarySection;\n targetDocComment.remarksBlock = sourceDocComment.remarksBlock;\n\n targetDocComment.params.clear();\n for (const param of sourceDocComment.params) {\n targetDocComment.params.add(param);\n }\n for (const typeParam of sourceDocComment.typeParams) {\n targetDocComment.typeParams.add(typeParam);\n }\n targetDocComment.returnsBlock = sourceDocComment.returnsBlock;\n\n targetDocComment.inheritDocTag = undefined;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GenerateAction.js","sourceRoot":"","sources":["../../src/cli/GenerateAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;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L,MAAM,cAAc,GAA+B,IAAI,uDAA0B,CAC/E,QAAQ,EACR,gBAAgB,CACjB,CAAC;YACF,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;SAC5C;IACH,CAAC;CACF;AA/CD,wCA+CC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as path from 'path';\r\n\r\nimport type { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\r\nimport { BaseAction } from './BaseAction';\r\nimport { DocumenterConfig } from '../documenters/DocumenterConfig';\r\nimport { ExperimentalYamlDocumenter } from '../documenters/ExperimentalYamlDocumenter';\r\n\r\nimport { FileSystem } from '@rushstack/node-core-library';\r\nimport { MarkdownDocumenter } from '../documenters/MarkdownDocumenter';\r\n\r\nexport class GenerateAction extends BaseAction {\r\n public constructor(parser: ApiDocumenterCommandLine) {\r\n super({\r\n actionName: 'generate',\r\n summary: 'EXPERIMENTAL',\r\n documentation:\r\n 'EXPERIMENTAL - This action is a prototype of a new config file driven mode of operation for' +\r\n ' API Documenter. It is not ready for general usage yet. Its design may change in the future.'\r\n });\r\n }\r\n\r\n protected async onExecute(): Promise<void> {\r\n // override\r\n // Look for the config file under the current folder\r\n\r\n let configFilePath: string = path.join(process.cwd(), DocumenterConfig.FILENAME);\r\n\r\n // First try the current folder\r\n if (!FileSystem.exists(configFilePath)) {\r\n // Otherwise try the standard \"config\" subfolder\r\n configFilePath = path.join(process.cwd(), 'config', DocumenterConfig.FILENAME);\r\n if (!FileSystem.exists(configFilePath)) {\r\n throw new Error(\r\n `Unable to find ${DocumenterConfig.FILENAME} in the current folder or in a \"config\" subfolder`\r\n );\r\n }\r\n }\r\n\r\n const documenterConfig: DocumenterConfig = DocumenterConfig.loadFile(configFilePath);\r\n\r\n const { apiModel, outputFolder } = this.buildApiModel();\r\n\r\n if (documenterConfig.configFile.outputTarget === 'markdown') {\r\n const markdownDocumenter: MarkdownDocumenter = new MarkdownDocumenter({\r\n apiModel,\r\n documenterConfig,\r\n outputFolder\r\n });\r\n markdownDocumenter.generateFiles();\r\n } else {\r\n const yamlDocumenter: ExperimentalYamlDocumenter = new ExperimentalYamlDocumenter(\r\n apiModel,\r\n documenterConfig\r\n );\r\n yamlDocumenter.generateFiles(outputFolder);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GenerateAction.js","sourceRoot":"","sources":["../../src/cli/GenerateAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAG7B,6CAA0C;AAC1C,sEAAmE;AACnE,0FAAuF;AAEvF,oEAA0D;AAC1D,0EAAuE;AAEvE,MAAa,cAAe,SAAQ,uBAAU;IAC5C,YAAmB,MAAgC;QACjD,KAAK,CAAC;YACJ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,cAAc;YACvB,aAAa,EACX,6FAA6F;gBAC7F,gGAAgG;SACnG,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,WAAW;QACX,oDAAoD;QAEpD,IAAI,cAAc,GAAW,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,mCAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjF,+BAA+B;QAC/B,IAAI,CAAC,8BAAU,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;YACtC,gDAAgD;YAChD,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,mCAAgB,CAAC,QAAQ,CAAC,CAAC;YAC/E,IAAI,CAAC,8BAAU,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;gBACtC,MAAM,IAAI,KAAK,CACb,kBAAkB,mCAAgB,CAAC,QAAQ,mDAAmD,CAC/F,CAAC;aACH;SACF;QAED,MAAM,gBAAgB,GAAqB,mCAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAErF,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAExD,IAAI,gBAAgB,CAAC,UAAU,CAAC,YAAY,KAAK,UAAU,EAAE;YAC3D,MAAM,kBAAkB,GAAuB,IAAI,uCAAkB,CAAC;gBACpE,QAAQ;gBACR,gBAAgB;gBAChB,YAAY;aACb,CAAC,CAAC;YACH,kBAAkB,CAAC,aAAa,EAAE,CAAC;SACpC;aAAM;YACL,MAAM,cAAc,GAA+B,IAAI,uDAA0B,CAC/E,QAAQ,EACR,gBAAgB,CACjB,CAAC;YACF,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;SAC5C;IACH,CAAC;CACF;AA/CD,wCA+CC","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 type { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\nimport { BaseAction } from './BaseAction';\nimport { DocumenterConfig } from '../documenters/DocumenterConfig';\nimport { ExperimentalYamlDocumenter } from '../documenters/ExperimentalYamlDocumenter';\n\nimport { FileSystem } from '@rushstack/node-core-library';\nimport { MarkdownDocumenter } from '../documenters/MarkdownDocumenter';\n\nexport class GenerateAction extends BaseAction {\n public constructor(parser: ApiDocumenterCommandLine) {\n super({\n actionName: 'generate',\n summary: 'EXPERIMENTAL',\n documentation:\n 'EXPERIMENTAL - This action is a prototype of a new config file driven mode of operation for' +\n ' API Documenter. It is not ready for general usage yet. Its design may change in the future.'\n });\n }\n\n protected async onExecute(): Promise<void> {\n // override\n // Look for the config file under the current folder\n\n let configFilePath: string = path.join(process.cwd(), DocumenterConfig.FILENAME);\n\n // First try the current folder\n if (!FileSystem.exists(configFilePath)) {\n // Otherwise try the standard \"config\" subfolder\n configFilePath = path.join(process.cwd(), 'config', DocumenterConfig.FILENAME);\n if (!FileSystem.exists(configFilePath)) {\n throw new Error(\n `Unable to find ${DocumenterConfig.FILENAME} in the current folder or in a \"config\" subfolder`\n );\n }\n }\n\n const documenterConfig: DocumenterConfig = DocumenterConfig.loadFile(configFilePath);\n\n const { apiModel, outputFolder } = this.buildApiModel();\n\n if (documenterConfig.configFile.outputTarget === 'markdown') {\n const markdownDocumenter: MarkdownDocumenter = new MarkdownDocumenter({\n apiModel,\n documenterConfig,\n outputFolder\n });\n markdownDocumenter.generateFiles();\n } else {\n const yamlDocumenter: ExperimentalYamlDocumenter = new ExperimentalYamlDocumenter(\n apiModel,\n documenterConfig\n );\n yamlDocumenter.generateFiles(outputFolder);\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownAction.js","sourceRoot":"","sources":["../../src/cli/MarkdownAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,6CAA0C;AAC1C,0EAAuE;AAEvE,MAAa,cAAe,SAAQ,uBAAU;IAC5C,YAAmB,MAAgC;QACjD,KAAK,CAAC;YACJ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,iDAAiD;YAC1D,aAAa,EACX,yDAAyD;gBACzD,yEAAyE;SAC5E,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,WAAW;QACX,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAExD,MAAM,kBAAkB,GAAuB,IAAI,uCAAkB,CAAC;YACpE,QAAQ;YACR,gBAAgB,EAAE,SAAS;YAC3B,YAAY;SACb,CAAC,CAAC;QACH,kBAAkB,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;CACF;AAtBD,wCAsBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\r\nimport { BaseAction } from './BaseAction';\r\nimport { MarkdownDocumenter } from '../documenters/MarkdownDocumenter';\r\n\r\nexport class MarkdownAction extends BaseAction {\r\n public constructor(parser: ApiDocumenterCommandLine) {\r\n super({\r\n actionName: 'markdown',\r\n summary: 'Generate documentation as Markdown files (*.md)',\r\n documentation:\r\n 'Generates API documentation as a collection of files in' +\r\n ' Markdown format, suitable for example for publishing on a GitHub site.'\r\n });\r\n }\r\n\r\n protected async onExecute(): Promise<void> {\r\n // override\r\n const { apiModel, outputFolder } = this.buildApiModel();\r\n\r\n const markdownDocumenter: MarkdownDocumenter = new MarkdownDocumenter({\r\n apiModel,\r\n documenterConfig: undefined,\r\n outputFolder\r\n });\r\n markdownDocumenter.generateFiles();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MarkdownAction.js","sourceRoot":"","sources":["../../src/cli/MarkdownAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,6CAA0C;AAC1C,0EAAuE;AAEvE,MAAa,cAAe,SAAQ,uBAAU;IAC5C,YAAmB,MAAgC;QACjD,KAAK,CAAC;YACJ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,iDAAiD;YAC1D,aAAa,EACX,yDAAyD;gBACzD,yEAAyE;SAC5E,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,WAAW;QACX,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAExD,MAAM,kBAAkB,GAAuB,IAAI,uCAAkB,CAAC;YACpE,QAAQ;YACR,gBAAgB,EAAE,SAAS;YAC3B,YAAY;SACb,CAAC,CAAC;QACH,kBAAkB,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;CACF;AAtBD,wCAsBC","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 { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\nimport { BaseAction } from './BaseAction';\nimport { MarkdownDocumenter } from '../documenters/MarkdownDocumenter';\n\nexport class MarkdownAction extends BaseAction {\n public constructor(parser: ApiDocumenterCommandLine) {\n super({\n actionName: 'markdown',\n summary: 'Generate documentation as Markdown files (*.md)',\n documentation:\n 'Generates API documentation as a collection of files in' +\n ' Markdown format, suitable for example for publishing on a GitHub site.'\n });\n }\n\n protected async onExecute(): Promise<void> {\n // override\n const { apiModel, outputFolder } = this.buildApiModel();\n\n const markdownDocumenter: MarkdownDocumenter = new MarkdownDocumenter({\n apiModel,\n documenterConfig: undefined,\n outputFolder\n });\n markdownDocumenter.generateFiles();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"YamlAction.js","sourceRoot":"","sources":["../../src/cli/YamlAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D,6CAA0C;AAE1C,kEAA+D;AAC/D,8EAA2E;AAE3E,MAAa,UAAW,SAAQ,uBAAU;IAKxC,YAAmB,MAAgC;QACjD,KAAK,CAAC;YACJ,UAAU,EAAE,MAAM;YAClB,OAAO,EAAE,kEAAkE;YAC3E,aAAa,EACX,iEAAiE;gBACjE,kFAAkF;gBAClF,YAAY;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC/C,iBAAiB,EAAE,UAAU;YAC7B,WAAW,EAAE,6DAA6D;SAC3E,CAAC,CAAC;QACH,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC3D,iBAAiB,EAAE,wBAAwB;YAC3C,WAAW,EACT,mGAAmG;gBACnG,oGAAoG;gBACpG,4GAA4G;gBAC5G,0EAA0E;SAC7E,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACrD,iBAAiB,EAAE,eAAe;YAClC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YAC5B,YAAY,EAAE,KAAK;YACnB,WAAW,EACT,6GAA6G;gBAC7G,yFAAyF;gBACzF,uDAAuD;SAC1D,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,WAAW;QACX,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAErE,MAAM,cAAc,GAAmB,IAAI,CAAC,gBAAgB,CAAC,KAAK;YAChE,CAAC,CAAC,IAAI,2CAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC;YAC1F,CAAC,CAAC,IAAI,+BAAc,CAChB,QAAQ,EACR,IAAI,CAAC,4BAA4B,CAAC,KAAK,EACvC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAChC,CAAC;QAEN,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;CACF;AApDD,gCAoDC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type { CommandLineFlagParameter, CommandLineChoiceParameter } from '@rushstack/ts-command-line';\r\n\r\nimport type { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\r\nimport { BaseAction } from './BaseAction';\r\n\r\nimport { YamlDocumenter } from '../documenters/YamlDocumenter';\r\nimport { OfficeYamlDocumenter } from '../documenters/OfficeYamlDocumenter';\r\n\r\nexport class YamlAction extends BaseAction {\r\n private readonly _officeParameter: CommandLineFlagParameter;\r\n private readonly _newDocfxNamespacesParameter: CommandLineFlagParameter;\r\n private readonly _yamlFormatParameter: CommandLineChoiceParameter;\r\n\r\n public constructor(parser: ApiDocumenterCommandLine) {\r\n super({\r\n actionName: 'yaml',\r\n summary: 'Generate documentation as universal reference YAML files (*.yml)',\r\n documentation:\r\n 'Generates API documentation as a collection of files conforming' +\r\n ' to the universal reference YAML format, which is used by the docs.microsoft.com' +\r\n ' pipeline.'\r\n });\r\n\r\n this._officeParameter = this.defineFlagParameter({\r\n parameterLongName: '--office',\r\n description: `Enables some additional features specific to Office Add-ins`\r\n });\r\n this._newDocfxNamespacesParameter = this.defineFlagParameter({\r\n parameterLongName: '--new-docfx-namespaces',\r\n description:\r\n `This enables an experimental feature that will be officially released with the next major version` +\r\n ` of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and` +\r\n ` adds them to the table of contents. This will also affect file layout as namespaced items will be nested` +\r\n ` under a directory for the namespace instead of just within the package.`\r\n });\r\n this._yamlFormatParameter = this.defineChoiceParameter({\r\n parameterLongName: '--yaml-format',\r\n alternatives: ['udp', 'sdp'],\r\n defaultValue: 'sdp',\r\n description:\r\n `Specifies the YAML format - udp or sdp. Universal Document Processor (udp) should be used if you generating` +\r\n ` YAML files for DocFX 2.x. Schema Driven Processor (sdp) should be used with DocFX 3.x.` +\r\n ` NOTE: This parameter is ignored if you use --office.`\r\n });\r\n }\r\n\r\n protected async onExecute(): Promise<void> {\r\n // override\r\n const { apiModel, inputFolder, outputFolder } = this.buildApiModel();\r\n\r\n const yamlDocumenter: YamlDocumenter = this._officeParameter.value\r\n ? new OfficeYamlDocumenter(apiModel, inputFolder, this._newDocfxNamespacesParameter.value)\r\n : new YamlDocumenter(\r\n apiModel,\r\n this._newDocfxNamespacesParameter.value,\r\n this._yamlFormatParameter.value\r\n );\r\n\r\n yamlDocumenter.generateFiles(outputFolder);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"YamlAction.js","sourceRoot":"","sources":["../../src/cli/YamlAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D,6CAA0C;AAE1C,kEAA+D;AAC/D,8EAA2E;AAE3E,MAAa,UAAW,SAAQ,uBAAU;IAKxC,YAAmB,MAAgC;QACjD,KAAK,CAAC;YACJ,UAAU,EAAE,MAAM;YAClB,OAAO,EAAE,kEAAkE;YAC3E,aAAa,EACX,iEAAiE;gBACjE,kFAAkF;gBAClF,YAAY;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC/C,iBAAiB,EAAE,UAAU;YAC7B,WAAW,EAAE,6DAA6D;SAC3E,CAAC,CAAC;QACH,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC3D,iBAAiB,EAAE,wBAAwB;YAC3C,WAAW,EACT,mGAAmG;gBACnG,oGAAoG;gBACpG,4GAA4G;gBAC5G,0EAA0E;SAC7E,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACrD,iBAAiB,EAAE,eAAe;YAClC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YAC5B,YAAY,EAAE,KAAK;YACnB,WAAW,EACT,6GAA6G;gBAC7G,yFAAyF;gBACzF,uDAAuD;SAC1D,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,WAAW;QACX,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAErE,MAAM,cAAc,GAAmB,IAAI,CAAC,gBAAgB,CAAC,KAAK;YAChE,CAAC,CAAC,IAAI,2CAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC;YAC1F,CAAC,CAAC,IAAI,+BAAc,CAChB,QAAQ,EACR,IAAI,CAAC,4BAA4B,CAAC,KAAK,EACvC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAChC,CAAC;QAEN,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;CACF;AApDD,gCAoDC","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 { CommandLineFlagParameter, CommandLineChoiceParameter } from '@rushstack/ts-command-line';\n\nimport type { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\nimport { BaseAction } from './BaseAction';\n\nimport { YamlDocumenter } from '../documenters/YamlDocumenter';\nimport { OfficeYamlDocumenter } from '../documenters/OfficeYamlDocumenter';\n\nexport class YamlAction extends BaseAction {\n private readonly _officeParameter: CommandLineFlagParameter;\n private readonly _newDocfxNamespacesParameter: CommandLineFlagParameter;\n private readonly _yamlFormatParameter: CommandLineChoiceParameter;\n\n public constructor(parser: ApiDocumenterCommandLine) {\n super({\n actionName: 'yaml',\n summary: 'Generate documentation as universal reference YAML files (*.yml)',\n documentation:\n 'Generates API documentation as a collection of files conforming' +\n ' to the universal reference YAML format, which is used by the docs.microsoft.com' +\n ' pipeline.'\n });\n\n this._officeParameter = this.defineFlagParameter({\n parameterLongName: '--office',\n description: `Enables some additional features specific to Office Add-ins`\n });\n this._newDocfxNamespacesParameter = this.defineFlagParameter({\n parameterLongName: '--new-docfx-namespaces',\n description:\n `This enables an experimental feature that will be officially released with the next major version` +\n ` of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and` +\n ` adds them to the table of contents. This will also affect file layout as namespaced items will be nested` +\n ` under a directory for the namespace instead of just within the package.`\n });\n this._yamlFormatParameter = this.defineChoiceParameter({\n parameterLongName: '--yaml-format',\n alternatives: ['udp', 'sdp'],\n defaultValue: 'sdp',\n description:\n `Specifies the YAML format - udp or sdp. Universal Document Processor (udp) should be used if you generating` +\n ` YAML files for DocFX 2.x. Schema Driven Processor (sdp) should be used with DocFX 3.x.` +\n ` NOTE: This parameter is ignored if you use --office.`\n });\n }\n\n protected async onExecute(): Promise<void> {\n // override\n const { apiModel, inputFolder, outputFolder } = this.buildApiModel();\n\n const yamlDocumenter: YamlDocumenter = this._officeParameter.value\n ? new OfficeYamlDocumenter(apiModel, inputFolder, this._newDocfxNamespacesParameter.value)\n : new YamlDocumenter(\n apiModel,\n this._newDocfxNamespacesParameter.value,\n this._yamlFormatParameter.value\n );\n\n yamlDocumenter.generateFiles(outputFolder);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumenterConfig.js","sourceRoot":"","sources":["../../src/documenters/DocumenterConfig.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAiF;AAEjF,uGAAwE;AAExE;;;;GAIG;AACH,MAAa,gBAAgB;IAoB3B,YAAoB,QAAgB,EAAE,UAAuB;QAC3D,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,QAAQ,UAAU,CAAC,WAAW,EAAE;YAC9B,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,EAAE,CAAC;gBAClC,MAAM;YACR,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,SAAS,CAAC;gBACzC,MAAM;YACR;gBACE,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,IAAI,CAAC;gBACpC,MAAM;SACT;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,cAAsB;QAC3C,MAAM,UAAU,GAAgB,4BAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEtG,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;;AAlCD;;GAEG;AACoB,2BAAU,GAAe,8BAAU,CAAC,gBAAgB,CAAC,oCAAmB,CAAC,CAAC;AAEjG;;GAEG;AACoB,yBAAQ,GAAW,qBAAqB,CAAC;AAlBrD,4CAAgB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as path from 'path';\r\nimport { JsonSchema, JsonFile, NewlineKind } from '@rushstack/node-core-library';\r\nimport type { IConfigFile } from './IConfigFile';\r\nimport apiDocumenterSchema from '../schemas/api-documenter.schema.json';\r\n\r\n/**\r\n * Helper for loading the api-documenter.json file format. Later when the schema is more mature,\r\n * this class will be used to represent the validated and normalized configuration, whereas `IConfigFile`\r\n * represents the raw JSON file structure.\r\n */\r\nexport class DocumenterConfig {\r\n public readonly configFilePath: string;\r\n public readonly configFile: IConfigFile;\r\n\r\n /**\r\n * Specifies what type of newlines API Documenter should use when writing output files. By default, the output files\r\n * will be written with Windows-style newlines.\r\n */\r\n public readonly newlineKind: NewlineKind;\r\n\r\n /**\r\n * The JSON Schema for API Documenter config file (api-documenter.schema.json).\r\n */\r\n public static readonly jsonSchema: JsonSchema = JsonSchema.fromLoadedObject(apiDocumenterSchema);\r\n\r\n /**\r\n * The config file name \"api-documenter.json\".\r\n */\r\n public static readonly FILENAME: string = 'api-documenter.json';\r\n\r\n private constructor(filePath: string, configFile: IConfigFile) {\r\n this.configFilePath = filePath;\r\n this.configFile = configFile;\r\n\r\n switch (configFile.newlineKind) {\r\n case 'lf':\r\n this.newlineKind = NewlineKind.Lf;\r\n break;\r\n case 'os':\r\n this.newlineKind = NewlineKind.OsDefault;\r\n break;\r\n default:\r\n this.newlineKind = NewlineKind.CrLf;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Load and validate an api-documenter.json file.\r\n */\r\n public static loadFile(configFilePath: string): DocumenterConfig {\r\n const configFile: IConfigFile = JsonFile.loadAndValidate(configFilePath, DocumenterConfig.jsonSchema);\r\n\r\n return new DocumenterConfig(path.resolve(configFilePath), configFile);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"DocumenterConfig.js","sourceRoot":"","sources":["../../src/documenters/DocumenterConfig.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAiF;AAEjF,uGAAwE;AAExE;;;;GAIG;AACH,MAAa,gBAAgB;IAoB3B,YAAoB,QAAgB,EAAE,UAAuB;QAC3D,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,QAAQ,UAAU,CAAC,WAAW,EAAE;YAC9B,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,EAAE,CAAC;gBAClC,MAAM;YACR,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,SAAS,CAAC;gBACzC,MAAM;YACR;gBACE,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,IAAI,CAAC;gBACpC,MAAM;SACT;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,cAAsB;QAC3C,MAAM,UAAU,GAAgB,4BAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEtG,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;;AAlCD;;GAEG;AACoB,2BAAU,GAAe,8BAAU,CAAC,gBAAgB,CAAC,oCAAmB,CAAC,CAAC;AAEjG;;GAEG;AACoB,yBAAQ,GAAW,qBAAqB,CAAC;AAlBrD,4CAAgB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { JsonSchema, JsonFile, NewlineKind } from '@rushstack/node-core-library';\nimport type { IConfigFile } from './IConfigFile';\nimport apiDocumenterSchema from '../schemas/api-documenter.schema.json';\n\n/**\n * Helper for loading the api-documenter.json file format. Later when the schema is more mature,\n * this class will be used to represent the validated and normalized configuration, whereas `IConfigFile`\n * represents the raw JSON file structure.\n */\nexport class DocumenterConfig {\n public readonly configFilePath: string;\n public readonly configFile: IConfigFile;\n\n /**\n * Specifies what type of newlines API Documenter should use when writing output files. By default, the output files\n * will be written with Windows-style newlines.\n */\n public readonly newlineKind: NewlineKind;\n\n /**\n * The JSON Schema for API Documenter config file (api-documenter.schema.json).\n */\n public static readonly jsonSchema: JsonSchema = JsonSchema.fromLoadedObject(apiDocumenterSchema);\n\n /**\n * The config file name \"api-documenter.json\".\n */\n public static readonly FILENAME: string = 'api-documenter.json';\n\n private constructor(filePath: string, configFile: IConfigFile) {\n this.configFilePath = filePath;\n this.configFile = configFile;\n\n switch (configFile.newlineKind) {\n case 'lf':\n this.newlineKind = NewlineKind.Lf;\n break;\n case 'os':\n this.newlineKind = NewlineKind.OsDefault;\n break;\n default:\n this.newlineKind = NewlineKind.CrLf;\n break;\n }\n }\n\n /**\n * Load and validate an api-documenter.json file.\n */\n public static loadFile(configFilePath: string): DocumenterConfig {\n const configFile: IConfigFile = JsonFile.loadAndValidate(configFilePath, DocumenterConfig.jsonSchema);\n\n return new DocumenterConfig(path.resolve(configFilePath), configFile);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ExperimentalYamlDocumenter.js","sourceRoot":"","sources":["../../src/documenters/ExperimentalYamlDocumenter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,4CAAiE;AACjE,wEAA6G;AAI7G,qDAAkD;AAGlD;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,+BAAc;IAK5D,YAAmB,QAAkB,EAAE,gBAAkC;QACvE,KAAK,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,eAAgB,CAAC;QAE5D,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QAEzB,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,gBAAgB;IACN,gBAAgB,CAAC,QAAgC;QACzD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,IAAI,C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F;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,8BAA8B,CAAC,IAAkB;QACvD,MAAM,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACnD,IAAI,yBAAyB,IAAI,yBAAyB,CAAC,MAAM,EAAE;YACjE,OAAO,yBAAyB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAC5D;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArJD,gEAqJC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { type DocComment, DocInlineTag } from '@microsoft/tsdoc';\r\nimport { type ApiModel, type ApiItem, ApiItemKind, ApiDocumentedItem } from '@microsoft/api-extractor-model';\r\n\r\nimport type { IConfigTableOfContents } from './IConfigFile';\r\nimport type { IYamlTocItem, IYamlTocFile } from '../yaml/IYamlTocFile';\r\nimport { YamlDocumenter } from './YamlDocumenter';\r\nimport type { DocumenterConfig } from './DocumenterConfig';\r\n\r\n/**\r\n * EXPERIMENTAL - This documenter is a prototype of a new config file driven mode of operation for\r\n * API Documenter. It is not ready for general usage yet. Its design may change in the future.\r\n */\r\nexport class ExperimentalYamlDocumenter extends YamlDocumenter {\r\n private _config: IConfigTableOfContents;\r\n private _tocPointerMap: { [key: string]: IYamlTocItem };\r\n private _catchAllPointer: IYamlTocItem | undefined;\r\n\r\n public constructor(apiModel: ApiModel, documenterConfig: DocumenterConfig) {\r\n super(apiModel, documenterConfig.configFile.newDocfxNamespaces);\r\n this._config = documenterConfig.configFile.tableOfContents!;\r\n\r\n this._tocPointerMap = {};\r\n\r\n this._generateTocPointersMap(this._config.tocConfig);\r\n }\r\n\r\n /** @override */\r\n protected buildYamlTocFile(apiItems: ReadonlyArray<ApiItem>): IYamlTocFile {\r\n this._buildTocItems2(apiItems);\r\n return this._config.tocConfig;\r\n }\r\n\r\n private _buildTocItems2(apiItems: ReadonlyArray<ApiItem>): IYamlTocItem[] {\r\n const tocItems: IYamlTocItem[] = [];\r\n for (const apiItem of apiItems) {\r\n let tocItem: IYamlTocItem;\r\n if (apiItem.kind === ApiItemKind.Namespace && !this.newDocfxNamespaces) {\r\n tocItem = {\r\n name: this._getTocItemName(apiItem)\r\n };\r\n } else {\r\n if (this._shouldEmbed(apiItem.kind)) {\r\n // Don't generate table of contents items for embedded definitions\r\n continue;\r\n }\r\n\r\n tocItem = {\r\n name: this._getTocItemName(apiItem),\r\n uid: this._getUid(apiItem)\r\n };\r\n\r\n if (apiItem.kind !== ApiItemKind.Package) {\r\n this._filterItem(apiItem, tocItem);\r\n }\r\n }\r\n\r\n tocItems.push(tocItem);\r\n\r\n const children: ApiItem[] = this._getLogicalChildren(apiItem);\r\n const childItems: IYamlTocItem[] = this._buildTocItems2(children);\r\n if (childItems.length > 0) {\r\n tocItem.items = childItems;\r\n }\r\n }\r\n return tocItems;\r\n }\r\n\r\n // Parses the tocConfig object to build a pointers map of nodes where we want to sort out the API items\r\n private _generateTocPointersMap(tocConfig: IYamlTocFile | IYamlTocItem): void {\r\n const { catchAllCategory } = this._config;\r\n\r\n if (tocConfig.items) {\r\n for (const tocItem of tocConfig.items) {\r\n if (tocItem.items && tocItem.items.length > 0 && this._shouldNotIncludeInPointersMap(tocItem)) {\r\n this._generateTocPointersMap(tocItem);\r\n } else {\r\n // check for presence of the `catchAllCategory` config option\r\n if (catchAllCategory && tocItem.name === catchAllCategory) {\r\n this._catchAllPointer = tocItem;\r\n } else {\r\n this._tocPointerMap[tocItem.name] = tocItem;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Filtering out the api-item by inlineTags or category name presence in the item name.\r\n */\r\n private _filterItem(apiItem: ApiItem, tocItem: IYamlTocItem): void {\r\n const { categoryInlineTag, categorizeByName } = this._config;\r\n const { name: itemName } = tocItem;\r\n let filtered: boolean = false;\r\n\r\n // First we attempt to filter by inline tag if provided.\r\n if (apiItem instanceof ApiDocumentedItem) {\r\n const docInlineTag: DocInlineTag | undefined = categoryInlineTag\r\n ? this._findInlineTagByName(categoryInlineTag, apiItem.tsdocComment)\r\n : undefined;\r\n\r\n const tagContent: string | undefined =\r\n docInlineTag && docInlineTag.tagContent && docInlineTag.tagContent.trim();\r\n\r\n if (tagContent && this._tocPointerMap[tagContent]) {\r\n // null assertion used because when pointer map was created we checked for presence of empty `items` array\r\n this._tocPointerMap[tagContent].items!.push(tocItem);\r\n filtered = true;\r\n }\r\n }\r\n\r\n // If not filtered by inline tag and `categorizeByName` config is enabled attempt to filter it by category name.\r\n if (!filtered && categorizeByName) {\r\n const pointers: string[] = Object.keys(this._tocPointerMap);\r\n for (let i: number = 0, length: number = pointers.length; i < length; i++) {\r\n if (itemName.indexOf(pointers[i]) !== -1) {\r\n // null assertion used because when pointer map was created we checked for presence of empty `items` array\r\n this._tocPointerMap[pointers[i]].items!.push(tocItem);\r\n filtered = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // If item still not filtered and a `catchAllCategory` config provided push it to it.\r\n if (!filtered && this._catchAllPointer && this._catchAllPointer.items) {\r\n this._catchAllPointer.items.push(tocItem);\r\n }\r\n }\r\n\r\n // This is a direct copy of a @docCategory inline tag finder in office-ui-fabric-react,\r\n // but is generic enough to be used for any inline tag\r\n private _findInlineTagByName(\r\n tagName: string,\r\n docComment: DocComment | undefined\r\n ): DocInlineTag | undefined {\r\n const tagNameToCheck: string = `@${tagName}`;\r\n\r\n if (docComment instanceof DocInlineTag) {\r\n if (docComment.tagName === tagNameToCheck) {\r\n return docComment;\r\n }\r\n }\r\n if (docComment) {\r\n for (const childNode of docComment.getChildNodes()) {\r\n const result: DocInlineTag | undefined = this._findInlineTagByName(tagName, childNode as DocComment);\r\n if (result !== undefined) {\r\n return result;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n private _shouldNotIncludeInPointersMap(item: IYamlTocItem): boolean {\r\n const { nonEmptyCategoryNodeNames } = this._config;\r\n if (nonEmptyCategoryNodeNames && nonEmptyCategoryNodeNames.length) {\r\n return nonEmptyCategoryNodeNames.indexOf(item.name) === -1;\r\n }\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ExperimentalYamlDocumenter.js","sourceRoot":"","sources":["../../src/documenters/ExperimentalYamlDocumenter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,4CAAiE;AACjE,wEAA6G;AAI7G,qDAAkD;AAGlD;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,+BAAc;IAK5D,YAAmB,QAAkB,EAAE,gBAAkC;QACvE,KAAK,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,eAAgB,CAAC;QAE5D,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QAEzB,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,gBAAgB;IACN,gBAAgB,CAAC,QAAgC;QACzD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAChC,CAAC;IAEO,eAAe,CAAC,QAAgC;QACtD,MAAM,QAAQ,GAAmB,EAAE,CAAC;QACpC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,IAAI,OAAqB,CAAC;YAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,iCAAW,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;gBACtE,OAAO,GAAG;oBACR,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;iBACpC,CAAC;aACH;iBAAM;gBACL,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACnC,kEAAkE;oBA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AC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACtD,QAAQ,GAAG,IAAI,CAAC;oBAChB,MAAM;iBACP;aACF;SACF;QAED,qFAAqF;QACrF,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE;YACrE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC3C;IACH,CAAC;IAED,uFAAuF;IACvF,sDAAsD;IAC9C,oBAAoB,CAC1B,OAAe,EACf,UAAkC;QAElC,MAAM,cAAc,GAAW,IAAI,OAAO,EAAE,CAAC;QAE7C,IAAI,UAAU,YAAY,oBAAY,EAAE;YACtC,IAAI,UAAU,CAAC,OAAO,KAAK,cAAc,EAAE;gBACzC,OAAO,UAAU,CAAC;aACnB;SACF;QACD,IAAI,UAAU,EAAE;YACd,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,aAAa,EAAE,EAAE;gBAClD,MAAM,MAAM,GAA6B,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAuB,CAAC,CAAC;gBACrG,IAAI,MAAM,KAAK,SAAS,EAAE;oBACxB,OAAO,MAAM,CAAC;iBACf;aACF;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,8BAA8B,CAAC,IAAkB;QACvD,MAAM,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACnD,IAAI,yBAAyB,IAAI,yBAAyB,CAAC,MAAM,EAAE;YACjE,OAAO,yBAAyB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAC5D;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArJD,gEAqJC","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 DocComment, DocInlineTag } from '@microsoft/tsdoc';\nimport { type ApiModel, type ApiItem, ApiItemKind, ApiDocumentedItem } from '@microsoft/api-extractor-model';\n\nimport type { IConfigTableOfContents } from './IConfigFile';\nimport type { IYamlTocItem, IYamlTocFile } from '../yaml/IYamlTocFile';\nimport { YamlDocumenter } from './YamlDocumenter';\nimport type { DocumenterConfig } from './DocumenterConfig';\n\n/**\n * EXPERIMENTAL - This documenter is a prototype of a new config file driven mode of operation for\n * API Documenter. It is not ready for general usage yet. Its design may change in the future.\n */\nexport class ExperimentalYamlDocumenter extends YamlDocumenter {\n private _config: IConfigTableOfContents;\n private _tocPointerMap: { [key: string]: IYamlTocItem };\n private _catchAllPointer: IYamlTocItem | undefined;\n\n public constructor(apiModel: ApiModel, documenterConfig: DocumenterConfig) {\n super(apiModel, documenterConfig.configFile.newDocfxNamespaces);\n this._config = documenterConfig.configFile.tableOfContents!;\n\n this._tocPointerMap = {};\n\n this._generateTocPointersMap(this._config.tocConfig);\n }\n\n /** @override */\n protected buildYamlTocFile(apiItems: ReadonlyArray<ApiItem>): IYamlTocFile {\n this._buildTocItems2(apiItems);\n return this._config.tocConfig;\n }\n\n private _buildTocItems2(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 if (apiItem.kind !== ApiItemKind.Package) {\n this._filterItem(apiItem, tocItem);\n }\n }\n\n tocItems.push(tocItem);\n\n const children: ApiItem[] = this._getLogicalChildren(apiItem);\n const childItems: IYamlTocItem[] = this._buildTocItems2(children);\n if (childItems.length > 0) {\n tocItem.items = childItems;\n }\n }\n return tocItems;\n }\n\n // Parses the tocConfig object to build a pointers map of nodes where we want to sort out the API items\n private _generateTocPointersMap(tocConfig: IYamlTocFile | IYamlTocItem): void {\n const { catchAllCategory } = this._config;\n\n if (tocConfig.items) {\n for (const tocItem of tocConfig.items) {\n if (tocItem.items && tocItem.items.length > 0 && this._shouldNotIncludeInPointersMap(tocItem)) {\n this._generateTocPointersMap(tocItem);\n } else {\n // check for presence of the `catchAllCategory` config option\n if (catchAllCategory && tocItem.name === catchAllCategory) {\n this._catchAllPointer = tocItem;\n } else {\n this._tocPointerMap[tocItem.name] = tocItem;\n }\n }\n }\n }\n }\n\n /**\n * Filtering out the api-item by inlineTags or category name presence in the item name.\n */\n private _filterItem(apiItem: ApiItem, tocItem: IYamlTocItem): void {\n const { categoryInlineTag, categorizeByName } = this._config;\n const { name: itemName } = tocItem;\n let filtered: boolean = false;\n\n // First we attempt to filter by inline tag if provided.\n if (apiItem instanceof ApiDocumentedItem) {\n const docInlineTag: DocInlineTag | undefined = categoryInlineTag\n ? this._findInlineTagByName(categoryInlineTag, apiItem.tsdocComment)\n : undefined;\n\n const tagContent: string | undefined =\n docInlineTag && docInlineTag.tagContent && docInlineTag.tagContent.trim();\n\n if (tagContent && this._tocPointerMap[tagContent]) {\n // null assertion used because when pointer map was created we checked for presence of empty `items` array\n this._tocPointerMap[tagContent].items!.push(tocItem);\n filtered = true;\n }\n }\n\n // If not filtered by inline tag and `categorizeByName` config is enabled attempt to filter it by category name.\n if (!filtered && categorizeByName) {\n const pointers: string[] = Object.keys(this._tocPointerMap);\n for (let i: number = 0, length: number = pointers.length; i < length; i++) {\n if (itemName.indexOf(pointers[i]) !== -1) {\n // null assertion used because when pointer map was created we checked for presence of empty `items` array\n this._tocPointerMap[pointers[i]].items!.push(tocItem);\n filtered = true;\n break;\n }\n }\n }\n\n // If item still not filtered and a `catchAllCategory` config provided push it to it.\n if (!filtered && this._catchAllPointer && this._catchAllPointer.items) {\n this._catchAllPointer.items.push(tocItem);\n }\n }\n\n // This is a direct copy of a @docCategory inline tag finder in office-ui-fabric-react,\n // but is generic enough to be used for any inline tag\n private _findInlineTagByName(\n tagName: string,\n docComment: DocComment | undefined\n ): DocInlineTag | undefined {\n const tagNameToCheck: string = `@${tagName}`;\n\n if (docComment instanceof DocInlineTag) {\n if (docComment.tagName === tagNameToCheck) {\n return docComment;\n }\n }\n if (docComment) {\n for (const childNode of docComment.getChildNodes()) {\n const result: DocInlineTag | undefined = this._findInlineTagByName(tagName, childNode as DocComment);\n if (result !== undefined) {\n return result;\n }\n }\n }\n return undefined;\n }\n\n private _shouldNotIncludeInPointersMap(item: IYamlTocItem): boolean {\n const { nonEmptyCategoryNodeNames } = this._config;\n if (nonEmptyCategoryNodeNames && nonEmptyCategoryNodeNames.length) {\n return nonEmptyCategoryNodeNames.indexOf(item.name) === -1;\n }\n return true;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IConfigFile.js","sourceRoot":"","sources":["../../src/documenters/IConfigFile.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type { IYamlTocFile } from '../yaml/IYamlTocFile';\r\n\r\n/**\r\n * Typescript interface describing the config schema for toc.yml file format.\r\n */\r\nexport interface IConfigTableOfContents {\r\n /**\r\n * Represents the tree structure describing the toc.file format.\r\n * Nodes that have an empty `items` array property or their name will be included in the\r\n * {@link IConfigTableOfContents.nonEmptyCategoryNodeNames} will be filled with API items\r\n * that are matched with the filters provided. Everything else will be placed under\r\n * {@link IConfigTableOfContents.catchAllCategory} if provided, which is highly recommended.\r\n */\r\n tocConfig: IYamlTocFile;\r\n\r\n /**\r\n * Optional category name that is recommended to be included along with\r\n * one of the configs: {@link IConfigTableOfContents.categorizeByName} or\r\n * {@link IConfigTableOfContents.categoryInlineTag}.\r\n * Any items that are not matched according to the mentioned configuration options will be placed under this\r\n * catchAll category. If none provided the items will not be included in the final toc.yml file.\r\n */\r\n catchAllCategory?: string;\r\n\r\n /**\r\n * Toggle either categorization of the API items should be made based on category name presence\r\n * in the API item's name. Useful when there are API items without an inline tag to categorize them,\r\n * but still need to place the items under categories. Note: this type of categorization might place some items\r\n * under wrong categories if the names are similar but belong to different categories.\r\n * In case that {@link IConfigTableOfContents.categoryInlineTag} is provided it will try categorize by\r\n * using it and only if it didn't, it will attempt to categorize by name.\r\n */\r\n categorizeByName?: boolean;\r\n\r\n /**\r\n * Inline tag that will be used to categorize the API items. Will take precedence over the\r\n * {@link IConfigTableOfContents.categorizeByName} flag in trying to place the API item according to the\r\n * custom inline tag present in documentation of the source code.\r\n */\r\n categoryInlineTag?: string;\r\n\r\n /**\r\n * Array of node names that might have already items injected at the time of creating the\r\n * {@link IConfigTableOfContents.tocConfig} tree structure but are still needed to be included as category\r\n * nodes where API items will be pushed during the categorization algorithm.\r\n */\r\n nonEmptyCategoryNodeNames?: string[];\r\n}\r\n\r\n/**\r\n * Describes plugin packages to be loaded, and which features to enable.\r\n */\r\nexport interface IConfigPlugin {\r\n /**\r\n * Specifies the name of an API Documenter plugin package to be loaded. By convention, the NPM package name\r\n * should have the prefix `doc-plugin-`. Its main entry point should export an object named\r\n * `apiDocumenterPluginManifest` which implements the {@link IApiDocumenterPluginManifest} interface.\r\n */\r\n packageName: string;\r\n\r\n /**\r\n * A list of features to be enabled. The features are defined in {@link IApiDocumenterPluginManifest.features}.\r\n * The `enabledFeatureNames` strings are matched with {@link IFeatureDefinition.featureName}.\r\n */\r\n enabledFeatureNames: string[];\r\n}\r\n\r\n/**\r\n * This interface represents the api-documenter.json file format.\r\n */\r\nexport interface IConfigFile {\r\n /**\r\n * Specifies the output target.\r\n */\r\n outputTarget: 'docfx' | 'markdown';\r\n\r\n /**\r\n * Specifies what type of newlines API Documenter should use when writing output files.\r\n *\r\n * @remarks\r\n * By default, the output files will be written with Windows-style newlines.\r\n * To use POSIX-style newlines, specify \"lf\" instead.\r\n * To use the OS's default newline kind, specify \"os\".\r\n */\r\n newlineKind?: 'crlf' | 'lf' | 'os';\r\n\r\n /**\r\n * This enables an experimental feature that will be officially released with the next major version\r\n * of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and\r\n * adds them to the table of contents. This will also affect file layout as namespaced items will be nested\r\n * under a directory for the namespace instead of just within the package.\r\n *\r\n * This setting currently only affects the 'docfx' output target. It is equivalent to the `--new-docfx-namespaces`\r\n * command-line parameter.\r\n */\r\n newDocfxNamespaces?: boolean;\r\n\r\n /** {@inheritDoc IConfigPlugin} */\r\n plugins?: IConfigPlugin[];\r\n\r\n /** {@inheritDoc IConfigTableOfContents} */\r\n tableOfContents?: IConfigTableOfContents;\r\n\r\n /**\r\n * Specifies whether inherited members should also be shown on an API item's page.\r\n */\r\n showInheritedMembers?: boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"IConfigFile.js","sourceRoot":"","sources":["../../src/documenters/IConfigFile.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { IYamlTocFile } from '../yaml/IYamlTocFile';\n\n/**\n * Typescript interface describing the config schema for toc.yml file format.\n */\nexport interface IConfigTableOfContents {\n /**\n * Represents the tree structure describing the toc.file format.\n * Nodes that have an empty `items` array property or their name will be included in the\n * {@link IConfigTableOfContents.nonEmptyCategoryNodeNames} will be filled with API items\n * that are matched with the filters provided. Everything else will be placed under\n * {@link IConfigTableOfContents.catchAllCategory} if provided, which is highly recommended.\n */\n tocConfig: IYamlTocFile;\n\n /**\n * Optional category name that is recommended to be included along with\n * one of the configs: {@link IConfigTableOfContents.categorizeByName} or\n * {@link IConfigTableOfContents.categoryInlineTag}.\n * Any items that are not matched according to the mentioned configuration options will be placed under this\n * catchAll category. If none provided the items will not be included in the final toc.yml file.\n */\n catchAllCategory?: string;\n\n /**\n * Toggle either categorization of the API items should be made based on category name presence\n * in the API item's name. Useful when there are API items without an inline tag to categorize them,\n * but still need to place the items under categories. Note: this type of categorization might place some items\n * under wrong categories if the names are similar but belong to different categories.\n * In case that {@link IConfigTableOfContents.categoryInlineTag} is provided it will try categorize by\n * using it and only if it didn't, it will attempt to categorize by name.\n */\n categorizeByName?: boolean;\n\n /**\n * Inline tag that will be used to categorize the API items. Will take precedence over the\n * {@link IConfigTableOfContents.categorizeByName} flag in trying to place the API item according to the\n * custom inline tag present in documentation of the source code.\n */\n categoryInlineTag?: string;\n\n /**\n * Array of node names that might have already items injected at the time of creating the\n * {@link IConfigTableOfContents.tocConfig} tree structure but are still needed to be included as category\n * nodes where API items will be pushed during the categorization algorithm.\n */\n nonEmptyCategoryNodeNames?: string[];\n}\n\n/**\n * Describes plugin packages to be loaded, and which features to enable.\n */\nexport interface IConfigPlugin {\n /**\n * Specifies the name of an API Documenter plugin package to be loaded. By convention, the NPM package name\n * should have the prefix `doc-plugin-`. Its main entry point should export an object named\n * `apiDocumenterPluginManifest` which implements the {@link IApiDocumenterPluginManifest} interface.\n */\n packageName: string;\n\n /**\n * A list of features to be enabled. The features are defined in {@link IApiDocumenterPluginManifest.features}.\n * The `enabledFeatureNames` strings are matched with {@link IFeatureDefinition.featureName}.\n */\n enabledFeatureNames: string[];\n}\n\n/**\n * This interface represents the api-documenter.json file format.\n */\nexport interface IConfigFile {\n /**\n * Specifies the output target.\n */\n outputTarget: 'docfx' | 'markdown';\n\n /**\n * Specifies what type of newlines API Documenter should use when writing output files.\n *\n * @remarks\n * By default, the output files will be written with Windows-style newlines.\n * To use POSIX-style newlines, specify \"lf\" instead.\n * To use the OS's default newline kind, specify \"os\".\n */\n newlineKind?: 'crlf' | 'lf' | 'os';\n\n /**\n * This enables an experimental feature that will be officially released with the next major version\n * of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and\n * adds them to the table of contents. This will also affect file layout as namespaced items will be nested\n * under a directory for the namespace instead of just within the package.\n *\n * This setting currently only affects the 'docfx' output target. It is equivalent to the `--new-docfx-namespaces`\n * command-line parameter.\n */\n newDocfxNamespaces?: boolean;\n\n /** {@inheritDoc IConfigPlugin} */\n plugins?: IConfigPlugin[];\n\n /** {@inheritDoc IConfigTableOfContents} */\n tableOfContents?: IConfigTableOfContents;\n\n /**\n * Specifies whether inherited members should also be shown on an API item's page.\n */\n showInheritedMembers?: boolean;\n}\n"]}