@firebase/api-documenter 0.1.2-canary.233e117f0
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.md +10 -0
- package/README.md +16 -0
- package/dist/cli/ApiDocumenterCommandLine.d.ts +22 -0
- package/dist/cli/ApiDocumenterCommandLine.js +44 -0
- package/dist/cli/ApiDocumenterCommandLine.js.map +1 -0
- package/dist/cli/BaseAction.d.ts +37 -0
- package/dist/cli/BaseAction.js +125 -0
- package/dist/cli/BaseAction.js.map +1 -0
- package/dist/cli/MarkdownAction.d.ts +22 -0
- package/dist/cli/MarkdownAction.js +47 -0
- package/dist/cli/MarkdownAction.js.map +1 -0
- package/dist/cli/TocAction.d.ts +25 -0
- package/dist/cli/TocAction.js +67 -0
- package/dist/cli/TocAction.js.map +1 -0
- package/dist/documenters/DocumenterConfig.d.ts +45 -0
- package/dist/documenters/DocumenterConfig.js +63 -0
- package/dist/documenters/DocumenterConfig.js.map +1 -0
- package/dist/documenters/IConfigFile.d.ts +98 -0
- package/dist/documenters/IConfigFile.js +19 -0
- package/dist/documenters/IConfigFile.js.map +1 -0
- package/dist/documenters/MarkdownDocumenter.d.ts +75 -0
- package/dist/documenters/MarkdownDocumenter.js +750 -0
- package/dist/documenters/MarkdownDocumenter.js.map +1 -0
- package/dist/documenters/MarkdownDocumenterHelpers.d.ts +40 -0
- package/dist/documenters/MarkdownDocumenterHelpers.js +306 -0
- package/dist/documenters/MarkdownDocumenterHelpers.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown/CustomMarkdownEmitter.d.ts +32 -0
- package/dist/markdown/CustomMarkdownEmitter.js +161 -0
- package/dist/markdown/CustomMarkdownEmitter.js.map +1 -0
- package/dist/markdown/MarkdownEmitter.d.ts +48 -0
- package/dist/markdown/MarkdownEmitter.js +243 -0
- package/dist/markdown/MarkdownEmitter.js.map +1 -0
- package/dist/markdown/test/CustomMarkdownEmitter.test.d.ts +17 -0
- package/dist/markdown/test/CustomMarkdownEmitter.test.js +205 -0
- package/dist/markdown/test/CustomMarkdownEmitter.test.js.map +1 -0
- package/dist/nodes/CustomDocNodeKind.d.ts +32 -0
- package/dist/nodes/CustomDocNodeKind.js +58 -0
- package/dist/nodes/CustomDocNodeKind.js.map +1 -0
- package/dist/nodes/DocEmphasisSpan.d.ts +35 -0
- package/dist/nodes/DocEmphasisSpan.js +39 -0
- package/dist/nodes/DocEmphasisSpan.js.map +1 -0
- package/dist/nodes/DocHeading.d.ts +38 -0
- package/dist/nodes/DocHeading.js +45 -0
- package/dist/nodes/DocHeading.js.map +1 -0
- package/dist/nodes/DocNoteBox.d.ts +33 -0
- package/dist/nodes/DocNoteBox.js +41 -0
- package/dist/nodes/DocNoteBox.js.map +1 -0
- package/dist/nodes/DocTable.d.ts +41 -0
- package/dist/nodes/DocTable.js +77 -0
- package/dist/nodes/DocTable.js.map +1 -0
- package/dist/nodes/DocTableCell.d.ts +31 -0
- package/dist/nodes/DocTableCell.js +37 -0
- package/dist/nodes/DocTableCell.js.map +1 -0
- package/dist/nodes/DocTableRow.d.ts +38 -0
- package/dist/nodes/DocTableRow.js +68 -0
- package/dist/nodes/DocTableRow.js.map +1 -0
- package/dist/plugin/IApiDocumenterPluginManifest.d.ts +85 -0
- package/dist/plugin/IApiDocumenterPluginManifest.js +19 -0
- package/dist/plugin/IApiDocumenterPluginManifest.js.map +1 -0
- package/dist/plugin/MarkdownDocumenterAccessor.d.ts +41 -0
- package/dist/plugin/MarkdownDocumenterAccessor.js +44 -0
- package/dist/plugin/MarkdownDocumenterAccessor.js.map +1 -0
- package/dist/plugin/MarkdownDocumenterFeature.d.ts +88 -0
- package/dist/plugin/MarkdownDocumenterFeature.js +66 -0
- package/dist/plugin/MarkdownDocumenterFeature.js.map +1 -0
- package/dist/plugin/PluginFeature.d.ts +61 -0
- package/dist/plugin/PluginFeature.js +76 -0
- package/dist/plugin/PluginFeature.js.map +1 -0
- package/dist/plugin/PluginLoader.d.ts +22 -0
- package/dist/plugin/PluginLoader.js +100 -0
- package/dist/plugin/PluginLoader.js.map +1 -0
- package/dist/schemas/api-documenter-template.json +92 -0
- package/dist/schemas/api-documenter.schema.json +42 -0
- package/dist/start.d.ts +18 -0
- package/dist/start.js +32 -0
- package/dist/start.js.map +1 -0
- package/dist/toc.d.ts +25 -0
- package/dist/toc.js +61 -0
- package/dist/toc.js.map +1 -0
- package/dist/utils/IndentedWriter.d.ts +116 -0
- package/dist/utils/IndentedWriter.js +213 -0
- package/dist/utils/IndentedWriter.js.map +1 -0
- package/dist/utils/Utilities.d.ts +28 -0
- package/dist/utils/Utilities.js +47 -0
- package/dist/utils/Utilities.js.map +1 -0
- package/dist/utils/test/IndentedWriter.test.d.ts +17 -0
- package/dist/utils/test/IndentedWriter.test.js +87 -0
- package/dist/utils/test/IndentedWriter.test.js.map +1 -0
- package/package.json +38 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @firebase/api-documenter
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- [#4931](https://github.com/firebase/firebase-js-sdk/pull/4931) Support toc generation for Firebase devsite.
|
|
7
|
+
## 0.1.1
|
|
8
|
+
### Patch Changes
|
|
9
|
+
|
|
10
|
+
- [#4869](https://github.com/firebase/firebase-js-sdk/pull/4869) Generate API docs for namespace members
|
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @firebase/api-documenter
|
|
2
|
+
|
|
3
|
+
It is a fork of [API Documenter](https://github.com/microsoft/rushstack/tree/master/apps/api-documenter)
|
|
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) format suitable for displaying in Firebase Devsite.
|
|
6
|
+
|
|
7
|
+
## Generate toc for Firebase devsite
|
|
8
|
+
`api-documenter-fire toc -i temp -p "/docs/reference/js/v9"`
|
|
9
|
+
|
|
10
|
+
`-i` and `-p` (`--host-path`) are required parameters.
|
|
11
|
+
Use `-i` to specify the folder that contains api.json files.
|
|
12
|
+
Use `-p` to specify the g3 path that contains the reference docs.
|
|
13
|
+
|
|
14
|
+
By default, the command will create `toc.yaml` in folder `/toc`. To change the output folder, use the flag `-o`.
|
|
15
|
+
|
|
16
|
+
To generate toc for the Firebase JS SDK, also set the flag `-j` to create the top level `firebase` toc item.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { CommandLineParser } from '@rushstack/ts-command-line';
|
|
18
|
+
export declare class ApiDocumenterCommandLine extends CommandLineParser {
|
|
19
|
+
constructor();
|
|
20
|
+
protected onDefineParameters(): void;
|
|
21
|
+
private _populateActions;
|
|
22
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2020 Google LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ApiDocumenterCommandLine = void 0;
|
|
20
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
21
|
+
// See LICENSE in the project root for license information.
|
|
22
|
+
const ts_command_line_1 = require("@rushstack/ts-command-line");
|
|
23
|
+
const MarkdownAction_1 = require("./MarkdownAction");
|
|
24
|
+
const TocAction_1 = require("./TocAction");
|
|
25
|
+
class ApiDocumenterCommandLine extends ts_command_line_1.CommandLineParser {
|
|
26
|
+
constructor() {
|
|
27
|
+
super({
|
|
28
|
+
toolFilename: 'api-documenter',
|
|
29
|
+
toolDescription: 'Reads *.api.json files produced by api-extractor, ' +
|
|
30
|
+
' and generates API documentation in various output formats.'
|
|
31
|
+
});
|
|
32
|
+
this._populateActions();
|
|
33
|
+
}
|
|
34
|
+
onDefineParameters() {
|
|
35
|
+
// override
|
|
36
|
+
// No parameters
|
|
37
|
+
}
|
|
38
|
+
_populateActions() {
|
|
39
|
+
this.addAction(new MarkdownAction_1.MarkdownAction(this));
|
|
40
|
+
this.addAction(new TocAction_1.TocAction(this));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ApiDocumenterCommandLine = ApiDocumenterCommandLine;
|
|
44
|
+
//# sourceMappingURL=ApiDocumenterCommandLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiDocumenterCommandLine.js","sourceRoot":"","sources":["../../src/cli/ApiDocumenterCommandLine.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,gEAA+D;AAC/D,qDAAkD;AAClD,2CAAwC;AAExC,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;IAES,kBAAkB;QAC1B,WAAW;QACX,gBAAgB;IAClB,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,SAAS,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;CACF;AApBD,4DAoBC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { CommandLineAction } from '@rushstack/ts-command-line';
|
|
18
|
+
import { ApiModel } from 'api-extractor-model-me';
|
|
19
|
+
export interface IBuildApiModelResult {
|
|
20
|
+
apiModel: ApiModel;
|
|
21
|
+
inputFolder: string;
|
|
22
|
+
outputFolder: string;
|
|
23
|
+
addFileNameSuffix: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare abstract class BaseAction extends CommandLineAction {
|
|
26
|
+
private _inputFolderParameter;
|
|
27
|
+
private _outputFolderParameter;
|
|
28
|
+
private _fileNameSuffixParameter;
|
|
29
|
+
protected onDefineParameters(): void;
|
|
30
|
+
protected buildApiModel(): IBuildApiModelResult;
|
|
31
|
+
private _applyInheritDoc;
|
|
32
|
+
/**
|
|
33
|
+
* Copy the content from `sourceDocComment` to `targetDocComment`.
|
|
34
|
+
* This code is borrowed from DocCommentEnhancer as a temporary workaround.
|
|
35
|
+
*/
|
|
36
|
+
private _copyInheritedDocs;
|
|
37
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2020 Google LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.BaseAction = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
22
|
+
// See LICENSE in the project root for license information.
|
|
23
|
+
const path = tslib_1.__importStar(require("path"));
|
|
24
|
+
const colors_1 = tslib_1.__importDefault(require("colors"));
|
|
25
|
+
const ts_command_line_1 = require("@rushstack/ts-command-line");
|
|
26
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
27
|
+
const api_extractor_model_me_1 = require("api-extractor-model-me");
|
|
28
|
+
class BaseAction extends ts_command_line_1.CommandLineAction {
|
|
29
|
+
onDefineParameters() {
|
|
30
|
+
// override
|
|
31
|
+
this._inputFolderParameter = this.defineStringParameter({
|
|
32
|
+
parameterLongName: '--input-folder',
|
|
33
|
+
parameterShortName: '-i',
|
|
34
|
+
argumentName: 'FOLDER1',
|
|
35
|
+
description: `Specifies the input folder containing the *.api.json files to be processed.` +
|
|
36
|
+
` If omitted, the default is "./input"`
|
|
37
|
+
});
|
|
38
|
+
this._outputFolderParameter = this.defineStringParameter({
|
|
39
|
+
parameterLongName: '--output-folder',
|
|
40
|
+
parameterShortName: '-o',
|
|
41
|
+
argumentName: 'FOLDER2',
|
|
42
|
+
description: `Specifies the output folder where the documentation will be written.` +
|
|
43
|
+
` ANY EXISTING CONTENTS WILL BE DELETED!` +
|
|
44
|
+
` If omitted, the default is "./${this.actionName}"`
|
|
45
|
+
});
|
|
46
|
+
this._fileNameSuffixParameter = this.defineFlagParameter({
|
|
47
|
+
parameterLongName: '--name-suffix',
|
|
48
|
+
parameterShortName: '-s',
|
|
49
|
+
description: `Add suffix to interface and class names in the file path.` +
|
|
50
|
+
`For example, packageA.myinterface_i.md for MyInterface interface, ` +
|
|
51
|
+
`Add packageA.myclass_c.md for MyClass class.` +
|
|
52
|
+
`This is to avoid name conflict in case packageA also has, for example, an entry point with the same name in lowercase.` +
|
|
53
|
+
`This option is specifically designed for the Admin SDK where such case occurs.`
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
buildApiModel() {
|
|
57
|
+
const apiModel = new api_extractor_model_me_1.ApiModel();
|
|
58
|
+
const inputFolder = this._inputFolderParameter.value || './input';
|
|
59
|
+
if (!node_core_library_1.FileSystem.exists(inputFolder)) {
|
|
60
|
+
throw new Error('The input folder does not exist: ' + inputFolder);
|
|
61
|
+
}
|
|
62
|
+
const outputFolder = this._outputFolderParameter.value || `./${this.actionName}`;
|
|
63
|
+
node_core_library_1.FileSystem.ensureFolder(outputFolder);
|
|
64
|
+
const addFileNameSuffix = this._fileNameSuffixParameter.value;
|
|
65
|
+
for (const filename of node_core_library_1.FileSystem.readFolder(inputFolder)) {
|
|
66
|
+
if (filename.match(/\.api\.json$/i)) {
|
|
67
|
+
console.log(`Reading ${filename}`);
|
|
68
|
+
const filenamePath = path.join(inputFolder, filename);
|
|
69
|
+
apiModel.loadPackage(filenamePath);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
this._applyInheritDoc(apiModel, apiModel);
|
|
73
|
+
return { apiModel, inputFolder, outputFolder, addFileNameSuffix };
|
|
74
|
+
}
|
|
75
|
+
// TODO: This is a temporary workaround. The long term plan is for API Extractor's DocCommentEnhancer
|
|
76
|
+
// to apply all @inheritDoc tags before the .api.json file is written.
|
|
77
|
+
// See DocCommentEnhancer._applyInheritDoc() for more info.
|
|
78
|
+
_applyInheritDoc(apiItem, apiModel) {
|
|
79
|
+
if (apiItem instanceof api_extractor_model_me_1.ApiDocumentedItem) {
|
|
80
|
+
if (apiItem.tsdocComment) {
|
|
81
|
+
const inheritDocTag = apiItem.tsdocComment.inheritDocTag;
|
|
82
|
+
if (inheritDocTag && inheritDocTag.declarationReference) {
|
|
83
|
+
// Attempt to resolve the declaration reference
|
|
84
|
+
const result = apiModel.resolveDeclarationReference(inheritDocTag.declarationReference, apiItem);
|
|
85
|
+
if (result.errorMessage) {
|
|
86
|
+
console.log(colors_1.default.yellow(`Warning: Unresolved @inheritDoc tag for ${apiItem.displayName}: ` +
|
|
87
|
+
result.errorMessage));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
if (result.resolvedApiItem instanceof api_extractor_model_me_1.ApiDocumentedItem &&
|
|
91
|
+
result.resolvedApiItem.tsdocComment &&
|
|
92
|
+
result.resolvedApiItem !== apiItem) {
|
|
93
|
+
this._copyInheritedDocs(apiItem.tsdocComment, result.resolvedApiItem.tsdocComment);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Recurse members
|
|
100
|
+
if (api_extractor_model_me_1.ApiItemContainerMixin.isBaseClassOf(apiItem)) {
|
|
101
|
+
for (const member of apiItem.members) {
|
|
102
|
+
this._applyInheritDoc(member, apiModel);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Copy the content from `sourceDocComment` to `targetDocComment`.
|
|
108
|
+
* This code is borrowed from DocCommentEnhancer as a temporary workaround.
|
|
109
|
+
*/
|
|
110
|
+
_copyInheritedDocs(targetDocComment, sourceDocComment) {
|
|
111
|
+
targetDocComment.summarySection = sourceDocComment.summarySection;
|
|
112
|
+
targetDocComment.remarksBlock = sourceDocComment.remarksBlock;
|
|
113
|
+
targetDocComment.params.clear();
|
|
114
|
+
for (const param of sourceDocComment.params) {
|
|
115
|
+
targetDocComment.params.add(param);
|
|
116
|
+
}
|
|
117
|
+
for (const typeParam of sourceDocComment.typeParams) {
|
|
118
|
+
targetDocComment.typeParams.add(typeParam);
|
|
119
|
+
}
|
|
120
|
+
targetDocComment.returnsBlock = sourceDocComment.returnsBlock;
|
|
121
|
+
targetDocComment.inheritDocTag = undefined;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.BaseAction = BaseAction;
|
|
125
|
+
//# sourceMappingURL=BaseAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAction.js","sourceRoot":"","sources":["../../src/cli/BaseAction.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';
|
|
18
|
+
import { BaseAction } from './BaseAction';
|
|
19
|
+
export declare class MarkdownAction extends BaseAction {
|
|
20
|
+
constructor(parser: ApiDocumenterCommandLine);
|
|
21
|
+
protected onExecute(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2020 Google LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.MarkdownAction = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
const BaseAction_1 = require("./BaseAction");
|
|
22
|
+
const MarkdownDocumenter_1 = require("../documenters/MarkdownDocumenter");
|
|
23
|
+
class MarkdownAction extends BaseAction_1.BaseAction {
|
|
24
|
+
constructor(parser) {
|
|
25
|
+
super({
|
|
26
|
+
actionName: 'markdown',
|
|
27
|
+
summary: 'Generate documentation as Markdown files (*.md)',
|
|
28
|
+
documentation: 'Generates API documentation as a collection of files in' +
|
|
29
|
+
' Markdown format, suitable for example for publishing on a GitHub site.'
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
onExecute() {
|
|
33
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
// override
|
|
35
|
+
const { apiModel, outputFolder, addFileNameSuffix } = this.buildApiModel();
|
|
36
|
+
const markdownDocumenter = new MarkdownDocumenter_1.MarkdownDocumenter({
|
|
37
|
+
apiModel,
|
|
38
|
+
documenterConfig: undefined,
|
|
39
|
+
outputFolder,
|
|
40
|
+
addFileNameSuffix
|
|
41
|
+
});
|
|
42
|
+
markdownDocumenter.generateFiles();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.MarkdownAction = MarkdownAction;
|
|
47
|
+
//# sourceMappingURL=MarkdownAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownAction.js","sourceRoot":"","sources":["../../src/cli/MarkdownAction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;AAMH,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;IAEe,SAAS;;YACvB,WAAW;YACX,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YAE3E,MAAM,kBAAkB,GAAuB,IAAI,uCAAkB,CAAC;gBACpE,QAAQ;gBACR,gBAAgB,EAAE,SAAS;gBAC3B,YAAY;gBACZ,iBAAiB;aAClB,CAAC,CAAC;YACH,kBAAkB,CAAC,aAAa,EAAE,CAAC;QACrC,CAAC;KAAA;CACF;AAvBD,wCAuBC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';
|
|
18
|
+
import { BaseAction } from './BaseAction';
|
|
19
|
+
export declare class TocAction extends BaseAction {
|
|
20
|
+
private _g3PathParameter;
|
|
21
|
+
private _jsSDKParameter;
|
|
22
|
+
constructor(parser: ApiDocumenterCommandLine);
|
|
23
|
+
protected onDefineParameters(): void;
|
|
24
|
+
protected onExecute(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2021 Google LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.TocAction = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
const BaseAction_1 = require("./BaseAction");
|
|
22
|
+
const toc_1 = require("../toc");
|
|
23
|
+
class TocAction extends BaseAction_1.BaseAction {
|
|
24
|
+
constructor(parser) {
|
|
25
|
+
super({
|
|
26
|
+
actionName: 'toc',
|
|
27
|
+
summary: 'Generate TOC(table of content) for Firebase devsite.',
|
|
28
|
+
documentation: 'Generate TOC(table of content) for Firebase devsite.'
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
onDefineParameters() {
|
|
32
|
+
super.onDefineParameters();
|
|
33
|
+
this._g3PathParameter = this.defineStringParameter({
|
|
34
|
+
parameterLongName: '--host-path',
|
|
35
|
+
parameterShortName: '-p',
|
|
36
|
+
argumentName: 'HOSTPATH',
|
|
37
|
+
description: `Specifies the path where the reference docs resides (e.g. g3).
|
|
38
|
+
Used to generate paths in the toc`
|
|
39
|
+
});
|
|
40
|
+
this._jsSDKParameter = this.defineFlagParameter({
|
|
41
|
+
parameterLongName: '--js-sdk',
|
|
42
|
+
parameterShortName: '-j',
|
|
43
|
+
description: `Generating toc for the Firebase JS SDK.` +
|
|
44
|
+
`It will create an artificial top level toc item "firebase".`
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
onExecute() {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
// override
|
|
50
|
+
const { apiModel, outputFolder, addFileNameSuffix } = this.buildApiModel();
|
|
51
|
+
const g3Path = this._g3PathParameter.value;
|
|
52
|
+
const jsSdk = this._jsSDKParameter.value;
|
|
53
|
+
if (!g3Path) {
|
|
54
|
+
throw new Error('--g3-path is a required to generate toc, but it is not provided');
|
|
55
|
+
}
|
|
56
|
+
toc_1.generateToc({
|
|
57
|
+
apiModel,
|
|
58
|
+
outputFolder,
|
|
59
|
+
addFileNameSuffix,
|
|
60
|
+
g3Path,
|
|
61
|
+
jsSdk
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.TocAction = TocAction;
|
|
67
|
+
//# sourceMappingURL=TocAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TocAction.js","sourceRoot":"","sources":["../../src/cli/TocAction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;AAOH,6CAA0C;AAC1C,gCAAqC;AAErC,MAAa,SAAU,SAAQ,uBAAU;IAGvC,YAAmB,MAAgC;QACjD,KAAK,CAAC;YACJ,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,sDAAsD;YAC/D,aAAa,EAAE,sDAAsD;SACtE,CAAC,CAAC;IACL,CAAC;IAES,kBAAkB;QAC1B,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAE3B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACjD,iBAAiB,EAAE,aAAa;YAChC,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,UAAU;YACxB,WAAW,EAAE;kDAC+B;SAC7C,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC9C,iBAAiB,EAAE,UAAU;YAC7B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EACT,yCAAyC;gBACzC,6DAA6D;SAChE,CAAC,CAAC;IACL,CAAC;IAEe,SAAS;;YACvB,WAAW;YACX,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YAC3E,MAAM,MAAM,GAAuB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAC/D,MAAM,KAAK,GAAY,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;YAElD,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;aACH;YAED,iBAAW,CAAC;gBACV,QAAQ;gBACR,YAAY;gBACZ,iBAAiB;gBACjB,MAAM;gBACN,KAAK;aACN,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAnDD,8BAmDC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { JsonSchema, NewlineKind } from '@rushstack/node-core-library';
|
|
18
|
+
import { IConfigFile } from './IConfigFile';
|
|
19
|
+
/**
|
|
20
|
+
* Helper for loading the api-documenter.json file format. Later when the schema is more mature,
|
|
21
|
+
* this class will be used to represent the validated and normalized configuration, whereas `IConfigFile`
|
|
22
|
+
* represents the raw JSON file structure.
|
|
23
|
+
*/
|
|
24
|
+
export declare class DocumenterConfig {
|
|
25
|
+
readonly configFilePath: string;
|
|
26
|
+
readonly configFile: IConfigFile;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies what type of newlines API Documenter should use when writing output files. By default, the output files
|
|
29
|
+
* will be written with Windows-style newlines.
|
|
30
|
+
*/
|
|
31
|
+
readonly newlineKind: NewlineKind;
|
|
32
|
+
/**
|
|
33
|
+
* The JSON Schema for API Extractor config file (api-extractor.schema.json).
|
|
34
|
+
*/
|
|
35
|
+
static readonly jsonSchema: JsonSchema;
|
|
36
|
+
/**
|
|
37
|
+
* The config file name "api-extractor.json".
|
|
38
|
+
*/
|
|
39
|
+
static readonly FILENAME: string;
|
|
40
|
+
private constructor();
|
|
41
|
+
/**
|
|
42
|
+
* Load and validate an api-documenter.json file.
|
|
43
|
+
*/
|
|
44
|
+
static loadFile(configFilePath: string): DocumenterConfig;
|
|
45
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2020 Google LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.DocumenterConfig = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
22
|
+
// See LICENSE in the project root for license information.
|
|
23
|
+
const path = tslib_1.__importStar(require("path"));
|
|
24
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
25
|
+
/**
|
|
26
|
+
* Helper for loading the api-documenter.json file format. Later when the schema is more mature,
|
|
27
|
+
* this class will be used to represent the validated and normalized configuration, whereas `IConfigFile`
|
|
28
|
+
* represents the raw JSON file structure.
|
|
29
|
+
*/
|
|
30
|
+
class DocumenterConfig {
|
|
31
|
+
constructor(filePath, configFile) {
|
|
32
|
+
this.configFilePath = filePath;
|
|
33
|
+
this.configFile = configFile;
|
|
34
|
+
switch (configFile.newlineKind) {
|
|
35
|
+
case 'lf':
|
|
36
|
+
this.newlineKind = "\n" /* Lf */;
|
|
37
|
+
break;
|
|
38
|
+
case 'os':
|
|
39
|
+
this.newlineKind = "os" /* OsDefault */;
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
this.newlineKind = "\r\n" /* CrLf */;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Load and validate an api-documenter.json file.
|
|
48
|
+
*/
|
|
49
|
+
static loadFile(configFilePath) {
|
|
50
|
+
const configFile = node_core_library_1.JsonFile.loadAndValidate(configFilePath, DocumenterConfig.jsonSchema);
|
|
51
|
+
return new DocumenterConfig(path.resolve(configFilePath), configFile);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.DocumenterConfig = DocumenterConfig;
|
|
55
|
+
/**
|
|
56
|
+
* The JSON Schema for API Extractor config file (api-extractor.schema.json).
|
|
57
|
+
*/
|
|
58
|
+
DocumenterConfig.jsonSchema = node_core_library_1.JsonSchema.fromFile(path.join(__dirname, '..', 'schemas', 'api-documenter.schema.json'));
|
|
59
|
+
/**
|
|
60
|
+
* The config file name "api-extractor.json".
|
|
61
|
+
*/
|
|
62
|
+
DocumenterConfig.FILENAME = 'api-documenter.json';
|
|
63
|
+
//# sourceMappingURL=DocumenterConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumenterConfig.js","sourceRoot":"","sources":["../../src/documenters/DocumenterConfig.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,mDAA6B;AAC7B,oEAIsC;AAGtC;;;;GAIG;AACH,MAAa,gBAAgB;IAsB3B,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,gBAAiB,CAAC;gBAClC,MAAM;YACR,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,uBAAwB,CAAC;gBACzC,MAAM;YACR;gBACE,IAAI,CAAC,WAAW,oBAAmB,CAAC;gBACpC,MAAM;SACT;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,cAAsB;QAC3C,MAAM,UAAU,GAAgB,4BAAQ,CAAC,eAAe,CACtD,cAAc,EACd,gBAAgB,CAAC,UAAU,CAC5B,CAAC;QAEF,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;;AAjDH,4CAkDC;AAxCC;;GAEG;AACoB,2BAAU,GAAe,8BAAU,CAAC,QAAQ,CACjE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,4BAA4B,CAAC,CACpE,CAAC;AAEF;;GAEG;AACoB,yBAAQ,GAAW,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Typescript interface describing the config schema for toc.yml file format.
|
|
19
|
+
*/
|
|
20
|
+
export interface IConfigTableOfContents {
|
|
21
|
+
/**
|
|
22
|
+
* Optional category name that is recommended to be included along with
|
|
23
|
+
* one of the configs: {@link IConfigTableOfContents.categorizeByName} or
|
|
24
|
+
* {@link IConfigTableOfContents.categoryInlineTag}.
|
|
25
|
+
* Any items that are not matched according to the mentioned configuration options will be placed under this
|
|
26
|
+
* catchAll category. If none provided the items will not be included in the final toc.yml file.
|
|
27
|
+
*/
|
|
28
|
+
catchAllCategory?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Toggle either categorization of the API items should be made based on category name presence
|
|
31
|
+
* in the API item's name. Useful when there are API items without an inline tag to categorize them,
|
|
32
|
+
* but still need to place the items under categories. Note: this type of categorization might place some items
|
|
33
|
+
* under wrong categories if the names are similar but belong to different categories.
|
|
34
|
+
* In case that {@link IConfigTableOfContents.categoryInlineTag} is provided it will try categorize by
|
|
35
|
+
* using it and only if it didn't, it will attempt to categorize by name.
|
|
36
|
+
*/
|
|
37
|
+
categorizeByName?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Inline tag that will be used to categorize the API items. Will take precedence over the
|
|
40
|
+
* {@link IConfigTableOfContents.categorizeByName} flag in trying to place the API item according to the
|
|
41
|
+
* custom inline tag present in documentation of the source code.
|
|
42
|
+
*/
|
|
43
|
+
categoryInlineTag?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Array of node names that might have already items injected at the time of creating the
|
|
46
|
+
* {@link IConfigTableOfContents.tocConfig} tree structure but are still needed to be included as category
|
|
47
|
+
* nodes where API items will be pushed during the categorization algorithm.
|
|
48
|
+
*/
|
|
49
|
+
nonEmptyCategoryNodeNames?: string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Describes plugin packages to be loaded, and which features to enable.
|
|
53
|
+
*/
|
|
54
|
+
export interface IConfigPlugin {
|
|
55
|
+
/**
|
|
56
|
+
* Specifies the name of an API Documenter plugin package to be loaded. By convention, the NPM package name
|
|
57
|
+
* should have the prefix `doc-plugin-`. Its main entry point should export an object named
|
|
58
|
+
* `apiDocumenterPluginManifest` which implements the {@link IApiDocumenterPluginManifest} interface.
|
|
59
|
+
*/
|
|
60
|
+
packageName: string;
|
|
61
|
+
/**
|
|
62
|
+
* A list of features to be enabled. The features are defined in {@link IApiDocumenterPluginManifest.features}.
|
|
63
|
+
* The `enabledFeatureNames` strings are matched with {@link IFeatureDefinition.featureName}.
|
|
64
|
+
*/
|
|
65
|
+
enabledFeatureNames: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* This interface represents the api-documenter.json file format.
|
|
69
|
+
*/
|
|
70
|
+
export interface IConfigFile {
|
|
71
|
+
/**
|
|
72
|
+
* Specifies the output target.
|
|
73
|
+
*/
|
|
74
|
+
outputTarget: 'docfx' | 'markdown';
|
|
75
|
+
/**
|
|
76
|
+
* Specifies what type of newlines API Documenter should use when writing output files.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* By default, the output files will be written with Windows-style newlines.
|
|
80
|
+
* To use POSIX-style newlines, specify "lf" instead.
|
|
81
|
+
* To use the OS's default newline kind, specify "os".
|
|
82
|
+
*/
|
|
83
|
+
newlineKind?: 'crlf' | 'lf' | 'os';
|
|
84
|
+
/**
|
|
85
|
+
* This enables an experimental feature that will be officially released with the next major version
|
|
86
|
+
* of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and
|
|
87
|
+
* adds them to the table of contents. This will also affect file layout as namespaced items will be nested
|
|
88
|
+
* under a directory for the namespace instead of just within the package.
|
|
89
|
+
*
|
|
90
|
+
* This setting currently only affects the 'docfx' output target. It is equivalent to the `--new-docfx-namespaces`
|
|
91
|
+
* command-line parameter.
|
|
92
|
+
*/
|
|
93
|
+
newDocfxNamespaces?: boolean;
|
|
94
|
+
/** {@inheritDoc IConfigPlugin} */
|
|
95
|
+
plugins?: IConfigPlugin[];
|
|
96
|
+
/** {@inheritDoc IConfigTableOfContents} */
|
|
97
|
+
tableOfContents?: IConfigTableOfContents;
|
|
98
|
+
}
|