@microsoft/api-documenter 7.28.9 → 7.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +58 -0
- package/CHANGELOG.md +15 -1
- package/bin/api-documenter +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-esm/cli/ApiDocumenterCommandLine.js +22 -0
- package/lib-esm/cli/ApiDocumenterCommandLine.js.map +1 -0
- package/lib-esm/cli/BaseAction.js +93 -0
- package/lib-esm/cli/BaseAction.js.map +1 -0
- package/lib-esm/cli/GenerateAction.js +45 -0
- package/lib-esm/cli/GenerateAction.js.map +1 -0
- package/lib-esm/cli/MarkdownAction.js +24 -0
- package/lib-esm/cli/MarkdownAction.js.map +1 -0
- package/lib-esm/cli/YamlAction.js +43 -0
- package/lib-esm/cli/YamlAction.js.map +1 -0
- package/lib-esm/documenters/DocumenterConfig.js +43 -0
- package/lib-esm/documenters/DocumenterConfig.js.map +1 -0
- package/lib-esm/documenters/ExperimentalYamlDocumenter.js +136 -0
- package/lib-esm/documenters/ExperimentalYamlDocumenter.js.map +1 -0
- package/lib-esm/documenters/IConfigFile.js +4 -0
- package/lib-esm/documenters/IConfigFile.js.map +1 -0
- package/lib-esm/documenters/MarkdownDocumenter.js +987 -0
- package/lib-esm/documenters/MarkdownDocumenter.js.map +1 -0
- package/lib-esm/documenters/OfficeYamlDocumenter.js +101 -0
- package/lib-esm/documenters/OfficeYamlDocumenter.js.map +1 -0
- package/lib-esm/documenters/YamlDocumenter.js +804 -0
- package/lib-esm/documenters/YamlDocumenter.js.map +1 -0
- package/lib-esm/index.js +6 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/markdown/CustomMarkdownEmitter.js +146 -0
- package/lib-esm/markdown/CustomMarkdownEmitter.js.map +1 -0
- package/lib-esm/markdown/MarkdownEmitter.js +190 -0
- package/lib-esm/markdown/MarkdownEmitter.js.map +1 -0
- package/lib-esm/nodes/CustomDocNodeKind.js +51 -0
- package/lib-esm/nodes/CustomDocNodeKind.js.map +1 -0
- package/lib-esm/nodes/DocEmphasisSpan.js +20 -0
- package/lib-esm/nodes/DocEmphasisSpan.js.map +1 -0
- package/lib-esm/nodes/DocHeading.js +26 -0
- package/lib-esm/nodes/DocHeading.js.map +1 -0
- package/lib-esm/nodes/DocNoteBox.js +22 -0
- package/lib-esm/nodes/DocNoteBox.js.map +1 -0
- package/lib-esm/nodes/DocTable.js +56 -0
- package/lib-esm/nodes/DocTable.js.map +1 -0
- package/lib-esm/nodes/DocTableCell.js +18 -0
- package/lib-esm/nodes/DocTableCell.js.map +1 -0
- package/lib-esm/nodes/DocTableRow.js +47 -0
- package/lib-esm/nodes/DocTableRow.js.map +1 -0
- package/lib-esm/plugin/IApiDocumenterPluginManifest.js +4 -0
- package/lib-esm/plugin/IApiDocumenterPluginManifest.js.map +1 -0
- package/lib-esm/plugin/MarkdownDocumenterAccessor.js +26 -0
- package/lib-esm/plugin/MarkdownDocumenterAccessor.js.map +1 -0
- package/lib-esm/plugin/MarkdownDocumenterFeature.js +47 -0
- package/lib-esm/plugin/MarkdownDocumenterFeature.js.map +1 -0
- package/lib-esm/plugin/PluginFeature.js +54 -0
- package/lib-esm/plugin/PluginFeature.js.map +1 -0
- package/lib-esm/plugin/PluginLoader.js +78 -0
- package/lib-esm/plugin/PluginLoader.js.map +1 -0
- package/lib-esm/schemas/api-documenter-template.json +99 -0
- package/lib-esm/schemas/api-documenter.schema.json +47 -0
- package/lib-esm/start.js +12 -0
- package/lib-esm/start.js.map +1 -0
- package/lib-esm/utils/IndentedWriter.js +235 -0
- package/lib-esm/utils/IndentedWriter.js.map +1 -0
- package/lib-esm/utils/ToSdpConvertHelper.js +338 -0
- package/lib-esm/utils/ToSdpConvertHelper.js.map +1 -0
- package/lib-esm/utils/Utilities.js +24 -0
- package/lib-esm/utils/Utilities.js.map +1 -0
- package/lib-esm/yaml/ISDPYamlFile.js +4 -0
- package/lib-esm/yaml/ISDPYamlFile.js.map +1 -0
- package/lib-esm/yaml/IYamlApiFile.js +4 -0
- package/lib-esm/yaml/IYamlApiFile.js.map +1 -0
- package/lib-esm/yaml/IYamlTocFile.js +4 -0
- package/lib-esm/yaml/IYamlTocFile.js.map +1 -0
- package/lib-esm/yaml/typescript.schema.json +643 -0
- package/package.json +37 -9
- /package/{lib → lib-commonjs}/cli/ApiDocumenterCommandLine.js +0 -0
- /package/{lib → lib-commonjs}/cli/ApiDocumenterCommandLine.js.map +0 -0
- /package/{lib → lib-commonjs}/cli/BaseAction.js +0 -0
- /package/{lib → lib-commonjs}/cli/BaseAction.js.map +0 -0
- /package/{lib → lib-commonjs}/cli/GenerateAction.js +0 -0
- /package/{lib → lib-commonjs}/cli/GenerateAction.js.map +0 -0
- /package/{lib → lib-commonjs}/cli/MarkdownAction.js +0 -0
- /package/{lib → lib-commonjs}/cli/MarkdownAction.js.map +0 -0
- /package/{lib → lib-commonjs}/cli/YamlAction.js +0 -0
- /package/{lib → lib-commonjs}/cli/YamlAction.js.map +0 -0
- /package/{lib → lib-commonjs}/documenters/DocumenterConfig.js +0 -0
- /package/{lib → lib-commonjs}/documenters/DocumenterConfig.js.map +0 -0
- /package/{lib → lib-commonjs}/documenters/ExperimentalYamlDocumenter.js +0 -0
- /package/{lib → lib-commonjs}/documenters/ExperimentalYamlDocumenter.js.map +0 -0
- /package/{lib → lib-commonjs}/documenters/IConfigFile.js +0 -0
- /package/{lib → lib-commonjs}/documenters/IConfigFile.js.map +0 -0
- /package/{lib → lib-commonjs}/documenters/MarkdownDocumenter.js +0 -0
- /package/{lib → lib-commonjs}/documenters/MarkdownDocumenter.js.map +0 -0
- /package/{lib → lib-commonjs}/documenters/OfficeYamlDocumenter.js +0 -0
- /package/{lib → lib-commonjs}/documenters/OfficeYamlDocumenter.js.map +0 -0
- /package/{lib → lib-commonjs}/documenters/YamlDocumenter.js +0 -0
- /package/{lib → lib-commonjs}/documenters/YamlDocumenter.js.map +0 -0
- /package/{lib → lib-commonjs}/index.js +0 -0
- /package/{lib → lib-commonjs}/index.js.map +0 -0
- /package/{lib → lib-commonjs}/markdown/CustomMarkdownEmitter.js +0 -0
- /package/{lib → lib-commonjs}/markdown/CustomMarkdownEmitter.js.map +0 -0
- /package/{lib → lib-commonjs}/markdown/MarkdownEmitter.js +0 -0
- /package/{lib → lib-commonjs}/markdown/MarkdownEmitter.js.map +0 -0
- /package/{lib → lib-commonjs}/nodes/CustomDocNodeKind.js +0 -0
- /package/{lib → lib-commonjs}/nodes/CustomDocNodeKind.js.map +0 -0
- /package/{lib → lib-commonjs}/nodes/DocEmphasisSpan.js +0 -0
- /package/{lib → lib-commonjs}/nodes/DocEmphasisSpan.js.map +0 -0
- /package/{lib → lib-commonjs}/nodes/DocHeading.js +0 -0
- /package/{lib → lib-commonjs}/nodes/DocHeading.js.map +0 -0
- /package/{lib → lib-commonjs}/nodes/DocNoteBox.js +0 -0
- /package/{lib → lib-commonjs}/nodes/DocNoteBox.js.map +0 -0
- /package/{lib → lib-commonjs}/nodes/DocTable.js +0 -0
- /package/{lib → lib-commonjs}/nodes/DocTable.js.map +0 -0
- /package/{lib → lib-commonjs}/nodes/DocTableCell.js +0 -0
- /package/{lib → lib-commonjs}/nodes/DocTableCell.js.map +0 -0
- /package/{lib → lib-commonjs}/nodes/DocTableRow.js +0 -0
- /package/{lib → lib-commonjs}/nodes/DocTableRow.js.map +0 -0
- /package/{lib → lib-commonjs}/plugin/IApiDocumenterPluginManifest.js +0 -0
- /package/{lib → lib-commonjs}/plugin/IApiDocumenterPluginManifest.js.map +0 -0
- /package/{lib → lib-commonjs}/plugin/MarkdownDocumenterAccessor.js +0 -0
- /package/{lib → lib-commonjs}/plugin/MarkdownDocumenterAccessor.js.map +0 -0
- /package/{lib → lib-commonjs}/plugin/MarkdownDocumenterFeature.js +0 -0
- /package/{lib → lib-commonjs}/plugin/MarkdownDocumenterFeature.js.map +0 -0
- /package/{lib → lib-commonjs}/plugin/PluginFeature.js +0 -0
- /package/{lib → lib-commonjs}/plugin/PluginFeature.js.map +0 -0
- /package/{lib → lib-commonjs}/plugin/PluginLoader.js +0 -0
- /package/{lib → lib-commonjs}/plugin/PluginLoader.js.map +0 -0
- /package/{lib → lib-commonjs}/schemas/api-documenter-template.json +0 -0
- /package/{lib → lib-commonjs}/schemas/api-documenter.schema.json +0 -0
- /package/{lib → lib-commonjs}/start.js +0 -0
- /package/{lib → lib-commonjs}/start.js.map +0 -0
- /package/{lib → lib-commonjs}/utils/IndentedWriter.js +0 -0
- /package/{lib → lib-commonjs}/utils/IndentedWriter.js.map +0 -0
- /package/{lib → lib-commonjs}/utils/ToSdpConvertHelper.js +0 -0
- /package/{lib → lib-commonjs}/utils/ToSdpConvertHelper.js.map +0 -0
- /package/{lib → lib-commonjs}/utils/Utilities.js +0 -0
- /package/{lib → lib-commonjs}/utils/Utilities.js.map +0 -0
- /package/{lib → lib-commonjs}/yaml/ISDPYamlFile.js +0 -0
- /package/{lib → lib-commonjs}/yaml/ISDPYamlFile.js.map +0 -0
- /package/{lib → lib-commonjs}/yaml/IYamlApiFile.js +0 -0
- /package/{lib → lib-commonjs}/yaml/IYamlApiFile.js.map +0 -0
- /package/{lib → lib-commonjs}/yaml/IYamlTocFile.js +0 -0
- /package/{lib → lib-commonjs}/yaml/IYamlTocFile.js.map +0 -0
- /package/{lib → lib-commonjs}/yaml/typescript.schema.json +0 -0
- /package/{lib → lib-dts}/cli/ApiDocumenterCommandLine.d.ts +0 -0
- /package/{lib → lib-dts}/cli/ApiDocumenterCommandLine.d.ts.map +0 -0
- /package/{lib → lib-dts}/cli/BaseAction.d.ts +0 -0
- /package/{lib → lib-dts}/cli/BaseAction.d.ts.map +0 -0
- /package/{lib → lib-dts}/cli/GenerateAction.d.ts +0 -0
- /package/{lib → lib-dts}/cli/GenerateAction.d.ts.map +0 -0
- /package/{lib → lib-dts}/cli/MarkdownAction.d.ts +0 -0
- /package/{lib → lib-dts}/cli/MarkdownAction.d.ts.map +0 -0
- /package/{lib → lib-dts}/cli/YamlAction.d.ts +0 -0
- /package/{lib → lib-dts}/cli/YamlAction.d.ts.map +0 -0
- /package/{lib → lib-dts}/documenters/DocumenterConfig.d.ts +0 -0
- /package/{lib → lib-dts}/documenters/DocumenterConfig.d.ts.map +0 -0
- /package/{lib → lib-dts}/documenters/ExperimentalYamlDocumenter.d.ts +0 -0
- /package/{lib → lib-dts}/documenters/ExperimentalYamlDocumenter.d.ts.map +0 -0
- /package/{lib → lib-dts}/documenters/IConfigFile.d.ts +0 -0
- /package/{lib → lib-dts}/documenters/IConfigFile.d.ts.map +0 -0
- /package/{lib → lib-dts}/documenters/MarkdownDocumenter.d.ts +0 -0
- /package/{lib → lib-dts}/documenters/MarkdownDocumenter.d.ts.map +0 -0
- /package/{lib → lib-dts}/documenters/OfficeYamlDocumenter.d.ts +0 -0
- /package/{lib → lib-dts}/documenters/OfficeYamlDocumenter.d.ts.map +0 -0
- /package/{lib → lib-dts}/documenters/YamlDocumenter.d.ts +0 -0
- /package/{lib → lib-dts}/documenters/YamlDocumenter.d.ts.map +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts.map +0 -0
- /package/{lib → lib-dts}/markdown/CustomMarkdownEmitter.d.ts +0 -0
- /package/{lib → lib-dts}/markdown/CustomMarkdownEmitter.d.ts.map +0 -0
- /package/{lib → lib-dts}/markdown/MarkdownEmitter.d.ts +0 -0
- /package/{lib → lib-dts}/markdown/MarkdownEmitter.d.ts.map +0 -0
- /package/{lib → lib-dts}/nodes/CustomDocNodeKind.d.ts +0 -0
- /package/{lib → lib-dts}/nodes/CustomDocNodeKind.d.ts.map +0 -0
- /package/{lib → lib-dts}/nodes/DocEmphasisSpan.d.ts +0 -0
- /package/{lib → lib-dts}/nodes/DocEmphasisSpan.d.ts.map +0 -0
- /package/{lib → lib-dts}/nodes/DocHeading.d.ts +0 -0
- /package/{lib → lib-dts}/nodes/DocHeading.d.ts.map +0 -0
- /package/{lib → lib-dts}/nodes/DocNoteBox.d.ts +0 -0
- /package/{lib → lib-dts}/nodes/DocNoteBox.d.ts.map +0 -0
- /package/{lib → lib-dts}/nodes/DocTable.d.ts +0 -0
- /package/{lib → lib-dts}/nodes/DocTable.d.ts.map +0 -0
- /package/{lib → lib-dts}/nodes/DocTableCell.d.ts +0 -0
- /package/{lib → lib-dts}/nodes/DocTableCell.d.ts.map +0 -0
- /package/{lib → lib-dts}/nodes/DocTableRow.d.ts +0 -0
- /package/{lib → lib-dts}/nodes/DocTableRow.d.ts.map +0 -0
- /package/{lib → lib-dts}/plugin/IApiDocumenterPluginManifest.d.ts +0 -0
- /package/{lib → lib-dts}/plugin/IApiDocumenterPluginManifest.d.ts.map +0 -0
- /package/{lib → lib-dts}/plugin/MarkdownDocumenterAccessor.d.ts +0 -0
- /package/{lib → lib-dts}/plugin/MarkdownDocumenterAccessor.d.ts.map +0 -0
- /package/{lib → lib-dts}/plugin/MarkdownDocumenterFeature.d.ts +0 -0
- /package/{lib → lib-dts}/plugin/MarkdownDocumenterFeature.d.ts.map +0 -0
- /package/{lib → lib-dts}/plugin/PluginFeature.d.ts +0 -0
- /package/{lib → lib-dts}/plugin/PluginFeature.d.ts.map +0 -0
- /package/{lib → lib-dts}/plugin/PluginLoader.d.ts +0 -0
- /package/{lib → lib-dts}/plugin/PluginLoader.d.ts.map +0 -0
- /package/{lib → lib-dts}/start.d.ts +0 -0
- /package/{lib → lib-dts}/start.d.ts.map +0 -0
- /package/{lib → lib-dts}/utils/IndentedWriter.d.ts +0 -0
- /package/{lib → lib-dts}/utils/IndentedWriter.d.ts.map +0 -0
- /package/{lib → lib-dts}/utils/ToSdpConvertHelper.d.ts +0 -0
- /package/{lib → lib-dts}/utils/ToSdpConvertHelper.d.ts.map +0 -0
- /package/{lib → lib-dts}/utils/Utilities.d.ts +0 -0
- /package/{lib → lib-dts}/utils/Utilities.d.ts.map +0 -0
- /package/{lib → lib-dts}/yaml/ISDPYamlFile.d.ts +0 -0
- /package/{lib → lib-dts}/yaml/ISDPYamlFile.d.ts.map +0 -0
- /package/{lib → lib-dts}/yaml/IYamlApiFile.d.ts +0 -0
- /package/{lib → lib-dts}/yaml/IYamlApiFile.d.ts.map +0 -0
- /package/{lib → lib-dts}/yaml/IYamlTocFile.d.ts +0 -0
- /package/{lib → lib-dts}/yaml/IYamlTocFile.d.ts.map +0 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/api-documenter",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "7.29.1",
|
|
6
|
+
"tag": "@microsoft/api-documenter_v7.29.1",
|
|
7
|
+
"date": "Fri, 20 Feb 2026 00:15:03 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@microsoft/api-extractor-model\" to `7.33.1`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.20.1`"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.22.1`"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.3.1`"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.2.1`"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"version": "7.29.0",
|
|
35
|
+
"tag": "@microsoft/api-documenter_v7.29.0",
|
|
36
|
+
"date": "Thu, 19 Feb 2026 00:04:52 GMT",
|
|
37
|
+
"comments": {
|
|
38
|
+
"minor": [
|
|
39
|
+
{
|
|
40
|
+
"comment": "Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `\"exports\"` field in `package.json`."
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"dependency": [
|
|
44
|
+
{
|
|
45
|
+
"comment": "Updating dependency \"@microsoft/api-extractor-model\" to `7.33.0`"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.20.0`"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.22.0`"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.3.0`"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.2.0`"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
4
62
|
{
|
|
5
63
|
"version": "7.28.9",
|
|
6
64
|
"tag": "@microsoft/api-documenter_v7.28.9",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log - @microsoft/api-documenter
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 20 Feb 2026 00:15:03 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 7.29.1
|
|
6
|
+
Fri, 20 Feb 2026 00:15:03 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Add `"node"` condition before `"import"` in the `"exports"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `"import"`. Fixes https://github.com/microsoft/rushstack/issues/5644.
|
|
11
|
+
|
|
12
|
+
## 7.29.0
|
|
13
|
+
Thu, 19 Feb 2026 00:04:52 GMT
|
|
14
|
+
|
|
15
|
+
### Minor changes
|
|
16
|
+
|
|
17
|
+
- Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `"exports"` field in `package.json`.
|
|
4
18
|
|
|
5
19
|
## 7.28.9
|
|
6
20
|
Sat, 07 Feb 2026 01:13:26 GMT
|
package/bin/api-documenter
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js');
|
|
2
|
+
require('../lib-commonjs/start.js');
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { CommandLineParser } from '@rushstack/ts-command-line';
|
|
4
|
+
import { MarkdownAction } from './MarkdownAction';
|
|
5
|
+
import { YamlAction } from './YamlAction';
|
|
6
|
+
import { GenerateAction } from './GenerateAction';
|
|
7
|
+
export class ApiDocumenterCommandLine extends CommandLineParser {
|
|
8
|
+
constructor() {
|
|
9
|
+
super({
|
|
10
|
+
toolFilename: 'api-documenter',
|
|
11
|
+
toolDescription: 'Reads *.api.json files produced by api-extractor, ' +
|
|
12
|
+
' and generates API documentation in various output formats.'
|
|
13
|
+
});
|
|
14
|
+
this._populateActions();
|
|
15
|
+
}
|
|
16
|
+
_populateActions() {
|
|
17
|
+
this.addAction(new MarkdownAction(this));
|
|
18
|
+
this.addAction(new YamlAction(this));
|
|
19
|
+
this.addAction(new GenerateAction(this));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ApiDocumenterCommandLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiDocumenterCommandLine.js","sourceRoot":"","sources":["../../src/cli/ApiDocumenterCommandLine.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;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,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { CommandLineParser } from '@rushstack/ts-command-line';\n\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"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { CommandLineAction } from '@rushstack/ts-command-line';
|
|
5
|
+
import { FileSystem } from '@rushstack/node-core-library';
|
|
6
|
+
import { ApiModel, ApiItemContainerMixin, ApiDocumentedItem } from '@microsoft/api-extractor-model';
|
|
7
|
+
import { Colorize } from '@rushstack/terminal';
|
|
8
|
+
export class BaseAction extends CommandLineAction {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super(options);
|
|
11
|
+
this._inputFolderParameter = this.defineStringParameter({
|
|
12
|
+
parameterLongName: '--input-folder',
|
|
13
|
+
parameterShortName: '-i',
|
|
14
|
+
argumentName: 'FOLDER1',
|
|
15
|
+
description: `Specifies the input folder containing the *.api.json files to be processed.` +
|
|
16
|
+
` If omitted, the default is "./input"`
|
|
17
|
+
});
|
|
18
|
+
this._outputFolderParameter = this.defineStringParameter({
|
|
19
|
+
parameterLongName: '--output-folder',
|
|
20
|
+
parameterShortName: '-o',
|
|
21
|
+
argumentName: 'FOLDER2',
|
|
22
|
+
description: `Specifies the output folder where the documentation will be written.` +
|
|
23
|
+
` ANY EXISTING CONTENTS WILL BE DELETED!` +
|
|
24
|
+
` If omitted, the default is "./${this.actionName}"`
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
buildApiModel() {
|
|
28
|
+
const apiModel = new ApiModel();
|
|
29
|
+
const inputFolder = this._inputFolderParameter.value || './input';
|
|
30
|
+
if (!FileSystem.exists(inputFolder)) {
|
|
31
|
+
throw new Error('The input folder does not exist: ' + inputFolder);
|
|
32
|
+
}
|
|
33
|
+
const outputFolder = this._outputFolderParameter.value || `./${this.actionName}`;
|
|
34
|
+
FileSystem.ensureFolder(outputFolder);
|
|
35
|
+
for (const filename of FileSystem.readFolderItemNames(inputFolder)) {
|
|
36
|
+
if (filename.match(/\.api\.json$/i)) {
|
|
37
|
+
console.log(`Reading ${filename}`);
|
|
38
|
+
const filenamePath = path.join(inputFolder, filename);
|
|
39
|
+
apiModel.loadPackage(filenamePath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
this._applyInheritDoc(apiModel, apiModel);
|
|
43
|
+
return { apiModel, inputFolder, outputFolder };
|
|
44
|
+
}
|
|
45
|
+
// TODO: This is a temporary workaround. The long term plan is for API Extractor's DocCommentEnhancer
|
|
46
|
+
// to apply all @inheritDoc tags before the .api.json file is written.
|
|
47
|
+
// See DocCommentEnhancer._applyInheritDoc() for more info.
|
|
48
|
+
_applyInheritDoc(apiItem, apiModel) {
|
|
49
|
+
if (apiItem instanceof ApiDocumentedItem) {
|
|
50
|
+
if (apiItem.tsdocComment) {
|
|
51
|
+
const inheritDocTag = apiItem.tsdocComment.inheritDocTag;
|
|
52
|
+
if (inheritDocTag && inheritDocTag.declarationReference) {
|
|
53
|
+
// Attempt to resolve the declaration reference
|
|
54
|
+
const result = apiModel.resolveDeclarationReference(inheritDocTag.declarationReference, apiItem);
|
|
55
|
+
if (result.errorMessage) {
|
|
56
|
+
console.log(Colorize.yellow(`Warning: Unresolved @inheritDoc tag for ${apiItem.displayName}: ` + result.errorMessage));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (result.resolvedApiItem instanceof ApiDocumentedItem &&
|
|
60
|
+
result.resolvedApiItem.tsdocComment &&
|
|
61
|
+
result.resolvedApiItem !== apiItem) {
|
|
62
|
+
this._copyInheritedDocs(apiItem.tsdocComment, result.resolvedApiItem.tsdocComment);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Recurse members
|
|
69
|
+
if (ApiItemContainerMixin.isBaseClassOf(apiItem)) {
|
|
70
|
+
for (const member of apiItem.members) {
|
|
71
|
+
this._applyInheritDoc(member, apiModel);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Copy the content from `sourceDocComment` to `targetDocComment`.
|
|
77
|
+
* This code is borrowed from DocCommentEnhancer as a temporary workaround.
|
|
78
|
+
*/
|
|
79
|
+
_copyInheritedDocs(targetDocComment, sourceDocComment) {
|
|
80
|
+
targetDocComment.summarySection = sourceDocComment.summarySection;
|
|
81
|
+
targetDocComment.remarksBlock = sourceDocComment.remarksBlock;
|
|
82
|
+
targetDocComment.params.clear();
|
|
83
|
+
for (const param of sourceDocComment.params) {
|
|
84
|
+
targetDocComment.params.add(param);
|
|
85
|
+
}
|
|
86
|
+
for (const typeParam of sourceDocComment.typeParams) {
|
|
87
|
+
targetDocComment.typeParams.add(typeParam);
|
|
88
|
+
}
|
|
89
|
+
targetDocComment.returnsBlock = sourceDocComment.returnsBlock;
|
|
90
|
+
targetDocComment.inheritDocTag = undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=BaseAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAction.js","sourceRoot":"","sources":["../../src/cli/BaseAction.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EACL,iBAAiB,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACL,QAAQ,EAER,qBAAqB,EACrB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAQ/C,MAAM,OAAgB,UAAW,SAAQ,iBAAiB;IAIxD,YAAsB,OAAkC;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACtD,iBAAiB,EAAE,gBAAgB;YACnC,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,SAAS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C,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,CAAC;YAC5C,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,MAAM,SAAS,IAAI,gBAAgB,CAAC,UAAU,EAAE,CAAC;YACpD,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC;QACD,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAE9D,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;IAC7C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport type * as tsdoc from '@microsoft/tsdoc';\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';\nimport { Colorize } from '@rushstack/terminal';\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 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 Colorize.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"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { FileSystem } from '@rushstack/node-core-library';
|
|
5
|
+
import { BaseAction } from './BaseAction';
|
|
6
|
+
import { DocumenterConfig } from '../documenters/DocumenterConfig';
|
|
7
|
+
import { ExperimentalYamlDocumenter } from '../documenters/ExperimentalYamlDocumenter';
|
|
8
|
+
import { MarkdownDocumenter } from '../documenters/MarkdownDocumenter';
|
|
9
|
+
export class GenerateAction extends BaseAction {
|
|
10
|
+
constructor(parser) {
|
|
11
|
+
super({
|
|
12
|
+
actionName: 'generate',
|
|
13
|
+
summary: 'EXPERIMENTAL',
|
|
14
|
+
documentation: 'EXPERIMENTAL - This action is a prototype of a new config file driven mode of operation for' +
|
|
15
|
+
' API Documenter. It is not ready for general usage yet. Its design may change in the future.'
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async onExecuteAsync() {
|
|
19
|
+
// Look for the config file under the current folder
|
|
20
|
+
let configFilePath = path.join(process.cwd(), DocumenterConfig.FILENAME);
|
|
21
|
+
// First try the current folder
|
|
22
|
+
if (!FileSystem.exists(configFilePath)) {
|
|
23
|
+
// Otherwise try the standard "config" subfolder
|
|
24
|
+
configFilePath = path.join(process.cwd(), 'config', DocumenterConfig.FILENAME);
|
|
25
|
+
if (!FileSystem.exists(configFilePath)) {
|
|
26
|
+
throw new Error(`Unable to find ${DocumenterConfig.FILENAME} in the current folder or in a "config" subfolder`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const documenterConfig = DocumenterConfig.loadFile(configFilePath);
|
|
30
|
+
const { apiModel, outputFolder } = this.buildApiModel();
|
|
31
|
+
if (documenterConfig.configFile.outputTarget === 'markdown') {
|
|
32
|
+
const markdownDocumenter = new MarkdownDocumenter({
|
|
33
|
+
apiModel,
|
|
34
|
+
documenterConfig,
|
|
35
|
+
outputFolder
|
|
36
|
+
});
|
|
37
|
+
markdownDocumenter.generateFiles();
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const yamlDocumenter = new ExperimentalYamlDocumenter(apiModel, documenterConfig);
|
|
41
|
+
yamlDocumenter.generateFiles(outputFolder);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=GenerateAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenerateAction.js","sourceRoot":"","sources":["../../src/cli/GenerateAction.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C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E,QAAQ,EACR,gBAAgB,CACjB,CAAC;YACF,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport { FileSystem } from '@rushstack/node-core-library';\n\nimport type { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\nimport { BaseAction } from './BaseAction';\nimport { DocumenterConfig } from '../documenters/DocumenterConfig';\nimport { ExperimentalYamlDocumenter } from '../documenters/ExperimentalYamlDocumenter';\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 override async onExecuteAsync(): Promise<void> {\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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { BaseAction } from './BaseAction';
|
|
4
|
+
import { MarkdownDocumenter } from '../documenters/MarkdownDocumenter';
|
|
5
|
+
export class MarkdownAction extends BaseAction {
|
|
6
|
+
constructor(parser) {
|
|
7
|
+
super({
|
|
8
|
+
actionName: 'markdown',
|
|
9
|
+
summary: 'Generate documentation as Markdown files (*.md)',
|
|
10
|
+
documentation: 'Generates API documentation as a collection of files in' +
|
|
11
|
+
' Markdown format, suitable for example for publishing on a GitHub site.'
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async onExecuteAsync() {
|
|
15
|
+
const { apiModel, outputFolder } = this.buildApiModel();
|
|
16
|
+
const markdownDocumenter = new MarkdownDocumenter({
|
|
17
|
+
apiModel,
|
|
18
|
+
documenterConfig: undefined,
|
|
19
|
+
outputFolder
|
|
20
|
+
});
|
|
21
|
+
markdownDocumenter.generateFiles();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=MarkdownAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownAction.js","sourceRoot":"","sources":["../../src/cli/MarkdownAction.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,OAAO,cAAe,SAAQ,UAAU;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;IAEkB,KAAK,CAAC,cAAc;QACrC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAExD,MAAM,kBAAkB,GAAuB,IAAI,kBAAkB,CAAC;YACpE,QAAQ;YACR,gBAAgB,EAAE,SAAS;YAC3B,YAAY;SACb,CAAC,CAAC;QACH,kBAAkB,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { 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 override async onExecuteAsync(): Promise<void> {\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"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { BaseAction } from './BaseAction';
|
|
4
|
+
import { YamlDocumenter } from '../documenters/YamlDocumenter';
|
|
5
|
+
import { OfficeYamlDocumenter } from '../documenters/OfficeYamlDocumenter';
|
|
6
|
+
export class YamlAction extends BaseAction {
|
|
7
|
+
constructor(parser) {
|
|
8
|
+
super({
|
|
9
|
+
actionName: 'yaml',
|
|
10
|
+
summary: 'Generate documentation as universal reference YAML files (*.yml)',
|
|
11
|
+
documentation: 'Generates API documentation as a collection of files conforming' +
|
|
12
|
+
' to the universal reference YAML format, which is used by the docs.microsoft.com' +
|
|
13
|
+
' pipeline.'
|
|
14
|
+
});
|
|
15
|
+
this._officeParameter = this.defineFlagParameter({
|
|
16
|
+
parameterLongName: '--office',
|
|
17
|
+
description: `Enables some additional features specific to Office Add-ins`
|
|
18
|
+
});
|
|
19
|
+
this._newDocfxNamespacesParameter = this.defineFlagParameter({
|
|
20
|
+
parameterLongName: '--new-docfx-namespaces',
|
|
21
|
+
description: `This enables an experimental feature that will be officially released with the next major version` +
|
|
22
|
+
` of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and` +
|
|
23
|
+
` adds them to the table of contents. This will also affect file layout as namespaced items will be nested` +
|
|
24
|
+
` under a directory for the namespace instead of just within the package.`
|
|
25
|
+
});
|
|
26
|
+
this._yamlFormatParameter = this.defineChoiceParameter({
|
|
27
|
+
parameterLongName: '--yaml-format',
|
|
28
|
+
alternatives: ['udp', 'sdp'],
|
|
29
|
+
defaultValue: 'sdp',
|
|
30
|
+
description: `Specifies the YAML format - udp or sdp. Universal Document Processor (udp) should be used if you generating` +
|
|
31
|
+
` YAML files for DocFX 2.x. Schema Driven Processor (sdp) should be used with DocFX 3.x.` +
|
|
32
|
+
` NOTE: This parameter is ignored if you use --office.`
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async onExecuteAsync() {
|
|
36
|
+
const { apiModel, inputFolder, outputFolder } = this.buildApiModel();
|
|
37
|
+
const yamlDocumenter = this._officeParameter.value
|
|
38
|
+
? new OfficeYamlDocumenter(apiModel, inputFolder, this._newDocfxNamespacesParameter.value)
|
|
39
|
+
: new YamlDocumenter(apiModel, this._newDocfxNamespacesParameter.value, this._yamlFormatParameter.value);
|
|
40
|
+
yamlDocumenter.generateFiles(outputFolder);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=YamlAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YamlAction.js","sourceRoot":"","sources":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,4BAA4B,CAAC,KAAK,CAAC;YAC1F,CAAC,CAAC,IAAI,cAAc,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","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 {\n CommandLineFlagParameter,\n IRequiredCommandLineChoiceParameter\n} from '@rushstack/ts-command-line';\n\nimport type { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';\nimport { BaseAction } from './BaseAction';\nimport { YamlDocumenter, type YamlFormat } 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: IRequiredCommandLineChoiceParameter<YamlFormat>;\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<YamlFormat>({\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 override async onExecuteAsync(): Promise<void> {\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"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { JsonSchema, JsonFile, NewlineKind } from '@rushstack/node-core-library';
|
|
5
|
+
import apiDocumenterSchema from '../schemas/api-documenter.schema.json';
|
|
6
|
+
/**
|
|
7
|
+
* Helper for loading the api-documenter.json file format. Later when the schema is more mature,
|
|
8
|
+
* this class will be used to represent the validated and normalized configuration, whereas `IConfigFile`
|
|
9
|
+
* represents the raw JSON file structure.
|
|
10
|
+
*/
|
|
11
|
+
export class DocumenterConfig {
|
|
12
|
+
constructor(filePath, configFile) {
|
|
13
|
+
this.configFilePath = filePath;
|
|
14
|
+
this.configFile = configFile;
|
|
15
|
+
switch (configFile.newlineKind) {
|
|
16
|
+
case 'lf':
|
|
17
|
+
this.newlineKind = NewlineKind.Lf;
|
|
18
|
+
break;
|
|
19
|
+
case 'os':
|
|
20
|
+
this.newlineKind = NewlineKind.OsDefault;
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
this.newlineKind = NewlineKind.CrLf;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load and validate an api-documenter.json file.
|
|
29
|
+
*/
|
|
30
|
+
static loadFile(configFilePath) {
|
|
31
|
+
const configFile = JsonFile.loadAndValidate(configFilePath, DocumenterConfig.jsonSchema);
|
|
32
|
+
return new DocumenterConfig(path.resolve(configFilePath), configFile);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The JSON Schema for API Documenter config file (api-documenter.schema.json).
|
|
37
|
+
*/
|
|
38
|
+
DocumenterConfig.jsonSchema = JsonSchema.fromLoadedObject(apiDocumenterSchema);
|
|
39
|
+
/**
|
|
40
|
+
* The config file name "api-documenter.json".
|
|
41
|
+
*/
|
|
42
|
+
DocumenterConfig.FILENAME = 'api-documenter.json';
|
|
43
|
+
//# sourceMappingURL=DocumenterConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumenterConfig.js","sourceRoot":"","sources":["../../src/documenters/DocumenterConfig.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGjF,OAAO,mBAAmB,MAAM,uCAAuC,CAAC;AAExE;;;;GAIG;AACH,MAAM,OAAO,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,CAAC;YAC/B,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,EAAE,CAAC;gBAClC,MAAM;YACR,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC;gBACzC,MAAM;YACR;gBACE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC;gBACpC,MAAM;QACV,CAAC;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,cAAsB;QAC3C,MAAM,UAAU,GAAgB,QAAQ,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,UAAU,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;AAEjG;;GAEG;AACoB,yBAAQ,GAAW,qBAAqB,CAAC","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 'node:path';\n\nimport { JsonSchema, JsonFile, NewlineKind } from '@rushstack/node-core-library';\n\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"]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { DocInlineTag } from '@microsoft/tsdoc';
|
|
4
|
+
import { ApiItemKind, ApiDocumentedItem } from '@microsoft/api-extractor-model';
|
|
5
|
+
import { YamlDocumenter } from './YamlDocumenter';
|
|
6
|
+
/**
|
|
7
|
+
* EXPERIMENTAL - This documenter is a prototype of a new config file driven mode of operation for
|
|
8
|
+
* API Documenter. It is not ready for general usage yet. Its design may change in the future.
|
|
9
|
+
*/
|
|
10
|
+
export class ExperimentalYamlDocumenter extends YamlDocumenter {
|
|
11
|
+
constructor(apiModel, documenterConfig) {
|
|
12
|
+
super(apiModel, documenterConfig.configFile.newDocfxNamespaces);
|
|
13
|
+
this._config = documenterConfig.configFile.tableOfContents;
|
|
14
|
+
this._tocPointerMap = {};
|
|
15
|
+
this._generateTocPointersMap(this._config.tocConfig);
|
|
16
|
+
}
|
|
17
|
+
/** @override */
|
|
18
|
+
buildYamlTocFile(apiItems) {
|
|
19
|
+
this._buildTocItems2(apiItems);
|
|
20
|
+
return this._config.tocConfig;
|
|
21
|
+
}
|
|
22
|
+
_buildTocItems2(apiItems) {
|
|
23
|
+
const tocItems = [];
|
|
24
|
+
for (const apiItem of apiItems) {
|
|
25
|
+
let tocItem;
|
|
26
|
+
if (apiItem.kind === ApiItemKind.Namespace && !this.newDocfxNamespaces) {
|
|
27
|
+
tocItem = {
|
|
28
|
+
name: this._getTocItemName(apiItem)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (this._shouldEmbed(apiItem.kind)) {
|
|
33
|
+
// Don't generate table of contents items for embedded definitions
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
tocItem = {
|
|
37
|
+
name: this._getTocItemName(apiItem),
|
|
38
|
+
uid: this._getUid(apiItem)
|
|
39
|
+
};
|
|
40
|
+
if (apiItem.kind !== ApiItemKind.Package) {
|
|
41
|
+
this._filterItem(apiItem, tocItem);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
tocItems.push(tocItem);
|
|
45
|
+
const children = this._getLogicalChildren(apiItem);
|
|
46
|
+
const childItems = this._buildTocItems2(children);
|
|
47
|
+
if (childItems.length > 0) {
|
|
48
|
+
tocItem.items = childItems;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return tocItems;
|
|
52
|
+
}
|
|
53
|
+
// Parses the tocConfig object to build a pointers map of nodes where we want to sort out the API items
|
|
54
|
+
_generateTocPointersMap(tocConfig) {
|
|
55
|
+
const { catchAllCategory } = this._config;
|
|
56
|
+
if (tocConfig.items) {
|
|
57
|
+
for (const tocItem of tocConfig.items) {
|
|
58
|
+
if (tocItem.items && tocItem.items.length > 0 && this._shouldNotIncludeInPointersMap(tocItem)) {
|
|
59
|
+
this._generateTocPointersMap(tocItem);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// check for presence of the `catchAllCategory` config option
|
|
63
|
+
if (catchAllCategory && tocItem.name === catchAllCategory) {
|
|
64
|
+
this._catchAllPointer = tocItem;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this._tocPointerMap[tocItem.name] = tocItem;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Filtering out the api-item by inlineTags or category name presence in the item name.
|
|
75
|
+
*/
|
|
76
|
+
_filterItem(apiItem, tocItem) {
|
|
77
|
+
const { categoryInlineTag, categorizeByName } = this._config;
|
|
78
|
+
const { name: itemName } = tocItem;
|
|
79
|
+
let filtered = false;
|
|
80
|
+
// First we attempt to filter by inline tag if provided.
|
|
81
|
+
if (apiItem instanceof ApiDocumentedItem) {
|
|
82
|
+
const docInlineTag = categoryInlineTag
|
|
83
|
+
? this._findInlineTagByName(categoryInlineTag, apiItem.tsdocComment)
|
|
84
|
+
: undefined;
|
|
85
|
+
const tagContent = docInlineTag && docInlineTag.tagContent && docInlineTag.tagContent.trim();
|
|
86
|
+
if (tagContent && this._tocPointerMap[tagContent]) {
|
|
87
|
+
// null assertion used because when pointer map was created we checked for presence of empty `items` array
|
|
88
|
+
this._tocPointerMap[tagContent].items.push(tocItem);
|
|
89
|
+
filtered = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// If not filtered by inline tag and `categorizeByName` config is enabled attempt to filter it by category name.
|
|
93
|
+
if (!filtered && categorizeByName) {
|
|
94
|
+
const pointers = Object.keys(this._tocPointerMap);
|
|
95
|
+
for (let i = 0, length = pointers.length; i < length; i++) {
|
|
96
|
+
if (itemName.indexOf(pointers[i]) !== -1) {
|
|
97
|
+
// null assertion used because when pointer map was created we checked for presence of empty `items` array
|
|
98
|
+
this._tocPointerMap[pointers[i]].items.push(tocItem);
|
|
99
|
+
filtered = true;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// If item still not filtered and a `catchAllCategory` config provided push it to it.
|
|
105
|
+
if (!filtered && this._catchAllPointer && this._catchAllPointer.items) {
|
|
106
|
+
this._catchAllPointer.items.push(tocItem);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// This is a direct copy of a @docCategory inline tag finder in office-ui-fabric-react,
|
|
110
|
+
// but is generic enough to be used for any inline tag
|
|
111
|
+
_findInlineTagByName(tagName, docComment) {
|
|
112
|
+
const tagNameToCheck = `@${tagName}`;
|
|
113
|
+
if (docComment instanceof DocInlineTag) {
|
|
114
|
+
if (docComment.tagName === tagNameToCheck) {
|
|
115
|
+
return docComment;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (docComment) {
|
|
119
|
+
for (const childNode of docComment.getChildNodes()) {
|
|
120
|
+
const result = this._findInlineTagByName(tagName, childNode);
|
|
121
|
+
if (result !== undefined) {
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
_shouldNotIncludeInPointersMap(item) {
|
|
129
|
+
const { nonEmptyCategoryNodeNames } = this._config;
|
|
130
|
+
if (nonEmptyCategoryNodeNames && nonEmptyCategoryNodeNames.length) {
|
|
131
|
+
return nonEmptyCategoryNodeNames.indexOf(item.name) === -1;
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=ExperimentalYamlDocumenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExperimentalYamlDocumenter.js","sourceRoot":"","sources":["../../src/documenters/ExperimentalYamlDocumenter.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAA+B,WAAW,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAI7G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;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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,EAAE,CAAC;QAE7C,IAAI,UAAU,YAAY,YAAY,EAAE,CAAC;YACvC,IAAI,UAAU,CAAC,OAAO,KAAK,cAAc,EAAE,CAAC;gBAC1C,OAAO,UAAU,CAAC;YACpB,CAAC;QACH,CAAC;QACD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC;gBACnD,MAAM,MAAM,GAA6B,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAuB,CAAC,CAAC;gBACrG,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBACzB,OAAO,MAAM,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;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,CAAC;YAClE,OAAO,yBAAyB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { type 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"]}
|
|
@@ -0,0 +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.\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"]}
|