@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.
Files changed (92) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +16 -0
  3. package/dist/cli/ApiDocumenterCommandLine.d.ts +22 -0
  4. package/dist/cli/ApiDocumenterCommandLine.js +44 -0
  5. package/dist/cli/ApiDocumenterCommandLine.js.map +1 -0
  6. package/dist/cli/BaseAction.d.ts +37 -0
  7. package/dist/cli/BaseAction.js +125 -0
  8. package/dist/cli/BaseAction.js.map +1 -0
  9. package/dist/cli/MarkdownAction.d.ts +22 -0
  10. package/dist/cli/MarkdownAction.js +47 -0
  11. package/dist/cli/MarkdownAction.js.map +1 -0
  12. package/dist/cli/TocAction.d.ts +25 -0
  13. package/dist/cli/TocAction.js +67 -0
  14. package/dist/cli/TocAction.js.map +1 -0
  15. package/dist/documenters/DocumenterConfig.d.ts +45 -0
  16. package/dist/documenters/DocumenterConfig.js +63 -0
  17. package/dist/documenters/DocumenterConfig.js.map +1 -0
  18. package/dist/documenters/IConfigFile.d.ts +98 -0
  19. package/dist/documenters/IConfigFile.js +19 -0
  20. package/dist/documenters/IConfigFile.js.map +1 -0
  21. package/dist/documenters/MarkdownDocumenter.d.ts +75 -0
  22. package/dist/documenters/MarkdownDocumenter.js +750 -0
  23. package/dist/documenters/MarkdownDocumenter.js.map +1 -0
  24. package/dist/documenters/MarkdownDocumenterHelpers.d.ts +40 -0
  25. package/dist/documenters/MarkdownDocumenterHelpers.js +306 -0
  26. package/dist/documenters/MarkdownDocumenterHelpers.js.map +1 -0
  27. package/dist/index.d.ts +27 -0
  28. package/dist/index.js +29 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/markdown/CustomMarkdownEmitter.d.ts +32 -0
  31. package/dist/markdown/CustomMarkdownEmitter.js +161 -0
  32. package/dist/markdown/CustomMarkdownEmitter.js.map +1 -0
  33. package/dist/markdown/MarkdownEmitter.d.ts +48 -0
  34. package/dist/markdown/MarkdownEmitter.js +243 -0
  35. package/dist/markdown/MarkdownEmitter.js.map +1 -0
  36. package/dist/markdown/test/CustomMarkdownEmitter.test.d.ts +17 -0
  37. package/dist/markdown/test/CustomMarkdownEmitter.test.js +205 -0
  38. package/dist/markdown/test/CustomMarkdownEmitter.test.js.map +1 -0
  39. package/dist/nodes/CustomDocNodeKind.d.ts +32 -0
  40. package/dist/nodes/CustomDocNodeKind.js +58 -0
  41. package/dist/nodes/CustomDocNodeKind.js.map +1 -0
  42. package/dist/nodes/DocEmphasisSpan.d.ts +35 -0
  43. package/dist/nodes/DocEmphasisSpan.js +39 -0
  44. package/dist/nodes/DocEmphasisSpan.js.map +1 -0
  45. package/dist/nodes/DocHeading.d.ts +38 -0
  46. package/dist/nodes/DocHeading.js +45 -0
  47. package/dist/nodes/DocHeading.js.map +1 -0
  48. package/dist/nodes/DocNoteBox.d.ts +33 -0
  49. package/dist/nodes/DocNoteBox.js +41 -0
  50. package/dist/nodes/DocNoteBox.js.map +1 -0
  51. package/dist/nodes/DocTable.d.ts +41 -0
  52. package/dist/nodes/DocTable.js +77 -0
  53. package/dist/nodes/DocTable.js.map +1 -0
  54. package/dist/nodes/DocTableCell.d.ts +31 -0
  55. package/dist/nodes/DocTableCell.js +37 -0
  56. package/dist/nodes/DocTableCell.js.map +1 -0
  57. package/dist/nodes/DocTableRow.d.ts +38 -0
  58. package/dist/nodes/DocTableRow.js +68 -0
  59. package/dist/nodes/DocTableRow.js.map +1 -0
  60. package/dist/plugin/IApiDocumenterPluginManifest.d.ts +85 -0
  61. package/dist/plugin/IApiDocumenterPluginManifest.js +19 -0
  62. package/dist/plugin/IApiDocumenterPluginManifest.js.map +1 -0
  63. package/dist/plugin/MarkdownDocumenterAccessor.d.ts +41 -0
  64. package/dist/plugin/MarkdownDocumenterAccessor.js +44 -0
  65. package/dist/plugin/MarkdownDocumenterAccessor.js.map +1 -0
  66. package/dist/plugin/MarkdownDocumenterFeature.d.ts +88 -0
  67. package/dist/plugin/MarkdownDocumenterFeature.js +66 -0
  68. package/dist/plugin/MarkdownDocumenterFeature.js.map +1 -0
  69. package/dist/plugin/PluginFeature.d.ts +61 -0
  70. package/dist/plugin/PluginFeature.js +76 -0
  71. package/dist/plugin/PluginFeature.js.map +1 -0
  72. package/dist/plugin/PluginLoader.d.ts +22 -0
  73. package/dist/plugin/PluginLoader.js +100 -0
  74. package/dist/plugin/PluginLoader.js.map +1 -0
  75. package/dist/schemas/api-documenter-template.json +92 -0
  76. package/dist/schemas/api-documenter.schema.json +42 -0
  77. package/dist/start.d.ts +18 -0
  78. package/dist/start.js +32 -0
  79. package/dist/start.js.map +1 -0
  80. package/dist/toc.d.ts +25 -0
  81. package/dist/toc.js +61 -0
  82. package/dist/toc.js.map +1 -0
  83. package/dist/utils/IndentedWriter.d.ts +116 -0
  84. package/dist/utils/IndentedWriter.js +213 -0
  85. package/dist/utils/IndentedWriter.js.map +1 -0
  86. package/dist/utils/Utilities.d.ts +28 -0
  87. package/dist/utils/Utilities.js +47 -0
  88. package/dist/utils/Utilities.js.map +1 -0
  89. package/dist/utils/test/IndentedWriter.test.d.ts +17 -0
  90. package/dist/utils/test/IndentedWriter.test.js +87 -0
  91. package/dist/utils/test/IndentedWriter.test.js.map +1 -0
  92. package/package.json +38 -0
@@ -0,0 +1,77 @@
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.DocTable = 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 tsdoc_1 = require("@microsoft/tsdoc");
23
+ const DocTableRow_1 = require("./DocTableRow");
24
+ /**
25
+ * Represents table, similar to an HTML `<table>` element.
26
+ */
27
+ class DocTable extends tsdoc_1.DocNode {
28
+ constructor(parameters, rows) {
29
+ super(parameters);
30
+ this.header = new DocTableRow_1.DocTableRow({ configuration: this.configuration });
31
+ this._rows = [];
32
+ if (parameters) {
33
+ if (parameters.headerTitles) {
34
+ if (parameters.headerCells) {
35
+ throw new Error('IDocTableParameters.headerCells and IDocTableParameters.headerTitles' +
36
+ ' cannot both be specified');
37
+ }
38
+ for (const cellText of parameters.headerTitles) {
39
+ this.header.addPlainTextCell(cellText);
40
+ }
41
+ }
42
+ else if (parameters.headerCells) {
43
+ for (const cell of parameters.headerCells) {
44
+ this.header.addCell(cell);
45
+ }
46
+ }
47
+ }
48
+ if (rows) {
49
+ for (const row of rows) {
50
+ this.addRow(row);
51
+ }
52
+ }
53
+ }
54
+ /** @override */
55
+ get kind() {
56
+ return "Table" /* Table */;
57
+ }
58
+ get rows() {
59
+ return this._rows;
60
+ }
61
+ addRow(row) {
62
+ this._rows.push(row);
63
+ }
64
+ createAndAddRow() {
65
+ const row = new DocTableRow_1.DocTableRow({
66
+ configuration: this.configuration
67
+ });
68
+ this.addRow(row);
69
+ return row;
70
+ }
71
+ /** @override */
72
+ onGetChildNodes() {
73
+ return [this.header, ...this._rows];
74
+ }
75
+ }
76
+ exports.DocTable = DocTable;
77
+ //# sourceMappingURL=DocTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocTable.js","sourceRoot":"","sources":["../../src/nodes/DocTable.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,4CAA+D;AAE/D,+CAA4C;AAW5C;;GAEG;AACH,MAAa,QAAS,SAAQ,eAAO;IAKnC,YACE,UAA+B,EAC/B,IAAiC;QAEjC,KAAK,CAAC,UAAU,CAAC,CAAC;QAElB,IAAI,CAAC,MAAM,GAAG,IAAI,yBAAW,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAEhB,IAAI,UAAU,EAAE;YACd,IAAI,UAAU,CAAC,YAAY,EAAE;gBAC3B,IAAI,UAAU,CAAC,WAAW,EAAE;oBAC1B,MAAM,IAAI,KAAK,CACb,sEAAsE;wBACpE,2BAA2B,CAC9B,CAAC;iBACH;gBACD,KAAK,MAAM,QAAQ,IAAI,UAAU,CAAC,YAAY,EAAE;oBAC9C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;iBACxC;aACF;iBAAM,IAAI,UAAU,CAAC,WAAW,EAAE;gBACjC,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,WAAW,EAAE;oBACzC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iBAC3B;aACF;SACF;QAED,IAAI,IAAI,EAAE;YACR,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;gBACtB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAClB;SACF;IACH,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,2BAA+B;IACjC,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,MAAM,CAAC,GAAgB;QAC5B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAEM,eAAe;QACpB,MAAM,GAAG,GAAgB,IAAI,yBAAW,CAAC;YACvC,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,gBAAgB;IACN,eAAe;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF;AAhED,4BAgEC"}
@@ -0,0 +1,31 @@
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 { IDocNodeParameters, DocNode, DocSection } from '@microsoft/tsdoc';
18
+ /**
19
+ * Constructor parameters for {@link DocTableCell}.
20
+ */
21
+ export interface IDocTableCellParameters extends IDocNodeParameters {
22
+ }
23
+ /**
24
+ * Represents table cell, similar to an HTML `<td>` element.
25
+ */
26
+ export declare class DocTableCell extends DocNode {
27
+ readonly content: DocSection;
28
+ constructor(parameters: IDocTableCellParameters, sectionChildNodes?: ReadonlyArray<DocNode>);
29
+ /** @override */
30
+ get kind(): string;
31
+ }
@@ -0,0 +1,37 @@
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.DocTableCell = 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 tsdoc_1 = require("@microsoft/tsdoc");
23
+ /**
24
+ * Represents table cell, similar to an HTML `<td>` element.
25
+ */
26
+ class DocTableCell extends tsdoc_1.DocNode {
27
+ constructor(parameters, sectionChildNodes) {
28
+ super(parameters);
29
+ this.content = new tsdoc_1.DocSection({ configuration: this.configuration }, sectionChildNodes);
30
+ }
31
+ /** @override */
32
+ get kind() {
33
+ return "TableCell" /* TableCell */;
34
+ }
35
+ }
36
+ exports.DocTableCell = DocTableCell;
37
+ //# sourceMappingURL=DocTableCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocTableCell.js","sourceRoot":"","sources":["../../src/nodes/DocTableCell.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,4CAA2E;AAQ3E;;GAEG;AACH,MAAa,YAAa,SAAQ,eAAO;IAGvC,YACE,UAAmC,EACnC,iBAA0C;QAE1C,KAAK,CAAC,UAAU,CAAC,CAAC;QAElB,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAU,CAC3B,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,EACrC,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,mCAAmC;IACrC,CAAC;CACF;AAnBD,oCAmBC"}
@@ -0,0 +1,38 @@
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 { IDocNodeParameters, DocNode } from '@microsoft/tsdoc';
18
+ import { DocTableCell } from './DocTableCell';
19
+ /**
20
+ * Constructor parameters for {@link DocTableRow}.
21
+ */
22
+ export interface IDocTableRowParameters extends IDocNodeParameters {
23
+ }
24
+ /**
25
+ * Represents table row, similar to an HTML `<tr>` element.
26
+ */
27
+ export declare class DocTableRow extends DocNode {
28
+ private readonly _cells;
29
+ constructor(parameters: IDocTableRowParameters, cells?: ReadonlyArray<DocTableCell>);
30
+ /** @override */
31
+ get kind(): string;
32
+ get cells(): ReadonlyArray<DocTableCell>;
33
+ addCell(cell: DocTableCell): void;
34
+ createAndAddCell(): DocTableCell;
35
+ addPlainTextCell(cellContent: string): DocTableCell;
36
+ /** @override */
37
+ protected onGetChildNodes(): ReadonlyArray<DocNode | undefined>;
38
+ }
@@ -0,0 +1,68 @@
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.DocTableRow = 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 tsdoc_1 = require("@microsoft/tsdoc");
23
+ const DocTableCell_1 = require("./DocTableCell");
24
+ /**
25
+ * Represents table row, similar to an HTML `<tr>` element.
26
+ */
27
+ class DocTableRow extends tsdoc_1.DocNode {
28
+ constructor(parameters, cells) {
29
+ super(parameters);
30
+ this._cells = [];
31
+ if (cells) {
32
+ for (const cell of cells) {
33
+ this.addCell(cell);
34
+ }
35
+ }
36
+ }
37
+ /** @override */
38
+ get kind() {
39
+ return "TableRow" /* TableRow */;
40
+ }
41
+ get cells() {
42
+ return this._cells;
43
+ }
44
+ addCell(cell) {
45
+ this._cells.push(cell);
46
+ }
47
+ createAndAddCell() {
48
+ const newCell = new DocTableCell_1.DocTableCell({
49
+ configuration: this.configuration
50
+ });
51
+ this.addCell(newCell);
52
+ return newCell;
53
+ }
54
+ addPlainTextCell(cellContent) {
55
+ const cell = this.createAndAddCell();
56
+ cell.content.appendNodeInParagraph(new tsdoc_1.DocPlainText({
57
+ configuration: this.configuration,
58
+ text: cellContent
59
+ }));
60
+ return cell;
61
+ }
62
+ /** @override */
63
+ onGetChildNodes() {
64
+ return this._cells;
65
+ }
66
+ }
67
+ exports.DocTableRow = DocTableRow;
68
+ //# sourceMappingURL=DocTableRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocTableRow.js","sourceRoot":"","sources":["../../src/nodes/DocTableRow.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,4CAA6E;AAE7E,iDAA8C;AAO9C;;GAEG;AACH,MAAa,WAAY,SAAQ,eAAO;IAGtC,YACE,UAAkC,EAClC,KAAmC;QAEnC,KAAK,CAAC,UAAU,CAAC,CAAC;QAElB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,KAAK,EAAE;YACT,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aACpB;SACF;IACH,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,iCAAkC;IACpC,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,OAAO,CAAC,IAAkB;QAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAEM,gBAAgB;QACrB,MAAM,OAAO,GAAiB,IAAI,2BAAY,CAAC;YAC7C,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,OAAO,CAAC;IACjB,CAAC;IAEM,gBAAgB,CAAC,WAAmB;QACzC,MAAM,IAAI,GAAiB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnD,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAChC,IAAI,oBAAY,CAAC;YACf,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,WAAW;SAClB,CAAC,CACH,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB;IACN,eAAe;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AArDD,kCAqDC"}
@@ -0,0 +1,85 @@
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 { MarkdownDocumenterFeature } from './MarkdownDocumenterFeature';
18
+ import { PluginFeatureInitialization } from './PluginFeature';
19
+ /**
20
+ * Defines a "feature" that is provided by an API Documenter plugin. A feature is a user-defined module
21
+ * that customizes the behavior of API Documenter.
22
+ *
23
+ * @public
24
+ */
25
+ export interface IFeatureDefinition {
26
+ /**
27
+ * The name of this feature, as it will appear in the config file.
28
+ *
29
+ * The name should consist of one or more words separated by hyphens. Each word should consist of lower case
30
+ * letters and numbers. Example: `my-feature`
31
+ */
32
+ featureName: string;
33
+ /**
34
+ * Determines the kind of feature. The specified value is the name of the base class that `subclass` inherits from.
35
+ *
36
+ * @remarks
37
+ * For now, `MarkdownDocumenterFeature` is the only supported value.
38
+ */
39
+ kind: 'MarkdownDocumenterFeature';
40
+ /**
41
+ * Your subclass that extends from the base class.
42
+ */
43
+ subclass: {
44
+ new (initialization: PluginFeatureInitialization): MarkdownDocumenterFeature;
45
+ };
46
+ }
47
+ /**
48
+ * The manifest for an API Documenter plugin.
49
+ *
50
+ * @remarks
51
+ * An API documenter plugin is an NPM package. By convention, the NPM package name should have the prefix
52
+ * `doc-plugin-`. Its main entry point should export an object named `apiDocumenterPluginManifest` which implements
53
+ * the `IApiDocumenterPluginManifest` interface.
54
+ *
55
+ * For example:
56
+ * ```ts
57
+ * class MyMarkdownDocumenter extends MarkdownDocumenterFeature {
58
+ * public onInitialized(): void {
59
+ * console.log('MyMarkdownDocumenter: onInitialized()');
60
+ * }
61
+ * }
62
+ *
63
+ * export const apiDocumenterPluginManifest: IApiDocumenterPluginManifest = {
64
+ * manifestVersion: 1000,
65
+ * features: [
66
+ * {
67
+ * featureName: 'my-markdown-documenter',
68
+ * kind: 'MarkdownDocumenterFeature',
69
+ * subclass: MyMarkdownDocumenter
70
+ * }
71
+ * ]
72
+ * };
73
+ * ```
74
+ * @public
75
+ */
76
+ export interface IApiDocumenterPluginManifest {
77
+ /**
78
+ * The manifest version number. For now, this must always be `1000`.
79
+ */
80
+ manifestVersion: 1000;
81
+ /**
82
+ * The list of features provided by this plugin.
83
+ */
84
+ features: IFeatureDefinition[];
85
+ }
@@ -0,0 +1,19 @@
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
+ //# sourceMappingURL=IApiDocumenterPluginManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IApiDocumenterPluginManifest.js","sourceRoot":"","sources":["../../src/plugin/IApiDocumenterPluginManifest.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,41 @@
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 { ApiItem } from 'api-extractor-model-me';
18
+ /** @internal */
19
+ export interface IMarkdownDocumenterAccessorImplementation {
20
+ getLinkForApiItem(apiItem: ApiItem): string | undefined;
21
+ }
22
+ /**
23
+ * Provides access to the documenter that is generating the output.
24
+ *
25
+ * @privateRemarks
26
+ * This class is wrapper that provides access to the underlying MarkdownDocumenter, while hiding the implementation
27
+ * details to ensure that the plugin API contract is stable.
28
+ *
29
+ * @public
30
+ */
31
+ export declare class MarkdownDocumenterAccessor {
32
+ private _implementation;
33
+ /** @internal */
34
+ constructor(implementation: IMarkdownDocumenterAccessorImplementation);
35
+ /**
36
+ * For a given `ApiItem`, return its markdown hyperlink.
37
+ *
38
+ * @returns The hyperlink, or `undefined` if the `ApiItem` object does not have a hyperlink.
39
+ */
40
+ getLinkForApiItem(apiItem: ApiItem): string | undefined;
41
+ }
@@ -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.MarkdownDocumenterAccessor = void 0;
20
+ /**
21
+ * Provides access to the documenter that is generating the output.
22
+ *
23
+ * @privateRemarks
24
+ * This class is wrapper that provides access to the underlying MarkdownDocumenter, while hiding the implementation
25
+ * details to ensure that the plugin API contract is stable.
26
+ *
27
+ * @public
28
+ */
29
+ class MarkdownDocumenterAccessor {
30
+ /** @internal */
31
+ constructor(implementation) {
32
+ this._implementation = implementation;
33
+ }
34
+ /**
35
+ * For a given `ApiItem`, return its markdown hyperlink.
36
+ *
37
+ * @returns The hyperlink, or `undefined` if the `ApiItem` object does not have a hyperlink.
38
+ */
39
+ getLinkForApiItem(apiItem) {
40
+ return this._implementation.getLinkForApiItem(apiItem);
41
+ }
42
+ }
43
+ exports.MarkdownDocumenterAccessor = MarkdownDocumenterAccessor;
44
+ //# sourceMappingURL=MarkdownDocumenterAccessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownDocumenterAccessor.js","sourceRoot":"","sources":["../../src/plugin/MarkdownDocumenterAccessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAYH;;;;;;;;GAQG;AACH,MAAa,0BAA0B;IAGrC,gBAAgB;IAChB,YACE,cAAyD;QAEzD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,OAAgB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;CACF;AAlBD,gEAkBC"}
@@ -0,0 +1,88 @@
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 { ApiItem, ApiModel } from 'api-extractor-model-me';
18
+ import { PluginFeature } from './PluginFeature';
19
+ import { MarkdownDocumenterAccessor } from './MarkdownDocumenterAccessor';
20
+ /**
21
+ * Context object for {@link MarkdownDocumenterFeature}.
22
+ * Exposes various services that can be used by a plugin.
23
+ *
24
+ * @public
25
+ */
26
+ export declare class MarkdownDocumenterFeatureContext {
27
+ /**
28
+ * Provides access to the `ApiModel` for the documentation being generated.
29
+ */
30
+ readonly apiModel: ApiModel;
31
+ /**
32
+ * The full path to the output folder.
33
+ */
34
+ readonly outputFolder: string;
35
+ /**
36
+ * Exposes functionality of the documenter.
37
+ */
38
+ readonly documenter: MarkdownDocumenterAccessor;
39
+ /** @internal */
40
+ constructor(options: MarkdownDocumenterFeatureContext);
41
+ }
42
+ /**
43
+ * Event arguments for MarkdownDocumenterFeature.onBeforeWritePage()
44
+ * @public
45
+ */
46
+ export interface IMarkdownDocumenterFeatureOnBeforeWritePageArgs {
47
+ /**
48
+ * The API item corresponding to this page.
49
+ */
50
+ readonly apiItem: ApiItem;
51
+ /**
52
+ * The page content. The {@link MarkdownDocumenterFeature.onBeforeWritePage} handler can reassign this
53
+ * string to customize the page appearance.
54
+ */
55
+ pageContent: string;
56
+ /**
57
+ * The filename where the output will be written.
58
+ */
59
+ readonly outputFilename: string;
60
+ }
61
+ /**
62
+ * Event arguments for MarkdownDocumenterFeature.onFinished()
63
+ * @public
64
+ */
65
+ export interface IMarkdownDocumenterFeatureOnFinishedArgs {
66
+ }
67
+ /**
68
+ * Inherit from this base class to implement an API Documenter plugin feature that customizes
69
+ * the generation of markdown output.
70
+ *
71
+ * @public
72
+ */
73
+ export declare class MarkdownDocumenterFeature extends PluginFeature {
74
+ /** {@inheritdoc PluginFeature.context} */
75
+ context: MarkdownDocumenterFeatureContext;
76
+ /**
77
+ * This event occurs before each markdown file is written. It provides an opportunity to customize the
78
+ * content of the file.
79
+ * @virtual
80
+ */
81
+ onBeforeWritePage(eventArgs: IMarkdownDocumenterFeatureOnBeforeWritePageArgs): void;
82
+ /**
83
+ * This event occurs after all output files have been written.
84
+ * @virtual
85
+ */
86
+ onFinished(eventArgs: IMarkdownDocumenterFeatureOnFinishedArgs): void;
87
+ static [Symbol.hasInstance](instance: object): boolean;
88
+ }
@@ -0,0 +1,66 @@
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.MarkdownDocumenterFeature = exports.MarkdownDocumenterFeatureContext = void 0;
20
+ const node_core_library_1 = require("@rushstack/node-core-library");
21
+ const PluginFeature_1 = require("./PluginFeature");
22
+ /**
23
+ * Context object for {@link MarkdownDocumenterFeature}.
24
+ * Exposes various services that can be used by a plugin.
25
+ *
26
+ * @public
27
+ */
28
+ class MarkdownDocumenterFeatureContext {
29
+ /** @internal */
30
+ constructor(options) {
31
+ this.apiModel = options.apiModel;
32
+ this.outputFolder = options.outputFolder;
33
+ this.documenter = options.documenter;
34
+ }
35
+ }
36
+ exports.MarkdownDocumenterFeatureContext = MarkdownDocumenterFeatureContext;
37
+ const uuidMarkdownDocumenterFeature = '34196154-9eb3-4de0-a8c8-7e9539dfe216';
38
+ /**
39
+ * Inherit from this base class to implement an API Documenter plugin feature that customizes
40
+ * the generation of markdown output.
41
+ *
42
+ * @public
43
+ */
44
+ class MarkdownDocumenterFeature extends PluginFeature_1.PluginFeature {
45
+ /**
46
+ * This event occurs before each markdown file is written. It provides an opportunity to customize the
47
+ * content of the file.
48
+ * @virtual
49
+ */
50
+ onBeforeWritePage(eventArgs) {
51
+ // (implemented by child class)
52
+ }
53
+ /**
54
+ * This event occurs after all output files have been written.
55
+ * @virtual
56
+ */
57
+ onFinished(eventArgs) {
58
+ // (implemented by child class)
59
+ }
60
+ static [Symbol.hasInstance](instance) {
61
+ return node_core_library_1.TypeUuid.isInstanceOf(instance, uuidMarkdownDocumenterFeature);
62
+ }
63
+ }
64
+ exports.MarkdownDocumenterFeature = MarkdownDocumenterFeature;
65
+ node_core_library_1.TypeUuid.registerClass(MarkdownDocumenterFeature, uuidMarkdownDocumenterFeature);
66
+ //# sourceMappingURL=MarkdownDocumenterFeature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownDocumenterFeature.js","sourceRoot":"","sources":["../../src/plugin/MarkdownDocumenterFeature.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAMH,oEAAwD;AACxD,mDAAgD;AAGhD;;;;;GAKG;AACH,MAAa,gCAAgC;IAgB3C,gBAAgB;IAChB,YAAmB,OAAyC;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF;AAtBD,4EAsBC;AA8BD,MAAM,6BAA6B,GACjC,sCAAsC,CAAC;AAEzC;;;;;GAKG;AACH,MAAa,yBAA0B,SAAQ,6BAAa;IAI1D;;;;OAIG;IACI,iBAAiB,CACtB,SAA0D;QAE1D,+BAA+B;IACjC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,SAAmD;QACnE,+BAA+B;IACjC,CAAC;IAEM,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAgB;QACjD,OAAO,4BAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC;IACxE,CAAC;CACF;AA1BD,8DA0BC;AAED,4BAAQ,CAAC,aAAa,CACpB,yBAAyB,EACzB,6BAA6B,CAC9B,CAAC"}